PCH / ObjC issue with gcc 4.0.2-pre

Helge Hess helge.hess@skyrix.com
Fri Aug 26 16:03:00 GMT 2005


Hi,

I'm experiencing some issue with using a precompiled header with an 
Objective-C file. When including the header, I'll get duplicate 
symbols, like this:
---snip---
SaxAttributeList.m:188: error: redefinition of 'struct _objc_symtab'
SaxAttributeList.m:188: error: redefinition of 'struct _objc_module'
SaxAttributeList.m:188: error: redefinition of '__objc_gnu_init'
common.h:26: error: previous definition of '__objc_gnu_init' was here
{standard input}: Assembler messages:
{standard input}:2136: Error: symbol `_OBJC_SYMBOLS' is already defined
---snap---

The same makefile/compilation flags work just fine on OSX 10.4.2.

More logs:
---snip---
helge@sid:~/dev/SOPE-4.5/sope-xml/SaxObjC$ gcc --version
gcc (GCC) 4.0.2 20050816 (prerelease) (Debian 4.0.1-5)
helge@sid:~/dev/SOPE-4.5/sope-xml/SaxObjC$ make messages=yes
Making all for library libSaxObjC...
cd .; \
/home/helge/GNUstep/Library/Makefiles/mkinstalldirs ./shared_debug_obj; 
\
rm -f obj; \
ln -s ./shared_debug_obj obj
if ! test -d ./derived_src; then \
   /home/helge/GNUstep/Library/Makefiles/mkinstalldirs ./derived_src; \
fi
gcc -x objective-c-header common.h -c \
       -pipe -Wall -Wno-protocol -Wall -DCOMPILE_FOR_GSTEP_MAKE=1 
-DSOPE_MAJOR_VERSION=4 -DSOPE_MINOR_VERSION=5 
-DSOPE_SUBMINOR_VERSION=52 -Wno-protocol 
-I/home/helge/GNUstep/Library/Headers/libFoundation/ix86/linux-gnu/GNU 
-DGNUSTEP=1 -DWITH_GSTEP_MAKE=1 -DLIB_FOUNDATION_LIBRARY=1 
-DFD_WITH_GSMAKE=1 -DGNUSTEP=1 -DGNU_RUNTIME=1 -D_REENTRANT -fPIC -g 
-Wall -DDEBUG -fno-omit-frame-pointer -DGSWARN -DGSDIAGNOSE 
-fno-strict-aliasing -fgnu-runtime -I.. -I. 
-I/home/helge/GNUstep/Library/Headers 
-I/home/helge/GNUstep//Library/Headers 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU \
        -o derived_src/common.h.gch
gcc SaxAttributeList.m -c \
       -pipe -Wall -Wno-protocol -Wall -DCOMPILE_FOR_GSTEP_MAKE=1 
-DSOPE_MAJOR_VERSION=4 -DSOPE_MINOR_VERSION=5 
-DSOPE_SUBMINOR_VERSION=52 -Wno-protocol 
-I/home/helge/GNUstep/Library/Headers/libFoundation/ix86/linux-gnu/GNU 
-DGNUSTEP=1 -DWITH_GSTEP_MAKE=1 -DLIB_FOUNDATION_LIBRARY=1 
-DFD_WITH_GSMAKE=1 -DGNUSTEP=1 -DGNU_RUNTIME=1 -D_REENTRANT -fPIC -g 
-Wall -DDEBUG -fno-omit-frame-pointer -DGSWARN -DGSDIAGNOSE 
-fno-strict-aliasing -fgnu-runtime -I.. -I. 
-I/home/helge/GNUstep/Library/Headers 
-I/home/helge/GNUstep//Library/Headers 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep//Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep//Library/Headers/libFoundation/./GNU 
-I/home/helge/GNUstep/Library/Headers/libFoundation/./GNU \
       -include ./derived_src/common.h \
        -o shared_debug_obj/SaxAttributeList.o
SaxAttributeList.m:188: error: redefinition of 'struct _objc_symtab'
SaxAttributeList.m:188: error: redefinition of 'struct _objc_module'
SaxAttributeList.m:188: error: redefinition of '__objc_gnu_init'
common.h:26: error: previous definition of '__objc_gnu_init' was here
{standard input}: Assembler messages:
{standard input}:2136: Error: symbol `_OBJC_SYMBOLS' is already defined
{standard input}:2302: Error: symbol `_OBJC_MODULES' is already defined
{standard input}:2351: Error: symbol `_OBJC_CLASS_NAME_0' is already 
defined
...
helge@sid:~/dev/SOPE-4.5/sope-xml/SaxObjC$ file derived_src/common.h.gch
derived_src/common.h.gch: GCC precompiled header (version 012) for 
Objective C
---snap---

Any hints?

Thanks a lot,
   Helge
-- 
http://docs.opengroupware.org/Members/helge/
OpenGroupware.org



More information about the Gcc mailing list