Hi all,
I'm trying to build gnustep base with clang-7 on debian 9 and I constantly run into incompatibilities from the runtime or tests failing and I can't figure out the dependency issues here.
clang-7 comes from the clang repository
My gnustep make is configured like this:
export CC=/usr/bin/clang-7
export CXX=/usr/bin/clang++-7
export LD=/usr/bin/lld-7
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
export RUNTIME_VERSION=gnustep-1.9
export OBJCFLAGS="-fblocks"
export CFLAGS="-L/usr/local/lib"
./configure \
--with-layout=fhs \
--disable-importing-config-file \
--enable-native-objc-exceptions \
--enable-objc-arc \
--enable-install-ld-so-conf \
--with-library-combo=ng-gnu-gnu \
--with-config-file=/usr/local/etc/GNUstep/GNUstep.conf \
--with-user-config-file='.GNUstep.conf' \
--with-user-defaults-dir='GNUstep/Library/Defaults' \
--with-objc-lib-flag="-l:libobjc.so.4.6" \
my libobjc2 is compiled like this:
cmake .. -DCMAKE_C_COMPILER=/usr/bin/clang-7 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-7 -DCMAKE_LINKER=/usr/bin/lld-7 -DCMAKE_BUILD_TYPE=RelWithDebInfo
and then when I compile gnustep-base
export RUNTIME_VERSION=gnustep-1.9
export OBJCFLAGS="-fblocks"
export CFLAGS="-L/usr/local/lib"
./configure \
--with-layout=fhs \
--disable-importing-config-file \
--enable-native-objc-exceptions \
--enable-objc-arc \
--enable-install-ld-so-conf \
--with-library-combo=ng-gnu-gnu \
--with-config-file=/usr/local/etc/GNUstep/GNUstep.conf \
--with-user-config-file='.GNUstep.conf' \
--with-user-defaults-dir='GNUstep/Library/Defaults' \
--with-objc-lib-flag="-l:libobjc.so.4.6" \
I get this:
configure: error: Your compiler does not appear to implement the -fconstant-string-class option needed for support of strings. Please check for a more recent version or consider using --enable-nxconstantstring
well clang-7 definitively does know -fconstant-string so this test is going nuts somehow.
I looked at the test config/config.constant-string-class.m
and I figured out it segfaults:
# clang-7 -O0 -g config/config.constant-string-class.m -l:libobjc.so.4.6
In file included from config/config.constant-string-class.m:19:
config/objc-common.g:54:3: warning: assignment to Objective-C's isa is deprecated in favor of object_setClass() [-Wdeprecated-objc-isa-usage]
obj->isa = self;
^ ~~~~~~~
object_setClass( , )
config/objc-common.g:47:5: note: instance variable is declared here
id isa;
^
config/objc-common.g:45:31: warning: class 'NSObject' defined without specifying a base class [-Wobjc-root-class]
GS_OBJC_ROOT_CLASS @interface NSObject
^
config/objc-common.g:45:39: note: add a super class to fix this problem
GS_OBJC_ROOT_CLASS @interface NSObject
^
: NSObject
config/config.constant-string-class.m:23:31: warning: class 'FooConstantString' defined without specifying a base class [-Wobjc-root-class]
GS_OBJC_ROOT_CLASS @interface FooConstantString
^
config/config.constant-string-class.m:23:48: note: add a super class to fix this problem
GS_OBJC_ROOT_CLASS @interface FooConstantString
^
: NSObject
config/config.constant-string-class.m:49:23: warning: incompatible pointer types initializing 'FooConstantString *' with an _expression_ of type 'NSString *'
[-Wincompatible-pointer-types]
FooConstantString *string = @"Antonio Valente";
^ ~~~~~~~~~~~~~~~~~~
4 warnings generated.
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) run
Process 15116 launched: '/Users/afink/development/gnustep/base/a.out' (x86_64)
Process 15116 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00007ffff7bcaae8 libobjc.so.4`___lldb_unnamed_symbol45$$libobjc.so.4 + 72
libobjc.so.4`___lldb_unnamed_symbol45$$libobjc.so.4:
-> 0x7ffff7bcaae8 <+72>: movq (%r12), %rax
0x7ffff7bcaaec <+76>: movl %eax, %ecx
0x7ffff7bcaaee <+78>: movq %rax, %rdx
0x7ffff7bcaaf1 <+81>: shll $0x5, %ecx
(lldb)
if I patch out the constant string test in
configure.ac and rebuild it, then most gnustep-base test cases fail.
So I'm kind of lost on where the heck this comes from. I noticed in the past that my classes get referred to the wrong runtime version and thus access to members of superclasses returned wrong values which apparently depends on runtime version which is the reason why I want to recompile everything with a specific runtime version so we have 100% sure everything uses the same ABI. I only run my own code so I dont' need backwards compatibility.
Does anyone have a clue on how to fix this?
_______________________________________________