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

Missing macro #120

Open
polluks opened this issue Jul 23, 2021 · 5 comments
Open

Missing macro #120

polluks opened this issue Jul 23, 2021 · 5 comments

Comments

@polluks
Copy link

polluks commented Jul 23, 2021

gcc  -std=c99 -I../include -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500 -I/usr/include/freetype2 -I/usr/X11/include -I/usr/X11/include/freetype2   -c -o unix.o unix.c
In file included from unix.c:13:
/usr/include/signal.h:71: error: 'NSIG' undeclared here (not in a function)

Workaround -D_ANSI_SOURCE

@jacksonbenete
Copy link

Not the same but a similar error will occur on macOS:

gcc  -std=c99 -I../include -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2   -c -o unix.o unix.c
In file included from unix.c:13:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:69:42: error: use of undeclared identifier 'NSIG'
extern __const char *__const sys_signame[NSIG];
                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:70:42: error: use of undeclared identifier 'NSIG'
extern __const char *__const sys_siglist[NSIG];
                                         ^
2 errors generated.

The workaround for macOS is -D_DARWIN_C_SOURCE but this is described on config.mk.def.

What OS you're using?

@polluks
Copy link
Author

polluks commented Feb 20, 2022

An older macOS :)

@jacksonbenete
Copy link

An older macOS :)

Is it macOS or OS X?

Would you mind sharing the output of your sw_vers?

@polluks
Copy link
Author

polluks commented Feb 20, 2022

ProductName:	Mac OS X
ProductVersion:	10.5.8
BuildVersion:	9L31a

Indeed, -D_DARWIN_C_SOURCE works but I'm missing getline

Undefined symbols:
  "_getline", referenced from:
      _loadrcfile in samrc.o
ld: symbol(s) not found

@jacksonbenete
Copy link

ProductName:	Mac OS X
ProductVersion:	10.5.8
BuildVersion:	9L31a

Indeed, -D_DARWIN_C_SOURCE works but I'm missing getline

Undefined symbols:
  "_getline", referenced from:
      _loadrcfile in samrc.o
ld: symbol(s) not found

I see, you're on 10.5.x, when I look at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h on line 348 I can see the following:

#if __DARWIN_C_LEVEL >= 200809L
#include <sys/_types/_ssize_t.h>

__BEGIN_DECLS
(...)
ssize_t getline(char ** __restrict __linep, size_t * __restrict __linecapp, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
(...)
__END_DECLS
#endif /* __DARWIN_C_LEVEL >= 200809L */

Looks like getline was included on 10.7, that's why you don't have it.
I'll change my #121 to also put your workaround when Darwin is lower than 10.7.

Can you download this version and see if it would compile correctly on your OS version?

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

2 participants