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

Does not compile on MSYS2 #784

Closed
csdvrx opened this issue Nov 17, 2020 · 9 comments
Closed

Does not compile on MSYS2 #784

csdvrx opened this issue Nov 17, 2020 · 9 comments
Labels

Comments

@csdvrx
Copy link

csdvrx commented Nov 17, 2020

nnn v3.5 doesn't compile on the latest msys2

make

cc -std=c11 -Wall -Wextra -Wshadow -O3 -D_XOPEN_SOURCE=600 -I/usr/include/ncursesw -o nnn src/nnn.c -lreadline -pipe -lncursesw
src/nnn.c:2418:72: error: ‘strcasestr’ undeclared here (not in a function); did you mean ‘strcasecmp’?

(...)
src/nnn.c:5018:11: error: ‘AT_SYMLINK_NOFOLLOW’ undeclared (first use in this function)

(...)

src/nnn.c:5227:47: error: ‘O_CLOEXEC’ undeclared (first use in this function); did you mean ‘FD_CLOEXEC’?

msys2 is a posix environment but a less lenient one: it requires proper definition to access recent posix additions. everything you need is there, but without requiring access, you won’t get it!

In commit 747c58cfff3fc9265f8bf3b880d2b82de5a2977c I made a fix that I find a bit dirty: a conditional #define _GNU_SOURCE, right above your #ifdef _linux, with just #if defined(MINGW) || defined(MINGW32) || defined(MINGW64) || defined(CYGWIN), without checking more precisely for the proper version.

Right now it compiles:

make

cc -std=c11 -Wall -Wextra -Wshadow -O3 -D_XOPEN_SOURCE=600 -I/usr/include/ncursesw -o nnn src/nnn.c -lreadline -pipe -lncursesw

You are not using GNU autoconf, an interesting choice, as I believe the issue fixed may point to a structural issue with POSIX compliance

@csdvrx csdvrx added the bug label Nov 17, 2020
@jarun
Copy link
Owner

jarun commented Nov 17, 2020

@sjmulder could you help with this? I know you compiled nnn on many obscure OS-es. ;)

@jarun
Copy link
Owner

jarun commented Nov 17, 2020

but without requiring access, you won’t get it!

I am not sure what that means.

In commit 747c58cfff3fc9265f8bf3b880d2b82de5a2977c

Where is it? Link please?

You are not using GNU autoconf, an interesting choice

I really don't have the time to go back to autoconf and automake, however dirty your fix may look like. :) I don't see any issue with platform-specific patches. When a platform imposes cosmetic conditions to compile stuff on it, most users won't be using it.

@jarun
Copy link
Owner

jarun commented Nov 17, 2020

Please raise the PR so you can start using nnn rather right away! ;)

@jarun jarun closed this as completed in d38f4b1 Nov 17, 2020
@jarun
Copy link
Owner

jarun commented Nov 17, 2020

Please test the patch (on master) and confirm it works.

@csdvrx
Copy link
Author

csdvrx commented Nov 18, 2020

I used a separate test on my branch (where the commit came from) to do more checks on the version, but it works and compiles, if that's good enough, why not?

@sjmulder
Copy link
Collaborator

@jarun I don't have an msys build environment set up now but could if you still need testing.

@jarun
Copy link
Owner

jarun commented Nov 18, 2020

I believe this is fixed now.

@jarun
Copy link
Owner

jarun commented Nov 18, 2020

At commit d38f4b1.

@jarun
Copy link
Owner

jarun commented Nov 26, 2020

@csdvrx along with msys2, would it be possible for you to add a package for Cygwin as well? It's been a long term request from Cygwin users.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants