Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed on Windows #122

Open
AlejandroSuero opened this issue Mar 4, 2024 · 10 comments
Open

Build failed on Windows #122

AlejandroSuero opened this issue Mar 4, 2024 · 10 comments

Comments

@AlejandroSuero
Copy link

I tried using fzf plugin in Windows but failed at the building step, in Linux and Mac seems to be working just fine.

Windows version
11

Nvim version
9.5

fzf version
0.46.1 (3c0a630)

Note: downloaded from winget

Error message
from lazy ui:

mkdir -p build
cc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.so
process_begin: CreateProcess(NULL, cc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.so, ...) failed.

make: *** [Makefile:24: build/libfzf.so] Error 2
@AlejandroSuero
Copy link
Author

I changed the build key to:

{
  build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
}

and got this error messages when building.

        Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:210 char:33
        +         $hash.Add($_.Basename, (Import-PowerShellDataFile $_.FullName ...
        +                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
            + FullyQualifiedErrorId : CommandNotFoundException

        Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:196 char:22
        +         $colorData = Import-PowerShellDataFile $_.FullName
        +                      ~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
            + FullyQualifiedErrorId : CommandNotFoundException

        Index operation failed; the array index evaluated to null.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:197 char:9
        +         $hash[$colorData.Name] = $colorData
        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : NullArrayIndex

        Index operation failed; the array index evaluated to null.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:198 char:9
        +         $hash[$colorData.Name].Types.Directories[''] = $colorReset
        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : NullArrayIndex

        Index operation failed; the array index evaluated to null.
        At C:\Users\imBLZ\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:199 char:9
        +         $hash[$colorData.Name].Types.Files['']       = $colorReset
        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : NullArrayIndex

        Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:196 char:22
        +         $colorData = Import-PowerShellDataFile $_.FullName
        +                      ~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
            + FullyQualifiedErrorId : CommandNotFoundException

        Index operation failed; the array index evaluated to null.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:197 char:9
        +         $hash[$colorData.Name] = $colorData
        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : NullArrayIndex

        Index operation failed; the array index evaluated to null.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:198 char:9
        +         $hash[$colorData.Name].Types.Directories[''] = $colorReset
        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : NullArrayIndex

        Index operation failed; the array index evaluated to null.
        At C:\userpath\scoop\modules\Terminal-Icons\Terminal-Icons.psm1:199 char:9
        +         $hash[$colorData.Name].Types.Files['']       = $colorReset
        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : NullArrayIndex

        At line:1 char:46
        + cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build - ...
        +                                              ~~
        The token '&&' is not a valid statement separator in this version.
        At line:1 char:86
        + ... BUILD_TYPE=Release && cmake --build build --config Release && cmake - ...
        +                                                                ~~
        The token '&&' is not a valid statement separator in this version.
            + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
            + FullyQualifiedErrorId : InvalidEndOfLine

@Luladjiev
Copy link

Luladjiev commented May 7, 2024

The way I made it work is install Zig language, and execute, from plugin's folder

zig cc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll

basically the same command but with zig cc instead of gcc

@ilyassBZ
Copy link

The way I made it work is install Zig language, and execute, from plugin's folder

zig cc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll

basically the same command but with zig cc instead of gcc

its worked for me thaanks maan soo much i tried everything but this one is from heaven lol

@Ayush-Porwal
Copy link

The way I made it work is install Zig language, and execute, from plugin's folder

zig cc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll

basically the same command but with zig cc instead of gcc

Thanks for this! It worked for me too. I tried using make and cmake options on Windows (downloaded via msys64, pacman thingy, so it is possible that some Microsoft toolchain C++ binaries might be missing and hence this error could have been happening, more than this, I don't know), but they didn’t work. However, everything worked smoothly on macOS.

For context, I was following this guide to set up my Neovim. During installation, I encountered issues with telescope-fzf-native.nvim and luasnip (though I'm not sure if the latter is related). I was getting a sourcing error because of these.

Here's the Neovim config repository for anyone interested.

@OrdoFlammae
Copy link

The original error is not exactly like what I was observing myself on Windows, but can you check to see if #133 fixes your issue? If so, I can add this issue to the fixed list on the PR.

@GitMurf
Copy link

GitMurf commented Oct 15, 2024

zig cc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll

Thanks alot @Luladjiev ... that worked for me as well. Do you have to manually run it directly in powershell in the directory of fzf? or were you able to add the zig command to your telescope lua plugin file for the build property? I was not able to get it to work in the plugin config build property but would love to figure it out (if possible) for future.

@Luladjiev
Copy link

@GitMurf I had to do it manually in powershell.

@GitMurf
Copy link

GitMurf commented Oct 15, 2024

@GitMurf I had to do it manually in powershell.

Thanks for the response and for the solution!

@kirill-d-lappo
Copy link

doesn't work for me when executed by Lazy

I had to navigate manually to ~/AppData/Local/nvim-data/lazy/telescope-fzf-native.nvim

and execute the build command:

cd ~/AppData/Local/nvim-data/lazy/telescope-fzf-native.nvim

# in powershell replace && with ;
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release ; cmake --build build --config Release

output is:

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22631.
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/kiril/AppData/Local/nvim-data/lazy/telescope-fzf-native.nvim/build
MSBuild version 17.11.9+a69bbaaf5 for .NET Framework

  1>Checking Build System
  Building Custom Rule C:/Users/kiril/AppData/Local/nvim-data/lazy/telescope-fzf-native.nvim/CMakeLists.txt
  Auto build dll exports
  fzf.vcxproj -> C:\Users\kiril\AppData\Local\nvim-data\lazy\telescope-fzf-native.nvim\build\Release\libfzf.dll
  Building Custom Rule C:/Users/kiril/AppData/Local/nvim-data/lazy/telescope-fzf-native.nvim/CMakeLists.txt

additionaly I had to copy libfzf.dll to build folder because plugin searches for it there

cd ~/AppData/Local/nvim-data/lazy/telescope-fzf-native.nvim
cp ./build/Release/libfzf.dll ./build/libfzf.dll

after that it started to work

@Or1g3n
Copy link

Or1g3n commented Oct 28, 2024

I had the same exact issue where it places the dll in the ...build/release folder as opposed to in the ...build dir where telescope expects to find it.

I first spent a couple hours trying to get the build to work correctly and the solution was to install CMake, the SDK for my OS (in my case windows 10), then make sure to add the path to cmake.exe in my env variables. Finally I manually moved the files in the ...build/release dir to ...build and it finally worked. I hope the maintainers read this so they can make appropriate mods to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants