开发者

Firefox not loading XPCOM Component under Fedora

I am trying to build simple XPCOM component for Firefox 3.6.13 under LINUX operating system. I successfully compiled the component using Xulrunner SDK 1.9.2.13. I kept it under components directory. But when I start my firefox firefox console shows error

'Failed to load XPCOM component: /home/mypc/.mozilla/firefox/cxsm79p6.default/extensions/{1280606b-2510-4fe0-97ef-9b5a22eafe80}/components/MyComponent.so

By referring to this link https://developer.mozilla.org/en/Troubleshooting_XPCOM_components_registration, I followed instructions under title 'Linux-specific hints'. It says to use special linking time option -Wl,-z,defs while linking. So I adde开发者_StackOverflow中文版d these options but now while compiling its showing error as

make: Warning: File `Makefile' has modification time 0.25 s in the future

c++ -Os -Wall -o MyComponent.so -include xpcom-config.h -DXPCOM_GLUE_USE_NSPR -I /mnt/hgfs/C/Users/sunil/SDKS/LINUX/xulrunner-sdk/include -I./ -L /mnt/hgfs/C/Users/sunil/SDKS/LINUX/xulrunner-sdk/lib -lxpcomglue_s -lxpcom -lnspr4 -fno-rtti -fno-exceptions -shared -Wl,-z,defs MyComponent.cpp MyComponentModule.cpp /tmp/ccMGUTql.o: In function MyComponent::QueryInterface(nsID const&, void**)': MyComponent.cpp:(.text+0x9b): undefined reference to NS_TableDrivenQI(void*, QITableEntry const*, nsID const&, void**)' /tmp/ccbkZLTz.o: In function NSGetModule': MyComponentModule.cpp:(.text+0x15): undefined reference to NS_NewGenericModule2(nsModuleInfo const*, nsIModule*)' collect2: ld returned 1 exit status make: ** [build] Error 1

My New makefile is as follows

CXX   = c++
CPPFLAGS +=     -fno-rtti              \
                -fno-exceptions        \
                -shared                 \
                -Wl,-z,defs

# Change this to point at your Gecko SDK directory. 
GECKO_SDK_PATH =/mnt/hgfs/C/Users/sunil/SDKS/LINUX/xulrunner-sdk

# GCC only define which allows us to not have to #include mozilla-config 
# in every .cpp file.  If your not using GCC remove this line and add 
# #include "mozilla-config.h" to each of your .cpp files. 
GECKO_CONFIG_INCLUDE = -include xpcom-config.h

GECKO_DEFINES  = -DXPCOM_GLUE_USE_NSPR

GECKO_INCLUDES = -I $(GECKO_SDK_PATH)/include

GECKO_LDFLAGS =  -L $(GECKO_SDK_PATH)/lib -lxpcomglue_s -lxpcom \
                -lnspr4

FILES = MyComponent.cpp MyComponentModule.cpp

TARGET = MyComponent.so

build: 
        $(CXX) -Os -Wall  -o $(TARGET) $(GECKO_CONFIG_INCLUDE) $(GECKO_DEFINES) $(GECKO_INCLUDES) -I./ $(GECKO_LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(FILES)
        chmod +x $(TARGET)
        strip $(TARGET)

clean: 
        rm $(TARGET)

Can somebody help me get around this ?


I think you get this error if your libraries aren't specified correctly. One of these lines might fix it:

GECKO_LDFLAGS = -L$(GECKO_SDK_PATH)/lib -L$(GECKO_SDK_PATH)/bin -Wl,-rpath-link,$(GECKO_SDK_PATH)/bin -lxpcomglue_s -lxpcom -lnspr4

or

$(CXX) -Os -Wall  -o $(TARGET) $(GECKO_CONFIG_INCLUDE) $(GECKO_DEFINES) $(GECKO_INCLUDES) -I./ $(CPPFLAGS) $(CXXFLAGS) $(FILES) $(GECKO_LDFLAGS)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜