sam icon indicating copy to clipboard operation
sam copied to clipboard

Missing macro

Open polluks opened this issue 2 years ago • 5 comments

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

polluks avatar Jul 23 '21 20:07 polluks

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?

jacksonbenete avatar Feb 20 '22 16:02 jacksonbenete

An older macOS :)

polluks avatar Feb 20 '22 17:02 polluks

An older macOS :)

Is it macOS or OS X?

Would you mind sharing the output of your sw_vers?

jacksonbenete avatar Feb 20 '22 17:02 jacksonbenete

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

polluks avatar Feb 20 '22 18:02 polluks

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?

jacksonbenete avatar Feb 20 '22 21:02 jacksonbenete