Thank you for the suggestions, Niels. I will give them a try. Good idea to post on the Wiki-- I've now done so:
(The page is not yet linked from anywhere on the site.) I look forward to any improvements you or others may contribute.
Best, Patryk Hi Patryk,Am 11.08.2012 18:52, schrieb Patryk Laurent:Below are some step-by-step instructions on installing libobjc2 and libdispatch on Ubuntu 12.04 server.
Many thanks for the write-up. I didn't try it out, put from looking overit, it does seem like it should work ;-). I have two remarks, though:# --------------------------------------------------------------------
# 1) Install GNUstep Make a first time.
# --------------------------------------------------------------------
I do seem to recall that this shouldn't be necessary anymore. If youbuild libobjc2 using `make -f Makefile', it should build fine and youcan skip right to step 3.# --------------------------------------------------------------------
# Testing
# --------------------------------------------------------------------
# Plain C: When not compiling with libobjc2 (just plain C) on Ubuntu you must add -lBlocksRuntime
# --------------------------------------------------------------------
clang -o hi helloGCD.c -fblocks -ldispatch -lBlocksRuntime
./hi
clang -o hi helloGCD.c -fblocks -ldispatch
# /usr/bin/ld: /tmp/helloGCD-eXxFYY.o: undefined reference to symbol '_NSConcreteGlobalBlock'
# /usr/bin/ld: note: '_NSConcreteGlobalBlock' is defined in DSO /usr/lib/libBlocksRuntime.so.0
# so try adding it to the linker command line
# /usr/lib/libBlocksRuntime.so.0: could not read symbols: Invalid operation
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
# --------------------------------------------------------------------
# Compiling Objective C with ARC and blocks and libdispatch
# --------------------------------------------------------------------
# Note: do not use -lBlocksRuntime here since Apple on is not
# compatible with the libobjc2 one which has its own. (Note from
# David Chisnall)
# --------------------------------------------------------------------
clang `gnustep-config --objc-flags` `gnustep-config --objc-libs` -fobj-arc -fobjc-nonfragile-abi -fblocks helloGCD_objc.m Fraction.m -o test -lobjc -lgnustep-base -ldispatch
./test
The way you're building libdispatch is a bit rotten, since -- as youmention in passing -- you can either link it with libBlocksRuntime orwith libobjc2 but not both at the same time. This will cause you troubleif you're trying to link a C library that uses libdispatch (andlibBlocksRuntime) with Objective-C code using libobjc2. There are twopossible workarounds for this problem. You can a) apply my patch from[0] to libdispatch in order for it to use libobjc2 as its native blocksruntime (and never even bother to install libBlocksRuntime), or you canuse Mark Heily's branch of libBlocksRuntime [1] that turns all theexported symbols into weak symbols so that libobjc2 can override them(he somewhat promised that this would be merged into trunk, but itdoesn't seem that he got around to doing that yet).But anyways: Is there any chance that you could put your howto up on thewiki, so that is accessible for collaborative editing?Cheers,Niels[0]http://www.halbordnung.de/~niels.grewe/gnustep/libdispatch-libobjc2.patch[1] svn://mark.heily.com/libBlocksRuntime/branches/objc2_______________________________________________Discuss-gnustep mailing listDiscuss-gnustep@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnustep
|