[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting Objective-C 2.0 working
From: |
Laurent Michel |
Subject: |
Re: Getting Objective-C 2.0 working |
Date: |
Fri, 18 May 2012 07:01:32 -0400 |
Thanks Eric. That helps a lot! I got caught by the libobjc2 naming in Ubuntu.
(there is even a libobjc3 package under Ubuntu). I'll give it a try this
morning from source.
Thanks for the pointer!
Sent from my iPad
On May 17, 2012, at 11:09 PM, Eric Wasylishen <address@hidden> wrote:
> Hi Laurent,
>
> To use blocks in GNUstep you need to use the GNUstep Objective-C runtime,
> a.k.a. libobjc2, whose releases are available here:
> http://download.gna.org/gnustep/
>
> Unfortunately, I don't think this library is available in debian/ubuntu
> (though I could be wrong!). Confusingly, the package called "libobjc2" in
> debian/ubuntu is unrelated to the GNUstep Objective-C runtime and doesn't
> support blocks.
>
> So, as far as I know, what you'll need to do is remove the Ubuntu packages
> for gnustep you installed, then install libobjc2 and GNUstep again from the
> source packages. (Latest gnustep releases are at:
> http://wwwmain.gnustep.org/resources/downloads.php)
>
>
> The Etoile ObjectiveC2 framework no longer exists and isn't something you
> need to worry about. IIRC, the initial support in GNUstep for the modern
> Objective-C runtime api's was started in that framework in Etoile, but that
> code has since been merged into GNUstep and libobjc2.
>
> Hope this helps,
>
> Eric
>
> On 2012-05-17, at 9:27 PM, Laurent Michel wrote:
>
>> Dear All,
>>
>> I develop on MaOS and would love to port my code to Linux. Essentially, I
>> use Objective-C 2.0 with clang as a compiler.
>> I created an Ubuntu 12.04 VM under VMWare and installed GNUStep through that
>> channel. I compiled a silly hello world and that worked fine.
>> My problems started when I tried to compile my own code which makes *heavy*
>> use of Objective-C blocks. I always end-up seeing this message:
>>
>> clang -I/usr/GNUstep/System/Library/Headers -fblocks -fobjc-nonfragile-abi
>> -c CPFactory.m
>> In file included from CPFactory.m:27:
>> In file included from ./CPFactory.h:27:
>> In file included from
>> /usr/GNUstep/System/Library/Headers/Foundation/Foundation.h:30:
>> /usr/GNUstep/System/Library/Headers/GNUstepBase/GSVersionMacros.h:287:14:
>> fatal error: 'objc/blocks_runtime.h' file not found
>>
>>
>> namely, it cannot find objc/blocks_runtime.h
>>
>> I started googling around and I found lots of conflicting information on the
>> topic as well as reference to Etoile, and ObjectiveC2 (a framework) but it
>> seems largely incompatible with GNUStep. I'll looking for some directions to
>> get going with a simple code that uses blocks. For instance, a silly test
>> like:
>>
>> #import <Foundation/NSObject.h>
>>
>> int foo(int (^b)(int)) {
>> return b(5);
>> }
>>
>> int main() {
>>
>> int y = 10;
>> int z = foo(^(int x) {
>> return y + x;
>> });
>> NSLog(@"result is %d\n",z);
>> }
>>
>>
>> Should compile and run when linked against the Foundation framework.
>>
>> Any pointer is greatly appreciated.
>>
>> --
>> Laurent
>>
>>
>>
>>
>> _______________________________________________
>> Gnustep-dev mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/gnustep-dev
>