Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Discuss building things with or for the Mozilla Platform.
Post Reply
Crazy-EyE
Posts: 397
Joined: February 24th, 2008, 6:27 am
Location: Moscow, Russia

Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by Crazy-EyE »

I've compiled my XPCOM component using Gecko SDK 1.8.0.4 in Linux. It works in Firefox 2 (tested in 2.0.0.12, if it matters) but doesn't load into Firefox 3 (3.0.1).

I compile my component with the following command:

Code: Select all

c++ -Wall -Os -o MyComponent.so `pkg-config --cflags --libs gtk+-2.0` -LXlib -include mozilla-config.h  -DXPCOM_GLUE  -I~/gecko-sdk/include  -L~/gecko-sdk/lib -L~/gecko-sdk/bin -Wl,-rpath-link,~/gecko-sdk/bin -lxpcomglue_s -lxpcom -lnspr4 -fno-rtti -fno-exceptions -shared    MyComponent.cpp ../../components/MyComponentModule.cpp

I tried to run

Code: Select all

~/firefox-3.0/run-mozilla.sh `which ldd` -r MyComponent.so

and got

Code: Select all

...
undefined symbol: _Z20NS_NewGenericModule2PK12nsModuleInfoPP9nsIModule  (MyComponent.so)

When I compile with -DDEBUG I get more:

Code: Select all

...
undefined symbol: NSGlue_Warning        (MyComponent.so)
undefined symbol: NSGlue_Assertion      (MyComponent.so)
undefined symbol: _ZN13nsTraceRefcnt10LogReleaseEPvjPKc (MyComponent.so)
undefined symbol: _ZN13nsTraceRefcnt9LogAddRefEPvjPKcj  (MyComponent.so)
undefined symbol: _Z20NS_NewGenericModule2PK12nsModuleInfoPP9nsIModule  (MyComponent.so)


As I understand component compiled with Gecko SDK 1.8 with frozen linkage should work in 1.8+. In Windows similar component works both in FF2 and FF3 but in Linux I can't load my component into FF3. I don't want to use Geck SDK 1.9 because (again, as I understand) it will break compatibility of my component with FF2.

Can anybody help me with this? Thank you.
Torisugari
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)
Contact:

Re: Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by Torisugari »

Can you compile it with

Code: Select all

-UMOZILLA_INTERNAL_API
?
Crazy-EyE
Posts: 397
Joined: February 24th, 2008, 6:27 am
Location: Moscow, Russia

Re: Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by Crazy-EyE »

I can compile it both with this flag and without. But results are the same: resulting dynamic library loads in Firefox 2 but doesn't load in Firefox 3.
zuo3diao
Posts: 2
Joined: July 30th, 2008, 8:10 pm

Re: Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by zuo3diao »

Eeee,I use Ubuntu8.04 linux to develop xpcom .My env is xulrunner -devel 1.9.0.1 , which include the Gecko SDK 1.9.

A simple example runs on FF3.01 very fun.,but the other xpcom has problem.

Its interface can be detected by xpcomViewer ,and the class (like CID "@XXX.com/XXX;1")isn't found .The Error Console shows "cannot load XXX.so" when use "firefox test.html".I use ff's file menu open the test.html, Error Console isn't show any message........

need some help !!
Crazy-EyE
Posts: 397
Joined: February 24th, 2008, 6:27 am
Location: Moscow, Russia

Re: Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by Crazy-EyE »

zuo3diao wrote:Its interface can be detected by xpcomViewer ,and the class (like CID "@XXX.com/XXX;1")isn't found .The Error Console shows "cannot load XXX.so" when use "firefox test.html".

It means that your xpt file (with interface) if ok but your dynamic library isn't. Possibly it had been ok too and only then became broken so it is registered in compreg.dat but Firefox can't load it. Think if you delete your compreg.dat it will not register it again.

Also Troubleshooting XPCOM components registration may be helpful for you.
Crazy-EyE
Posts: 397
Joined: February 24th, 2008, 6:27 am
Location: Moscow, Russia

Re: Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by Crazy-EyE »

I've changed order of input files (my files and libraries) and now it works well both in FF2 and FF3:

Code: Select all

c++ -Wall -Os -o MyComponent.so `pkg-config --cflags --libs gtk+-2.0` -LXlib -include mozilla-config.h  -DXPCOM_GLUE  -I~/gecko-sdk/include  -L~/gecko-sdk/lib -L~/gecko-sdk/bin -Wl,-rpath-link,~/gecko-sdk/bin -fno-rtti -fno-exceptions -shared MyComponent.cpp ../../components/MyComponentModule.cpp -lxpcomglue_s -lxpcom -lnspr4
zuo3diao
Posts: 2
Joined: July 30th, 2008, 8:10 pm

Re: Can't load component compiled with GeckoSDK1.8 in FF3(Linux)

Post by zuo3diao »

ok
I got the reason, because some so files have not linked in share object .
use "ldd -r" to check it .
Post Reply