MAC OSX 10.6 - Static linking issue

View: New views
4 Messages — Rating Filter:   Alert me  

MAC OSX 10.6 - Static linking issue

by Anthony Catel-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Im linking spidermonkey (1.8.1) as static library against a dynamic
library :

gcc -std=c99 -D_GNU_SOURC -Wall -g -bundle -undefined suppress
-flat_namespace -o lib/libmod_spidermonkey.so libape-spidermonkey.c
-I../libs/js1.8/src/dist/include/ -L../libs/js1.8/src/ -ljs_static
-Xlinker -rpath

But when Im trying to load the generated library (with a dlopen), I get
this :

dyld: lazy symbol binding failed: Symbol not found: __Znwm
  Referenced from:
/Users/para/dev/ape_1.0/APE_Server/modules/lib/libmod_spidermonkey.so
  Expected in: flat namespace


I don't have any problem if I link libmozjs as shared library.

Any idea ? :)

Thanks

Anthony Catel
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Parent Message unknown Re: MAC OSX 10.6 - Static linking issue

by Benjamin Smedberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/10/09 10:16 PM, Anthony Catel wrote:

> Hi,
>
> Im linking spidermonkey (1.8.1) as static library against a dynamic
> library :
>
> gcc -std=c99 -D_GNU_SOURC -Wall -g -bundle -undefined suppress
> -flat_namespace -o lib/libmod_spidermonkey.so libape-spidermonkey.c
> -I../libs/js1.8/src/dist/include/ -L../libs/js1.8/src/ -ljs_static
> -Xlinker -rpath
>
> But when Im trying to load the generated library (with a dlopen), I get
> this :
>
> dyld: lazy symbol binding failed: Symbol not found: __Znwm
>  Referenced from:
> /Users/para/dev/ape_1.0/APE_Server/modules/lib/libmod_spidermonkey.so
>  Expected in: flat namespace

__Znwm is `operator new(unsigned long)`. I'm not sure what spidermonkey
1.8.1 is, but newer versions of Spidermonkey that are built from the mozilla
1.9.1+ codebase are written in C++. This means you need to link them using
the C++ frontend or perhaps explicitly link against -lstdc++

--BDS
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Re: MAC OSX 10.6 - Static linking issue

by Anthony Catel-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks it works now :) (-lstdc++ was the answer)

Anthony Catel

Benjamin Smedberg a écrit :

> On 10/10/09 10:16 PM, Anthony Catel wrote:
>  
>> Hi,
>>
>> Im linking spidermonkey (1.8.1) as static library against a dynamic
>> library :
>>
>> gcc -std=c99 -D_GNU_SOURC -Wall -g -bundle -undefined suppress
>> -flat_namespace -o lib/libmod_spidermonkey.so libape-spidermonkey.c
>> -I../libs/js1.8/src/dist/include/ -L../libs/js1.8/src/ -ljs_static
>> -Xlinker -rpath
>>
>> But when Im trying to load the generated library (with a dlopen), I get
>> this :
>>
>> dyld: lazy symbol binding failed: Symbol not found: __Znwm
>>  Referenced from:
>> /Users/para/dev/ape_1.0/APE_Server/modules/lib/libmod_spidermonkey.so
>>  Expected in: flat namespace
>>    
>
> __Znwm is `operator new(unsigned long)`. I'm not sure what spidermonkey
> 1.8.1 is, but newer versions of Spidermonkey that are built from the mozilla
> 1.9.1+ codebase are written in C++. This means you need to link them using
> the C++ frontend or perhaps explicitly link against -lstdc++
>
> --BDS
> _______________________________________________
> dev-tech-js-engine mailing list
> dev-tech-js-engine@...
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>  

_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Re: MAC OSX 10.6 - Static linking issue

by Wes Garland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I'm not sure what spidermonkey 1.8.1 is,

SpiderMonkey 1.8.1 (as referenced colloquially and in the MDC wiki) is
Tracemonkey  -- jsapi with JS 1.8, tracing JIT and autoconf build system --
not necessarily from the tracemonkey branch.

There is no release out of moz, but embedders are regularly pulling from the
tracemonkey and m-c branches; Ubuntu is shipping libmozjs.so against Firefox
releases, dunno what others are doing.

Wes

--
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine