I had good success with libojbc/clang under debian9 (stretch). I wouldn't want to go back to gcc due to non support of certain stuff I use every day (the stuff which apple introduced in what they called objc2.0). Part is working in recent gcc's though but I like clangs error reporting and better support for objc.
For clang, the debian shipped clang 3.8 was long my standard compiler. With newer versions of clang and latest libobjc2 I've run into an incompatibility with very weird side effects. I had cases where something like this: -(void)somemethod { _intProperty = 123; NSLog(@"%d", _intProperty); was printing out a value of 0 instead of 123, and of course this makes very strange things much later in your code. According to David Chisnall this is fixed in clang after r339128 and was due to how the compiler aligns structs/object properties in memory (compilers tend to optimize this in some way and all compilers used for individual parts have to use the same optimisation to come to the same order which wasn't the case if I understood correctly). this is how I build the latest clang8 from source git clone https://git.llvm.org/git/llvm.git/ cd llvm/tools git clone https://git.llvm.org/git/clang.git/ cd ../projects git clone https://git.llvm.org/git/compiler-rt.git/ git clone https://git.llvm.org/git/openmp.git/ git clone https://git.llvm.org/git/libcxx.git/ git clone https://git.llvm.org/git/libcxxabi.git/ git clone https://git.llvm.org/git/test-suite.git/ cmake .. -DCMAKE_BUILD_TYPE=Release make -j8 install This takes quite some time and lots of memory. If you forget -DCMAKE_BUILD_TYPE=Release you end up with 32 gigabytes of RAM not being sufficient (constantly swapping) and compile times of hours to days. On 32bit machines its even worse due to the 4GB memory limit. Then I install gnustep like this: Setting some defaults ------------------------------------------------ export CC=clang export CXX=clang++ export PATH=/usr/local/bin:$PATH export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ Download the sourcecode of gnustep and dependencies --------------------------------------------------- mkdir gnustep cd gnustep wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz git clone https://github.com/apple/swift-corelibs-libdispatch git clone https://github.com/gnustep/scripts git clone https://github.com/gnustep/make git clone https://github.com/gnustep/libobjc2 git clone https://github.com/gnustep/base git clone https://github.com/gnustep/corebase git clone https://github.com/gnustep/gui git clone https://github.com/gnustep/back ./scripts/install-dependencies Build dependencies --------------------------------------------------- tar -xvzf libiconv-1.15.tar.gz cd libiconv-1.15 ./configure make CFLAGS=-g make CFLAGS=-g install cd .. cd swift-corelibs-libdispatch mkdir build cd build cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-g -DCMAKE_C_FLAGS=-g make make install Install gnustep-make --------------------------------------------------- cd make export CC=/usr/bin/clang export CXX=/usr/bin/clang++ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ export OBJCFLAGS="-DEXPOSE_classname_IVARS=1" ./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 make install source /usr/local/etc/GNUstep/GNUstep.conf cd .. Install libobjc2 runtime --------------------------------------------------- cd libobjc2 mkdir Build cd Build cmake .. -DBUILD_STATIC_LIBOBJC=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-g -DCMAKE_C_FLAGS=-g make make install cd .. ldconfig install gnustep-base --------------------------------------------------- cd base ./configure CFLAGS="-DEXPOSE_classname_IVARS=1 -g " --with-config-file=/usr/local/etc/GNUstep/GNUstep.conf --disable-libdispatch make -j8 make install cd ../.. ldconfig (for debug version use "make debug=yes" instead of "make") and then the other gnustep libraries with simple ./configure; make;make install > On 22 Aug 2018, at 06:47, Riccardo Mottola <riccardo.mott...@libero.it> wrote: > > Hi, > > On 08/22/18 00:34, Scott Christley wrote: >> Honestly, I'm not sure if I need the modern runtime or not. I do use >> NSInvocation stuff quite a bit but I don't think this code base needs the >> runtime introspection stuff... > > you need he modern runtime if you need modern features like blocks. Also > properties are better supported. > The modern runtime gives you also the modern @try @catch exception handling. > > Performance wise it may be better or worse, depending on your code. If your > code "compiles" with gcc, it should also run - barren bugs. > > In theory libobjc2 supports both "gnu" and "ng" runtimes and did so for a > long time, but latest release are buggy for me, either they crash the code or > they fail to catch exceptions > >> >> I did get further and was able to compile libobjc2 completely after setting >> cc and c++ to clang. However, two tests failed so maybe that's the recent >> difficulties you were mentioning. >> >> The following tests FAILED: >> 25 - PropertyIntrospectionTest2 (OTHER_FAULT) >> 26 - PropertyIntrospectionTest2_optimised (OTHER_FAULT) > > No that's different, I hope others will help you or maybe David himself. > > Riccardo > _______________________________________________ > Discuss-gnustep mailing list > Discuss-gnustep@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnustep
_______________________________________________ Discuss-gnustep mailing list Discuss-gnustep@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnustep