General Porting Tips
While porting many UNIX-progs to NeXTstep, I stumbled over some nasty but solveable problems:
cc: Internal compiler error: program cc1obj got fatal signal 11
I found three memory related solutions so far:
-> turn off Optimization (-Ox) ...or...
-> turn off Debug (-g) ...or...
-> limit stacksize 10000 (before make)
foo.h:247: macro `index' used with just one arg
#undef index (index is already defined in string.h!)
foo.c:1234: bad macro argument list
-> add --traditional-cpp to CFLAGS
ld: Undefined symbols: _strdup
-> gcc -o foo bar.o -lstdc++ ...or...
-> gcc -o foo bar.o -liberty
ld: Undefined symbols: _mkfifo
-> mknod(path, S_IFIFO|mode, 0);
undefined type, found `pid_t'
typedef int pid_t;
POSIX (not recommend):
-> gcc -posix ... -lposix
Functions and their Replacements
getcwd can be replaced by the BSD-command getwd(pathname). The pathnames length must not be longer then MAXPATHLEN characters (1024), as defined in <sys/param.h>.
waitpid can be implemented as a macro, using one of the BSD waitN functions, e.g.,
#define waitpid(p, s, o) wait3((union wait *)(s), (o), (struct rusage *) 0)
NeXTstep 3.3 does not have uname.
Functions
[ basename.c | getcwd.c | getschr.c | mmap.c | putenv.c | setenv.c | sp_offset.c | strdup.c | tcgetattr.c | tempnam.c | tempname.c | termios.c ]
POSIX-binaries
On a black NeXT you can use otool, to get some working functions out of libposix.a, e.g.
[ sigaction.o | sigsetops.o ]
ò¶Þò†Ú: http://www.drolls.de/NeXT/Porting.html, http://www.math.unl.edu/~rdieter/OpenStep/Developer/PortingTips/
|