Opened 19 years ago
Closed 14 years ago
#892 closed defect (wontfix)
psModules/src/extras/kapa fails with odd syntax error
| Reported by: | Michael Wood-Vasey | Owned by: | heather |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | psconfig | Version: | unspecified |
| Severity: | normal | Keywords: | Mac |
| Cc: | Michael Wood-Vasey, jester@…, Mark Huber |
Description (last modified by )
Created an attachment (id=100)
Header file desired by kapa for netinet
Compilation of 'kapa' under psModules fails on Mac OS X PowerBook G4 (10.4.10). It apparently isn't loading something right. I don't know if this is a typedef/define problem or there's something earlier in the header includes that's just getting caught when it tries to resolve the struct definition in 'netinet/ip.h'. I have attached 'netinet/ip.h', but I assumed the resolution will come from how the header files are put together.
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I../../src -I../../src/extras -I../../src/config -I../../src/concepts -I../../src/camera -I../../src/astrom -I../../src/detrend -I../../src/imcombine -I../../src/objects -I/Users/Shared/PS1/code/ipp-2.2/default.darwin/include -I/usr/X11R6/include -D_THREAD_SAFE -DHAVE_PSDB -I/Users/Shared/PS1/code/ipp-2.2default.darwin/include/pslib -I/Users/Shared/PS1/code/ipp-2.2default.darwin/include/mysql -I/Users/Shared/PS1/code/ipp-2.2default.darwin/include -I../pslib/ -pipe -O0 -g -Wall -Werror -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L -MT libpsmodulesextras_la-pmKapaPlots.lo -MD -MP -MF .deps/libpsmodulesextras_la-pmKapaPlots.Tpo -c pmKapaPlots.c -fno-common -DPIC -o .libs/libpsmodulesextras_la-pmKapaPlots.o
In file included from /Users/Shared/PS1/code/ipp-2.2/default.darwin/include/kapa.h:5,
from pmKapaPlots.h:23,
from pmKapaPlots.c:20:
/usr/include/netinet/ip.h:80: error: parse error before 'u_int'
/usr/include/netinet/ip.h:89: error: parse error before 'ip_len'
/usr/include/netinet/ip.h:90: error: parse error before 'ip_id'
/usr/include/netinet/ip.h:91: error: parse error before 'ip_off'
/usr/include/netinet/ip.h:96: error: parse error before 'ip_ttl'
/usr/include/netinet/ip.h:97: error: parse error before 'ip_p'
/usr/include/netinet/ip.h:98: error: parse error before 'ip_sum'
/usr/include/netinet/ip.h:100: error: parse error before '}' token
/usr/include/netinet/ip.h:170: error: parse error before 'u_char'
/usr/include/netinet/ip.h:172: error: parse error before 'ipt_ptr'
/usr/include/netinet/ip.h:174: error: parse error before 'ipt_flg'
/usr/include/netinet/ip.h:188: error: parse error before '}' token
Attachments (1)
Change History (11)
by , 19 years ago
comment:1 by , 19 years ago
OK, here's the source of the problem:
"kapa.h" includes '<netinet/ip.h>', which translates to "/usr/include/netinet/ip.h", which is not POSIX-compliant because it uses the POSIX-obsoleted typdefs 'u_int', 'u_short', and 'u_char'. Since we're compiling under POSIX_C_SOURCE, this means that '/usr/include/sys/types.h' doesn't define these typedefs.
While several hacks immediately present themselves, e.g., non-POSIX compilation for kapa on Mac OS X; updated header files kept locally within tree (seems bad); require some new installation of some netinet package that is POSIX-compliant, a good solution doesn't immediately come to mind.
comment:2 by , 19 years ago
| Owner: | changed from to |
|---|
comment:3 by , 19 years ago
| Cc: | added |
|---|
This seems to be a similar sort of problem as the need for compiling fftw3 with certain flags (--enable-float, and perhaps --with-pic; also libjpeg wants -fPIC on 64-bit machines). I haven't tried the fix Michael offers, but again, perhaps pschecklibs (sh|c)ould be made to check that this particular dependence compiles properly (configure-style?).
comment:4 by , 18 years ago
Add
-D_DARWIN_C_SOURCE
to compile options fixes this. E.g., here's what I just ran to get a successful compilation:
[wwoodvas@serenity extras] cc -std=gnu99 -DHAVE_CONFIG_H -I. -I. -I../../src -I../../src -I../../src/extras -I../../src/config -I../../src/concepts -I../../src/camera -I../../src/astrom -I../../src/detrend -I../../src/imcombine -I../../src/objects -I/Volumes/data/PS1/code/default.darwin/include -I/usr/X11/include -D_THREAD_SAFE -DHAVE_PSDB -I/Volumes/data/PS1/code/default.darwin/include/pslib -I/Volumes/data/PS1/code/default.darwin/include/mysql -I/sw/include -I../pslib/ -pipe -O0 -g -Wall -Werror -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE -MT libpsmodulesextras_la-pmKapaPlots.lo -MD -MP -MF .deps/libpsmodulesextras_la-pmKapaPlots.Tpo -c pmKapaPlots.c -fno-common -DPIC -o .libs/libpsmodulesextras_la-pmKapaPlots.o
Here's the snippet of code in /usr/include/sys/types.h on Mac OS X 10.5.3 (PPC):
| defined(_DARWIN_C_SOURCE) |
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
#ifndef _U_LONG
typedef unsigned long u_long;
#define _U_LONG
#endif
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
#endif
The first line says that if we're POSIX then don't define u_int etc. But then if we know we're on Darwin (i.e. Mac OS X) then we know we need these since they're not defined elsewhere (I'm not quite sure I follow the logic of why this is supposed to work). Thus we add -D_DARWIN_C_SOURCE to the compilation options and it works.
Adding -D_DARWIN_C_SOURCE when compiling on Mac/Darwin seems reasonable enough as a generic step, so I hope this solution is reasonable to implement.
comment:5 by , 18 years ago
| Cc: | added |
|---|
This remains unfixed in ipp-2.6.beta (20080716)
I had to add '-D_DARWIN_C_SOURCE' to 'DEFS' in
psModules/src/extras/Makefile
psModules/src/astrom/Makefile
psModules/src/objects/Makefile
to compile 'psModules'.
comment:6 by , 18 years ago
| Cc: | added |
|---|
When I add -D_DARWIN_C_SOURCE to DEFS another error pops up with psModules/src/extras and psModules/src/astrom using ipp-2.6beta on a Mactel C2D, OS X 10.5.4, gcc 4.0.1, X11 2.3:
gcc -std=gnu99 -DHAVE_CONFIG_H -D_DARWIN_C_SOURCE -I. -I../../src -I../../src -I../../src/extras -I../../src/config -I../../src/concepts -I../../src/camera -I../../src/astrom -I../../src/detrend -I../../src/imcombine -I../../src/objects -I/Users/markus/Research/IPP/ipp-2.6.darwin_x86/include -I/usr/X11/include -D_THREAD_SAFE -DHAVE_PSDB -I/Users/markus/Research/IPP/ipp-2.6.darwin_x86/include/pslib -I/Users/markus/Research/IPP/ipp-2.6.darwin_x86/include/mysql -I/Users/markus/Research/IPP/ipp-2.6.darwin_x86/include -I/Users/markus/Research/IPP/ipp-2.6.darwin_x86/include -I../pslib/ -pipe -O0 -g -Wall -Werror -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L -MT libpsmodulesextras_la-pmKapaPlots.lo -MD -MP -MF .deps/libpsmodulesextras_la-pmKapaPlots.Tpo -c pmKapaPlots.c -fno-common -DPIC -o .libs/libpsmodulesextras_la-pmKapaPlots.o
In file included from /usr/X11/include/X11/Xlib.h:64,
from /Users/markus/Research/IPP/ipp-2.6.darwin_x86/include/kapa.h:11,
from pmKapaPlots.h:23,
from pmKapaPlots.c:20:
/usr/X11/include/X11/Xosdefs.h:145:1: error: "_DARWIN_C_SOURCE" redefined
<command line>:1:1: error: this is the location of the previous definition
make[2]: * [libpsmodulesextras_la-pmKapaPlots.lo] Error 1
make[1]: * [all-recursive] Error 1
make: * [all] Error 2
comment:7 by , 18 years ago
| Owner: | changed from to |
|---|
comment:8 by , 16 years ago
| Component: | build → psconfig |
|---|---|
| Description: | modified (diff) |
| Keywords: | Mac added |
| Owner: | changed from to |
| Priority: | high → normal |
| Status: | new → assigned |
comment:9 by , 15 years ago
| Owner: | changed from to |
|---|
comment:10 by , 14 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
I don't have this problem on my intel mac and I don't have access to a powerpc mac...

Header file desired by kapa for netinet