Hi Riccardo,
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.