deadpixi / sam

An updated version of the sam text editor.
Other
430 stars 46 forks source link

Missing macro #120

Open polluks opened 3 years ago

polluks commented 3 years ago
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 commented 2 years ago

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 commented 2 years ago

An older macOS :)

jacksonbenete commented 2 years ago

An older macOS :)

Is it macOS or OS X?

Would you mind sharing the output of your sw_vers?

polluks commented 2 years ago
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 commented 2 years ago
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?