|
From: Per P. <per...@ma...> - 2005-05-08 12:24:55
|
Hi, I've had a report that gnuplot won't compile on OS X 10.4 and gcc 4.0 because of a conflict with a static char array "Class" in gplt_x11.c and the Objective-C type "Class". It has not been a problem before so it seems gcc 4 is pickier about this than gcc 3.x. I haven't upgraded to 10.4 yet, but I thought that I could be "pro-active" and fix it anyway... When detecting Mac OS X and libaquaterm "-ObjC" is added to CFLAGS (apple.m4), and every file is compiled as ObjC although only aquaterm.trm needs the "-ObjC" flag. As I see it, there are two ways to fix this: 1) Change the name "Class" in gplt_x11.c 2) Increase granularity in buildsystem to only compile aquaterm.trm (or term.c) with "-ObjC" Obviously, (2) is the right thing to do, but I have to confess that I don't understand how to properly change the build system to achieve that. Suggestions would be appreciated. /Per |
|
From: Hans-Bernhard B. <br...@ph...> - 2005-05-08 16:47:36
|
Per Persson wrote: > I've had a report that gnuplot won't compile on OS X 10.4 and gcc 4.0 > because of a conflict with a static char array "Class" in gplt_x11.c and > the Objective-C type "Class". It has not been a problem before so it > seems gcc 4 is pickier about this than gcc 3.x. Or maybe it's plain wrong about it. Stranger bugs have crept into little-used corners of GCC before. > When detecting Mac OS X and libaquaterm "-ObjC" is added to CFLAGS > (apple.m4), and every file is compiled as ObjC although only > aquaterm.trm needs the "-ObjC" flag. > As I see it, there are two ways to fix this: > 1) Change the name "Class" in gplt_x11.c > 2) Increase granularity in buildsystem to only compile aquaterm.trm (or > term.c) with "-ObjC" I'm not convinced that (2) can work. -ObjC effectively switches to a different language, with possibly different calling conventions and name mangling rules. I wouldn't be surprised in any way if this broke the link completely. |
|
From: Per P. <per...@ma...> - 2005-05-08 19:33:25
|
On May 8, 2005, at 18:47, Hans-Bernhard Broeker wrote: > Per Persson wrote: >> I've had a report that gnuplot won't compile on OS X 10.4 and gcc 4.0 >> because of a conflict with a static char array "Class" in gplt_x11.c >> and the Objective-C type "Class". It has not been a problem before so >> it seems gcc 4 is pickier about this than gcc 3.x. > > Or maybe it's plain wrong about it. Stranger bugs have crept into > little-used corners of GCC before. Agreed. > >> When detecting Mac OS X and libaquaterm "-ObjC" is added to CFLAGS >> (apple.m4), and every file is compiled as ObjC although only >> aquaterm.trm needs the "-ObjC" flag. >> As I see it, there are two ways to fix this: >> 1) Change the name "Class" in gplt_x11.c >> 2) Increase granularity in buildsystem to only compile aquaterm.trm >> (or term.c) with "-ObjC" > > I'm not convinced that (2) can work. -ObjC effectively switches to a > different language, with possibly different calling conventions and > name mangling rules. ObjC is a strict superset of C, in the sense that any C (well make that C89 or whatever) code *should* compile using the ObjC compiler. There is no C++ style name mangling going on in ObjC. It is common practice to mix C and ObjC using each where it is best suited. > I wouldn't be surprised in any way if this broke the > link completely. Not a linker issue, it is the compiler complaining... The following is from a bugreport to DarwinPorts (package manager) list: > if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../term -I../term > -DBINDIR=\"/opt/local/bin\" - > DX11_DRIVER_DIR=\"/opt/local/libexec/gnuplot/4.0\" -DCONTACT=\"gnuplot- > bugs at lists.sourceforge.net\" > -DHELPFILE=\"/opt/local/share/gnuplot/4.0/gnuplot.gih\" -I/opt/local/ > include -no-cpp-precomp -I/usr/X11R6/include -I/opt/local/include > -I/opt/local/include -g -O2 - > ObjC -MT gplt_x11.o -MD -MP -MF ".deps/gplt_x11.Tpo" \ > -c -o gplt_x11.o `test -f 'gplt_x11.c' || echo './'`gplt_x11.c; \ > then mv ".deps/gplt_x11.Tpo" ".deps/gplt_x11.Po"; \ > else rm -f ".deps/gplt_x11.Tpo"; exit 1; \ > fi > gplt_x11.c:519: error: 'Class' redeclared as different kind of symbol > <built-in>:0: error: previous declaration of 'Class' was here > make[3]: *** [gplt_x11.o] Error 1 > make[2]: *** [all-recursive] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 As I said, until I get 10.4 installed I really can't explore this further. Still, I think that (2) would be nice to implement some time from a pure cleanlyness perpspective... /Per |
|
From: Ethan M. <merritt@u.washington.edu> - 2005-05-08 21:35:37
|
On Sunday 08 May 2005 05:23 am, Per Persson wrote: > When detecting Mac OS X and libaquaterm "-ObjC" is added to CFLAGS > (apple.m4), and every file is compiled as ObjC although only > aquaterm.trm needs the "-ObjC" flag. > As I see it, there are two ways to fix this: > 1) Change the name "Class" in gplt_x11.c > 2) Increase granularity in buildsystem to only compile aquaterm.trm (or > term.c) with "-ObjC" (3) Clean up aquaterm.trm so that it compiles without the -ObjC flag -- Ethan A Merritt Biomolecular Structure Center University of Washington 98195-7742 |
|
From: <br...@ph...> - 2005-05-09 11:38:50
|
Ethan Merritt wrote: >>1) Change the name "Class" in gplt_x11.c >>2) Increase granularity in buildsystem to only compile aquaterm.trm (or >>term.c) with "-ObjC" > (3) Clean up aquaterm.trm so that it compiles without the -ObjC flag (4) rename that thing in gplt_x11.c from "Class" to something else. |
|
From: Ethan M. <merritt@u.washington.edu> - 2005-05-09 17:25:24
|
On Monday 09 May 2005 04:36 am, Hans-Bernhard Br=F6ker wrote: > Ethan Merritt wrote: > >>1) Change the name "Class" in gplt_x11.c > >>2) Increase granularity in buildsystem to only compile aquaterm.trm (or > >>term.c) with "-ObjC" > > (3) Clean up aquaterm.trm so that it compiles without the -ObjC flag >=20 > (4) rename that thing in gplt_x11.c from "Class" to something else.=20 I thought that was already suggestion (1)? =46ine with me. I'll do it. But I'm still rather uneasy about compiling the whole source tree with -ObjC just because the one terminal driver wants it. =2D-=20 Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |