discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Trying to use GNUstep and libdispatch in an ARC based objective-C pr


From: Mathias Bauer
Subject: Re: Trying to use GNUstep and libdispatch in an ARC based objective-C program
Date: Wed, 08 Jan 2014 10:54:40 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Hi Quentin,

thanks a lot for your answer.

I will give that a try.

Regards,
Mathias

Am 08.01.14 10:32, schrieb Quentin Mathé:
Hi Mathias,

Le 8 janv. 2014 à 00:11, Mathias Bauer a écrit :

Hi,

I've set up a build environment with the lastest trunk versions of GNUstep, 
clang and libobjc2 on Ubuntu 12.04.

In my program (compiled with ARC) I tried to dispatch a block with

   dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 
0), ^ ...


This crashes immediately when the dispatch_get_global_queue call returns. The stack shows 
that the compiler executes a "retain" call on the returned object, but 
libdispatch does not seem to be compiled with objc support at all, so I assume that the 
returned object just is a c struct.

It seems libdispatch ObjC integration is not compatible with libobjc2 as it is. 
When compiling code that uses libdispatch, I  pass -DOS_OBJECT_USE_OBJC=0 to 
the CPPFLAGS, in order to disable the libdispatch ObjC integration.

See http://stackoverflow.com/questions/8618632/does-arc-support-dispatch-queues

I used

./configure --enable-debug-by-default --enable-objc-nonfragile-abi 
--with-layout=gnustep

for the GNUstep make build and

./configure --disable-mixedabi

for building GNUstep base.

For libdispatch I used the configure provided by the repository at

https://github.com/nickhutchinson/libdispatch.git

I assume that the culprit is in the libdispatch build. I manually patched the 
generated config.h file to support OBJC, but this obviously isn't enough.

Based on my experience, this repository requires various changes to compile and 
work correctly on GNUstep. Some GNUstep people have submitted changes but they 
haven't been accepted yet.

I maintain a fork of this repository patched with GNUstep+libobjc2 support 
here: http://svn.gna.org/viewcvs/etoile/trunk/Dependencies/libdispatch-objc2/

The changes I did are listed in this patch: 
http://svn.gna.org/viewcvs/etoile?view=revision&revision=9796
The main change is rewriting FindCBlocks.cmake to pick either libBlocksRuntime 
or libobjc2, depending on what is available on the host system.

For the install instructions, see: 
http://svn.gna.org/viewcvs/*checkout*/etoile/trunk/Dependencies/libdispatch-objc2/INSTALL

Another major problem that remains unsovled lies the fact that GNUstep Base 
doesn't attempt to detect libdispatch, and compile NSOperation and 
NSOperationQueue with libdispatch support enabled. As a result, you have to 
stick to the libdispatch C API.

Cheers,
Quentin.




reply via email to

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