discuss-gnustep
[Top][All Lists]
Advanced

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

ARC and dispatch_release(queue) abends


From: allynm
Subject: ARC and dispatch_release(queue) abends
Date: Thu, 11 Jun 2015 10:41:32 -0700 (MST)

Hello,

I'm testing a new installation of libobjc2-1.7 on a 32bit Ubuntu 14.04
installation and using a GNUmakefile.  The program I'm using was written by
Tobias Lensing some time ago.  The program looks like this:


> #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);  
>      }
>    
>     @autoreleasepool{
>         [NSApplication sharedApplication];
>         NSRunAlertPanel(@"Test", @"Wow it works!", @"OK", nil, nil);
>     
>       }          
>     return 0;
> }

The GNUmakefile is this:


> GNUSTEP_MAKEFILES = /usr/local/share/GNUstep/Makefiles
> 
> APP_NAME = lensingmain
> include $(GNUSTEP_MAKEFILES)/common.make
> ADDITIONAL_INCLUDE_DIRS=-I/home/mark/GNUstep/Library/Headers
> -I/usr/GNUstep/Local/Library/Headers 
> -I/usr/GNUstep/System/Library/Headers
> ADDITIONAL_OBJCFLAGS= -fobjc-arc -fblocks -fobjc-nonfragile-abi
> -fobjc-runtime=gnustep-1.7
> ADDITIONAL_LIB_DIRS =-L/usr/local/lib -L/usr/lib
> -L/usr/GNUstep/Local/Library/Libraries
> ADDITIONAL_LDFLAGS = -lgnustep-gui -ldispatch -lgnustep-base 
> lensingmain_OBJC_FILES = lensingmain.m
> 
> -include GNUmakefile.preamble
> include $(GNUSTEP_MAKEFILES)/application.make
> -include GNUmakefile.postamble

The program builds with warnings as follows:

> Making all for app lensingmain...
>  Creating lensingmain.app/....
>  Compiling file lensingmain.m ...
> clang-3.7: warning: argument unused during compilation:
> '-fobjc-nonfragile-abi'
> clang-3.7: warning: argument unused during compilation:
> '-fobjc-nonfragile-abi'
>  Linking app lensingmain ...
> /usr/bin/ld: warning: libobjc.so.4.6, needed by
> /usr/GNUstep/Local/Library/Libraries/libgnustep-gui.so, may conflict with
> libobjc.so.4
> /usr/bin/ld: warning: libdispatch.so.0, needed by
> /usr/local/lib/libgnustep-base.so, may conflict with libdispatch.so.1
>  Creating lensingmain.app/Resources...
>  Creating stamp file...
>  Creating lensingmain.app/Resources/Info-gnustep.plist...
>  Creating lensingmain.app/Resources/lensingmain.desktop...

I don't understand why -fobjc-nonfragile-abi isn't used.
I don't understand why the warnings about .so conflicts are issued.

When I run the program, here's what I get:

> Module /home/mark/libobjc2//home/mark/libobjc2/Protocol2.m version 9
> doesn't match runtime 8
> Aborted (core dumped)

>From the research I have done it appears that dispatch_release is
incompatible with ARC, which is why it is commented out in the source code. 
I also was under the impression that -fobjc-nonfragile-abi was required for
compilation.  There has been a confusing dialogue over several years on how
to do ARC and dispatch queues.  Perhaps someone could shed light on this?

Also what's going on with the .so conflicts?

Lastly, if someone could clean up my GNUmakefile, I'd appreciate it.  It's
no doubt redundant and probably buggy.

Thanks,
Mark Allyn



--
View this message in context: 
http://gnustep.8.n7.nabble.com/ARC-and-dispatch-release-queue-abends-tp39364.html
Sent from the GNUstep - General mailing list archive at Nabble.com.



reply via email to

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