swarn / fzy-lua

A lua implementation of the fzy fuzzy matching algorithm
MIT License
72 stars 5 forks source link

fzy-lua fails to install on Windows #11

Closed mrcjkb closed 8 months ago

mrcjkb commented 8 months ago

Hey :wave:

Attepting luarocks install fzy on Windows fails with

src/match.c(18): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory

https://github.com/nvim-neorocks/rocks-binaries/actions/runs/8191805472/job/22401866175#step:9:815

There are two ways I could think of to fix this:

  1. Use a platform override in the rockspec to prevent it from trying to compile the native library.
  2. Add an adapter header (see this PR). I'm not sure if there are any other headers that might be missing on Windows though.
swarn commented 8 months ago

I am confuse!

The match.c code does not use strings.h, it uses the standard string.h. It seems to build on Windows.

...

As I was writing that, I got a horrible feeling, and went and checked and the rockspec. It's referencing a tag that is an older version that does include strings.h.

So, I'll update the rockspec, then update this issue.

swarn commented 8 months ago

@mrcjkb , you've clearly been uploading a lot of rockspecs lately, can you give me some tips here?

I ran luarocks upload fzy-scm-1.rockspec --api-key=.... That spec is listed on the luarocks site, but the older spec is still what gets pulled on luarocks install fzy.

Do I need to tag the lastest commit, make a rockspec fzy-1.0.1-1.rockspec that references it, then upload that?

mrcjkb commented 8 months ago

@mrcjkb , you've clearly been uploading a lot of rockspecs lately, can you give me some tips here?

I ran luarocks upload fzy-scm-1.rockspec --api-key=.... That spec is listed on the luarocks site, but the older spec is still what gets pulled on luarocks install fzy.

Ah, now I understand. I was confused about why your CI worked fine 😅

The fzy-scm-1.rockspec is an scm rockspec, which luarocks uploads to the dev manifest. You need a SemVer version for it to be uploaded to the root manifest, which luarocks pulls from by default. If you run luarocks install fzy scm --dev, it should pull the latest scm version.

Do I need to tag the lastest commit, make a rockspec fzy-1.0.1-1.rockspec that references it, then upload that?

There are different ways you can do this. One way is to maintain a rockspecs subdirectory with a rockspec for each release.

I maintain a luarocks-tag-release GitHub action that runs automatically whenever you create a tag and generates a release rockspec for you, which it then uploads to luarocks.org. If you like, I can PR this for you.

swarn commented 8 months ago

Wow, I asked just the right guy for help with this. I would appreciate the PR very much. I've add the luarocks API key as repo secret LUAROCKS_API_KEY.

swarn commented 8 months ago

I'll reopen this until we're double-plus sure everything is working. The latest rockspec is live on Luarocks now.

mrcjkb commented 8 months ago

It works! 🎉