gnustep-dev
[Top][All Lists]
Advanced

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

Re: Question


From: Laurent Michel
Subject: Re: Question
Date: Wed, 6 Mar 2013 08:24:43 -0500

On Mar 6, 2013, at 8:08 AM, David Chisnall <address@hidden> wrote:

> On 6 Mar 2013, at 13:03, Laurent Michel <address@hidden> wrote:
> 
>> No I didn't. I'm not familiar with cmake. As I said, I must be missing 
>> something in how to properly setup. 
> 
> My instructions had 'mkdir build' and 'cd build' for a reason...

I did do that, but the last printout stated that the makefile was created in 
the parent directory. And when I tried a simple "make" in build
it failed. So I went back the the parent directory and did run make from there 
(which compiled but refused to install) That's when I tried
the "old" command make -f Makefile install. 


-- No C++ runtime library found
-- GNUstep install type set to LOCAL
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/gnustep-libobjc2
address@hidden:/usr/local/src/gnustep-libobjc2/Build# cd ..

That last line of the build is what prompted me to go back up. 


> 
>> With 
>> 
>> make -f Makefile install
>> 
>> it worked (meaning it installed libobjc2 in /usr/local/lib)
> 
> Yes, when you ran cmake in the project root, it overwrote the existing 
> Makefile, but not the GNUmakefile.  If you used GNU make, then it used the 
> GNUmakefile in preference to the GNUmakefile.  This delegated to the Makefile 
> for building, but not for installation.  
> 
>> and I managed to execute my program which now goes much further (still not 
>> running correctly, but now it is probably something related to my build... 
>> It claims that a method is not implemented even though it
>> does work fine on MacOS). 
>> 
>> ./queens2: Uncaught exception NSInvalidArgumentException, reason: 
>> ORModelI(instance) does not recognize addConstraint:
>> 
>> The addConstraint: does exist. Now a matter for me to figure out why it 
>> won't find it.
> 
> Do you have a debug build of the runtime?  If so, do you have any error 
> messages before this?  In your back trace, it it being called from a +load 
> method?


I'll make a debug build (now that I seem to better understand how to build! ;-) 
Thanks a bunch!).\

I went in gdb and checked. The error is raised from a call in my own code. The 
receiver has the proper type and the method does exist.
The way the code is organized mimics the frameworks I have on MacOS (5 of 
them). 

Here is the backtrace. 

#18 0xb7d02f8d in -[NSObject doesNotRecognizeSelector:] (self=0x80f98e4, 
_cmd=0xb7f71ea8, aSelector=<optimized out>) at NSObject.m:1739
#19 0xb7d03051 in -[NSObject forwardInvocation:] (self=<optimized out>, 
_cmd=0xb7f9c818, anInvocation=0x80f98e4) at NSObject.m:1753
#20 0xb7db6af7 in GSFFIInvocationCallback (cif=<optimized out>, retp=<optimized 
out>, args=<optimized out>, user=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at GSFFIInvocation.m:629
#21 0xb6f85176 in ?? () from /usr/lib/i386-linux-gnu/libffi.so.6
#22 0xb6f85416 in ?? () from /usr/lib/i386-linux-gnu/libffi.so.6
#23 0xb77720a3 in +[ORFactory intVar:var:shift:] (self=0xb77f6d50, 
_cmd=0x8053a18, tracker=0x80f98e4, x=0x8178064, b=1) at ORFactory.m:214
#24 0x0804994f in __main_block_invoke (.block_descriptor=0xbffff198, i=1) at 
main.m:29
#25 0xb77730c1 in +[ORFactory intVarArray:range:with:] (self=0xb77f6d50, 
_cmd=0x8053a30, tracker=0x80f98e4, range=0x8160464, clo=0xbffff198)
    at ORFactory.m:284
#26 0x08048fea in main (argc=1, argv=0xbffff294) at main.m:29


ORFactory is a factory class living in a shared lib ORFoundation
The method invoked on ORModelI (a class living in a shared lib ORModeling) is 
indeed there and compiled just fine, but he's not
finding it. 

Here is the method in question:


-(void) addConstraint: (id<ORConstraint>) cstr
{
   [_target trackConstraint:cstr];
   [_target add: cstr];
}

So the argument is just an "id" adopting a specific protocol.

The call site:

           if (b==0)
211           return x;
212        else {
213           id<ORIntVar> nv = [ORFactory intVar:tracker 
domain:RANGE(tracker,[x min] + b,[x max] + b)];
214           [tracker addConstraint:[ORFactory equal:tracker var:nv to:x 
plus:b annotation:DomainConsistency]];
215           return nv;
216        }


where "tracker" is an ORModelI instance

(gdb) po [tracker class]
ORModelI
(gdb) 

So far, it all looks fine. I'll decompose line 214 to check the argument being 
passed it (it should be a constraint (id<ORConstraint>)).

Right now, I'm thinking that the issue may be related to the fact that caller 
and callee sit in different shared libraries and this is
somehow causing an issue. Are there any special provisions I should be aware of 
when creating shared libraries on Linux that contain
objective-C code when I will have inheritance and categories spanning shared 
lib boundaries?



> 
>> Also I'm getting lots of messages about autorelease being called without a 
>> pool in place, but that might be on my end (even though i'm pretty sure an 
>> autorelease pool is created right from the start with:
>> 
>> int main(int argc,char* argv[]) 
>> {
>> @autoreleasepool {
>>      ...
>> }
>> }
>> 
>> Maybe there is an issue with this syntax with this version of the runtime?
> 
> This should be fine, however you will need to explicitly create autorelease 
> pools if you have other threads.

Yes, agreed. I'm in the main thread, but this test is missing an autorelease 
pool line --just checked--, so this one is on me ;-)

Thanks David. I appreciate your help with this!

All the best,

--
  Laurent

> 
> David
> 




reply via email to

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