nvim-telescope / telescope-fzf-native.nvim

FZF sorter for telescope written in c
1.36k stars 45 forks source link

How can I help with Windows support? #43

Closed Nazeehe closed 2 years ago

Nazeehe commented 2 years ago

Hey @Conni2461,

You may remember me when we you helped me with a couple of PRs for telescope a while ago.

Anyway, I am primarily a Windows user and spend a bunch of my time helping fix Windows issues with the nvim ecosystem. I can see that this plugin here requires "extra" work for Windows users that probably is not needed if we just bundle the dll with. Unlike Linux, this dll will work on Windows unchanged as it's very simple. Probably doesn't need to be built on the user's machine.

How can I help? I can see a couple of challenges:

Anyway, I am available to help if it's something you need. This plugin seems almost core to Telescope now from a perf point of view. Windows users will probably not use it since compiling it locally requires extra steps. In the meantime, I will see if there's something I can do to help make building it easier?

Thanks!

Conni2461 commented 2 years ago

We should look into a lua script + download from artifacts/release.

Are you still interested in doing that? I would be happy if the installation process becomes easier for Windows users :)

Leandros commented 2 years ago

I can help out as well!

loshjawrence commented 2 years ago

On Windows if i install make and llvm via chocolatey, i can run make in my fzf native plugin folder however i need to switch gcc to clang and remove both -Werror and -fpic as they will cause issues. -Werror will complain about deprecations and -fpic doesn't seem to be a thing for clang on when it targets Windows.

the dll gets created but if i try to open nvim and run a telescope find_files it will fail: image

Leandros commented 2 years ago

@loshjawrence: Which branch did you use? The main branch is lacking dllexports and hence does not work on Windows. Try this branch: https://github.com/Leandros/telescope-fzf-native.nvim/tree/feature/windows_build_support

LudoPinelli commented 2 years ago

Hi, Sorry if the answer is obvious but I'm pretty new to the programmin/git world, so I'll ask. I tried to install the "windows_build_support" branch of the plugin, but packer tells me that it fails installing it (I checked and double-checked the path I gave to my local clone of course^^). When I look to AppData/Local/nvim-data/site/pack/packer/start/ there is just an empty "telescope-fzf-native.nvim" directory.

So I tried to go to the local clone of the plugin and launch make, but I obtain this error (sorry it's in french but basically "the specified file can't be found") :

mkdir build
gcc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll
process_begin: CreateProcess(NULL, gcc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll, ...) failed.
make (e=2): Le fichier spécifié est introuvable.
make: *** [Makefile:19: build/libfzf.dll] Error 2

which is very strange since the src/fzf.c is there... Any idea?

calvinchoy commented 2 years ago

Is using: https://github.com/Leandros/telescope-fzf-native.nvim/tree/feature/windows_build_support still the easiest/recommended way to get fzf-native working in windows? or should I rather build it from source?

Leandros commented 2 years ago

@calvinchoy: It works for me. I'm currently in process of integrating the feedback of this PR into a new PR but in the meanwhile feel free to use it.

KiLLeRRaT commented 2 years ago

Hi, is there a way to install this and it comes with the binaries precompiled for Windows? E.g. simply pluginstall and voila.

Thanks!

calvinchoy commented 2 years ago

@KiLLeRRaT, not sure about the binary but I got it working fine by installing the make tool on windows using choco.

KiLLeRRaT commented 2 years ago

I will give that a go. Do you have a guide handy for that by any chance? Thanks!

calvinchoy commented 2 years ago

If you are using power shell you can use chocolatey to install the make tool on windows:

choco install make

After this you can continue the installation as described in this repo. It will now able to find the make command on post install (i.e. do: make when using vim-plug). This will compile the library for usage in windows.

https://community.chocolatey.org/packages/make

KiLLeRRaT commented 2 years ago

Sorry for the spam, my previous email reply doesn't support Markdown. Here is the solution that worked for me in Windows. Would be awesome to perhaps list this out as steps in the main readme under a Windows heading.

choco install mingw
choco install make

Then in my C:\Users\Username\AppData\Local\nvim\plugged\telescope-fzf-native.nvim directory I just ran:

make

You may not need to do this if you first do the choco installs, and THEN run the :PlugInstall

This produces the binary build/libfzf.dll which is needed.

Close and reload everything, and now it works :)

Cheers,

lukebakken commented 2 years ago

I can confirm that @KiLLeRRaT's instructions in this comment work on Windows 10.

Conni2461 commented 2 years ago

We just merged cmake support with instructions on how to build it with cmake: https://github.com/nvim-telescope/telescope-fzf-native.nvim/commit/2330a7eac13f9147d6fe9ce955cb99b6c1a0face

This should make windows builds easier. I've just opened a new issue on prebuild binaries provided over CI or a release. I'll then provide a simple lua script that will download the prebuild binaries providing support for everyone without access to a compiler and or build system: https://github.com/nvim-telescope/telescope-fzf-native.nvim/issues/69

I'll close this issue because it was addressed by https://github.com/nvim-telescope/telescope-fzf-native.nvim/commit/2330a7eac13f9147d6fe9ce955cb99b6c1a0face

Thanks for all people providing input and workarounds here :)

HermesSantos commented 10 months ago

We just merged cmake support with instructions on how to build it with cmake: 2330a7e

This should make windows builds easier. I've just opened a new issue on prebuild binaries provided over CI or a release. I'll then provide a simple lua script that will download the prebuild binaries providing support for everyone without access to a compiler and or build system: #69

I'll close this issue because it was addressed by 2330a7e

Thanks for all people providing input and workarounds here :)

it worked, thank you so much!