discuss-gnustep
[Top][All Lists]
Advanced

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

Re: objc compiler not detected


From: Wolfgang Lux
Subject: Re: objc compiler not detected
Date: Fri, 4 Oct 2013 12:09:16 +0200

Hi Riccardo,

> Wolfgang Lux wrote:
>> Riccardo Mottola wrote:
>> 
>>> configure:13173: checking whether objc really works
>>> configure:13203: gcc -o conftest -g -O2  -I/Local/Library/Headers 
>>> -I/Local/Library/Headers -I/System/Library/Headers -I/usr/pkg/include  
>>> -fgnu-runtime -x objective-c -L/Local/Library/Libraries 
>>> -L/Local/Library/Libraries -L/System/Library/Libraries -Wl,-R/usr/pkg/lib 
>>> -L/usr/pkg/lib conftest.c -lrt  -lpthread -rdynamic -Wl,-R/usr/pkg/lib 
>>> -L/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -shared-libgcc 
>>> -pthread -fexceptions -fgnu-runtime 
>>> -L/home/multix/GNUstep/Library/Libraries -L/Local/Library/Libraries 
>>> -L/System/Library/Libraries -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lobjc -lm    
>>>  >&5
>>> In file included from ./config/config.objc.m:2:0,
>>>                 from conftest.c:97:
>>> ./config/objc-common.g:30:1: warning: cannot find interface declaration for 
>>> 'NXConstantString'
>>> configure:13207: $? = 0
>>> configure:13213: ./conftest
>>> objc runtime: cannot find class Test
>>> Abort (core dumped)
>> So this is the real problem. The compiler apparently produces an executable 
>> for the source file, but when running it it doesn't find the Test class 
>> (which is defined in config/config.objc.m). Not sure why this happens.
> I tried building the test standalone I can reproduce the error (just building 
> config.objc.m). The problem reproduces:
> 
> grid$ ./conftest
> objc runtime: cannot find class Test
> [1]   Abort trap (core dumped) ./conftest
> 
> the stacktrace doesn't reveal anything useful to my eyes:
> #0  0xbbb37c17 in _lwp_kill () from /usr/lib/libc.so.12
> #1  0xbbb37bb6 in raise () from /usr/lib/libc.so.12
> #2  0xbbb371f7 in abort () from /usr/lib/libc.so.12
> #3  0xbbbbdf93 in objc_verror () from /usr/lib/libobjc.so.3
> #4  0xbbbbdfd2 in objc_error () from /usr/lib/libobjc.so.3
> #5  0xbbbbd3a3 in objc_get_class () from /usr/lib/libobjc.so.3
> #6  0x080489a5 in main () at config.objc.m:21
> 
> Did I manage to get a broken runtime? I hope not. I wonder what could be 
> going bad here.
> 
> I reduced the compile line to:
> gcc -o conftest -g -O2  -fgnu-runtime -x objective-c  config.objc.m -lrt  
> -lpthread -rdynamic -shared-libgcc -pthread -fexceptions -fgnu-runtime  
> -lobjc -lm
> 
> since we do not need all the headers and libraries anyway (and the compiler 
> is much faster! wow!). However, same error :(

Of course it works for me on NetBSD 6.2.1 (the latest release, which was 
released just a few days ago). The compiler is gcc 4.5.3. You might check that 
the class definition is generated in the executable. The output for
  nm conftest | grep Test
on my NetBSD system is
08049420 d _OBJC_CLASS_METHODS_Test
080494a0 d _OBJC_CLASS_Test
08049340 d _OBJC_CLASS_VARIABLES_Test
08049460 d _OBJC_METACLASS_Test
08048a38 R __objc_class_name_Test
08049878 d __objc_class_ref_Test
0804892e t _c_Test__initialize
08048933 t _c_Test__testResult
If those definitions are present (possibly with different addresses) you might 
check that __objc_exec_class is called in the executable, which should register 
the Test class in the runtime system. Unfortunately, there is no easy way to 
inspect the argument of this function without building a debugging version of 
the Objective-C runtime library.

Wolfgang




reply via email to

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