nvim-telescope / telescope-fzf-native.nvim

FZF sorter for telescope written in c
1.4k stars 46 forks source link

Build failed on Windows #122

Open AlejandroSuero opened 7 months ago

AlejandroSuero commented 7 months ago

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 commented 7 months ago

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 commented 5 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 1 week ago

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.