discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: undefined or invalid # directive (#import ...) when compiling coreba


From: Stefan Bidi
Subject: Re: undefined or invalid # directive (#import ...) when compiling corebase with gcc-2.95
Date: Thu, 9 Jun 2011 10:22:48 -0500

Fixing CFByteOrder is on my to-do list, but I won't be able to get to it until next week.  I see what the problem is... it includes Foundation/NSByteOrder.h which, in turn, uses #import.

Not sure what the second error is.  Line 90 of CFRuntime.h is the defintion of INIT_CFRUNTIME_BASE(), right?  Is this a problem because of the "..." argument?  Does gcc-2.95 not recognize this?

On Thu, Jun 9, 2011 at 8:28 AM, Sebastian Reitenbach <address@hidden> wrote:
Hi,

I run into a weird error, where I don't know where it comes from when I try  to compile corebase from svn on OpenBSD sparc, using gcc-2.95. I get the following error message:

Making all for library libgnustep-corebase...
cc CFByteOrder.c -c \
     -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -fno-stack-protector -I../Headers -I. -I/usr/local/include -I/home/sebastia/GNUstep/Library/Headers -I/usr/local/include \
      -o obj/libgnustep-corebase.obj/CFByteOrder.c.o
In file included from ../Headers/CoreFoundation/CFBase.h:33,
                from ../Headers/CoreFoundation/CFByteOrder.h:30,
                from CFByteOrder.c:27:
/usr/local/include/GNUstepBase/GSVersionMacros.h:31: undefined or invalid # directive
In file included from CFByteOrder.c:28:
/usr/local/include/Foundation/NSByteOrder.h:27: undefined or invalid # directive
/usr/local/include/Foundation/NSByteOrder.h:29: undefined or invalid # directive
/usr/local/include/Foundation/NSByteOrder.h:65: syntax error before `GSSwapI128'
/usr/local/include/Foundation/NSByteOrder.h:65: syntax error before `in'
/usr/local/include/Foundation/NSByteOrder.h:65: warning: type defaults to `int' in declaration of `GSSwapI128'
/usr/local/include/Foundation/NSByteOrder.h:65: warning: data definition has no type or storage class
/usr/local/include/Foundation/NSByteOrder.h:74: syntax error before `GSSwapBigI128ToHost'
/usr/local/include/Foundation/NSByteOrder.h:74: syntax error before `in'
/usr/local/include/Foundation/NSByteOrder.h:74: warning: type defaults to `int' in declaration of `GSSwapBigI128ToHost'
/usr/local/include/Foundation/NSByteOrder.h:74: warning: data definition has no type or storage class
/usr/local/include/Foundation/NSByteOrder.h:83: syntax error before `GSSwapHostI128ToBig'
/usr/local/include/Foundation/NSByteOrder.h:83: syntax error before `in'
... many more syntax errors...

The undefined or invalid # directive is a normal #import <> statement.
The problem is that gcc-2.95 treats the *.c files as c, and there is no #import, when I add ADDITIONAL_CFLAGS=-x objective-c then it adds it more at the end of the compiler invocation, and I get this:

cc CFByteOrder.c -c \
     -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -g -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -fno-stack-protector -x objective-c -I../Headers -I. -I/usr/local/include -I/gnustep-corebase-0.1_writes_to_HOME/GNUstep/Library/Headers -I/usr/local/include \
      -o obj/libgnustep-corebase.obj/CFByteOrder.c.o
cc: Warning: `-x objective-c' after last input file has no effect

So I defined CC="cc -x objective-c", then it seems to take the input file as objective-c and is able to handle the #import, but now I run into the following trouble:

===>  Building for gnustep-corebase-0.1
This is gnustep-make 2.6.1. Type 'gmake print-gnustep-make-help' for help.
Running in gnustep-make version 2 strict mode.
Making all in Source ...
gmake[1]: Entering directory `/home/ports/pobj/gnustep-corebase-0.1/corebase-0.1/Source'
Making all for library libgnustep-corebase...
cc -x objective-c CFCalendar.c -c \
     -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -g -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -fno-stack-protector -x objective-c -I../Headers -I. -I/usr/local/include -I/gnustep-corebase-0.1_writes_to_HOME/GNUstep/Library/Headers -I/usr/local/include \
      -o obj/libgnustep-corebase.obj/CFCalendar.c.o
cc: Warning: `-x objective-c' after last input file has no effect
In file included from CFCalendar.c:31:
../Headers/CoreFoundation/CFRuntime.h:90: warning: invalid character in macro parameter name
../Headers/CoreFoundation/CFRuntime.h:90: badly punctuated parameter list in `#define'
gmake[4]: *** [obj/libgnustep-corebase.obj/CFCalendar.c.o] Error 1
gmake[3]: *** [internal-library-all_] Error 2
gmake[2]: *** [libgnustep-corebase.all.library.variables] Error 2
gmake[1]: *** [internal-all] Error 2
gmake[1]: Leaving directory `/home/ports/pobj/gnustep-corebase-0.1/corebase-0.1/Source'
gmake: *** [internal-all] Error 2
*** Error code 2

Then I thought I can trick gcc using -D#import=#include, but I then I got malformed option `-D #import=#include' warning, and then I tried with removed # -Dimport=include, but then I get the original error message again, it seems to ignore the -D.

any ideas what I can try now to get it to compile with gcc-2.95 would be appreciated, sine I now ran about out of ideas.


Sebastian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]