Question

Basically, I followed the instructions here: http://wiki.gnustep.org/index.php/GNUstep_under_Ubuntu_Linux

With the extra step of building the gui and back.

If I build and run a non-gui program, all works well. Only when I add something that uses the gui, like the following:

//  Created by Tobias Lensing on 2/22/13.
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <dispatch/dispatch.h>

int main(int argc, const char * argv[])
{    
    @autoreleasepool {
        int multiplier = 7;
        int (^myBlock)(int) = ^(int num) {
            return num * multiplier;
        };

        NSLog(@"%d", myBlock(3));

        dispatch_queue_t queue = dispatch_queue_create(NULL, NULL); 

        dispatch_sync(queue, ^{
            printf("Hello, world from a dispatch queue!\n");
        });

//            dispatch_release(queue);       // ARC takes care of this 
    }

    @autoreleasepool {
        [NSApplication sharedApplication];
        NSRunAlertPanel(@"Test", @"Wow it works!", @"OK", nil, nil);
    }

    return 0;
}

I compile this with the following:

clang `gnustep-config --objc-flags` `gnustep-config --objc-libs` -fobjc-arc -fobjc-runtime=gnustep -fblocks -lobjc -ldispatch -lgnustep-gui test.m

It compiles and links with no errors.

When I run it, however, it spits out the following ugly-gram:

Hello, world from a dispatch queue!
Objective-C ABI Error: Loading modules from incompatible ABI's while loading .GSBackend.m
a.out: /home/lloyd/projects/ThirdParty/BuildGnuStep/libobjc2/loader.c:53: void __objc_exec_class(struct objc_module_abi_8 *): Assertion `objc_check_abi_verion(module)' failed.
Aborted (core dumped)

I have assured myself that there is no other version of libobjc (this is on a virtual machine so I can go back redo my steps).

Commenting out the following:

// [NSApplication sharedApplication];
// NSRunAlertPanel(@"Test", @"Wow it works!", @"OK", nil, nil);

and everything compiles and runs, aside from the GUI obviously.

How can I have two ABI's when I build everything from scratch? Do I need to configure the GUI differently? I've been puzzling over this for a couple of weeks.

Was it helpful?

Solution 2

Okay, after much messing around I discovered that, surprise, I was building everything wrong.

I would go into the long, deep, painful process, but this website actually has a nice set up, scripts, and everything.

Sadly I didn't find this website before asking my question. Now I have Objective C, ARC, blocks and GNUstep!

OTHER TIPS

Sorry, too long for a comment:

Well I am not sure of you exact problem but you have 3 ABI'a to consider rather than just the normal 2 (gnustep, fragile, not-fragile)... I am not an absolute expert on the area, but I believe you can run gnustep against the newer apple non-fragile ABI... so it is possible that isn't the ABI you have, but it is the one that gets selected with: gnustep-config --objc-libs, you could try omitting that...

I always used gnustep-make, but I haven't done much gnustep for a long time, and don't know if that is still preferred.

I did find an interesting thread: http://comments.gmane.org/gmane.comp.lib.gnustep.general/38698

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top