Hello, I have wrote a pretty simple code and try to build it as SO, but it always failed.
1) Write a cpp code call function imgLoader::Singleton which is defined in xul (imgLoader.cpp). 2) Write a moz.build file with following key contents. XPCOMBinaryComponent('testSO') USE_LIBS += [ 'mozalloc', 'xul', ] 3) Compile it in firefox. I got following error: 17:23.11 Executing: c++ -Wall -Wempty-body -Woverloaded-virtual -Wsign-compare -Wwrite-strings -Wno-invalid-offsetof -Wcast-align -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -pipe -DNDEBUG -DTRIMMED -g -freorder-blocks -Os -fomit-frame-pointer -fPIC -shared -Wl,-z,defs -Wl,-h,libtestConfig.so -o libtestConfig.so /home/samuelyang/build_ff/firefox_dev/obj-x86_64-unknown-linux-gnu/zlh_first_com/tmp2MgbrM.list -lpthread -Wl,-z,noexecstack -Wl,-z,text -Wl,--build-id -Wl,-rpath-link,/home/samuelyang/build_ff/firefox_dev/obj-x86_64-unknown-linux-gnu/dist/bin -Wl,-rpath-link,/usr/local/lib ../xpcom/glue/libxpcomglue_s.a ../memory/mozalloc/libmozalloc.so ../nsprpub/lib/ds/libplds4.so ../nsprpub/lib/libc/src/libplc4.so ../nsprpub/pr/src/libnspr4.so ../toolkit/library/libxul.so -Wl,--version-script -Wl,/home/samuelyang/build_ff/firefox_dev/build/unix/gnu-ld-scripts/components-version-script -Wl,-Bsymbolic -ldl 17:23.11 /home/samuelyang/build_ff/firefox_dev/obj-x86_64-unknown-linux-gnu/zlh_first_com/tmp2MgbrM.list: 17:23.11 INPUT("Unified_cpp_zlh_first_com0.o") 17:23.11 INPUT("../memory/fallible/fallible.o") 17:23.11 17:23.11 Unified_cpp_zlh_first_com0.o: In function `testConfig::testConfig()': 17:23.11 /home/samuelyang/build_ff/firefox_dev/zlh_first_com/testConfig.cpp:17: undefined reference to `curl_easy_init' 17:23.11 /home/samuelyang/build_ff/firefox_dev/zlh_first_com/testConfig.cpp:22: undefined reference to `imgLoader::Singleton()' What I tried but still couldn't make it success. 1.) Comment AC_SUBST(VISIBILITY_FLAGS) in configure.in 2) I also tried to add . #pragma GCC visibility push(default) in both imgLoader.h and imgLoader.cpp. 3) Disable gold by adding ac_add_options --disable-gold into .mozconfig. I have checked the libxul.so, it did contains the symbol. samuelyang@firefox-dev:~/build_ff/firefox_dev/obj-x86_64-unknown-linux-gnu/zlh_first_com$ nm ../toolkit/library/libxul.so | grep imgLoader | grep Single 0000000001085062 t _ZN9imgLoader11PBSingletonEv 000000000108503a t _ZN9imgLoader9SingletonEv Do you guys know what is wrong? Or how can I build a single SO with xul references? Millions of thanks. Sam _______________________________________________ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds