Hi all, I am hitting some strange behaviors in embedding under Linux. Initialization in our app fails, so I worked out a small demo app, which is just the usual embedding init sequence (in pseudo-code)
------------------------------------------------------------------------------- XPCOMGlueStartup XPCOMGlueLoadXULFunctions // load XRE_InitEmbedding and XRE_TermEmbedding NS_NewNativeLocalFile // xuldir NS_NewNativeLocalFile // appdir and finally XRE_InitEmbedding(xuldir, appdir, nsnull, nsnull, 0); -------------------------------------------------------------------------------- the stuff works perfectly under Windows. I am experienced there and I am porting under Linux, where I am much less experienced. We are (still) on XULRunner 1.9.0.10. I tried both "default" and debug- noOptimize configurations for XULRunner (please see at bottom of this post). We are on Fedora 12. If I compile (with -DXPCOM_GLUE=1) and link the small snippet above (I am using Eclipse with a default wizard-generated C++ app, so no esoteric flags here), only "xpcomglue" and "dl" libraries need to be linked, and everything works. But, when I link "xul" (and I need that for our REAL app), "dl" seems no loger needed, "mozjs" is needed to resolve stuff like (...)/ libxul.so: undefined reference to `JS_DumpHeap', JS_SetPrincipalsTranscoder, JS_GetOperationLimit, JS_SetGCZeal, JS_SetObjectPrincipalsFinder etc, and XRE_InitEmbedding always fails returning a nonzero value (a generic error, no hints). Some logging: when failing, I get a lot of ---------------------------------------- WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule xpconnect: Register hook for JS component loader component returned error => c1f30001 ---------------------------------------- and the like while XRE_InitEmbedding is registering components, and a final WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 165 before XRE_InitEmbedding fails. Please note that, when it works instead, I get anyway a lot of warnings and errors, but initialization is OK (XRE_InitEmbedding returns 0). here cometh the logs: this one is when linking just xpcomglue and dl and everything is OK: ----- BEGIN EVERYTHINGSALLRIGHT LOG ------------------------------------------ WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 1024 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 1024 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 1024 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 964 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 910 WARNING: XPCOM objects created/destroyed from static ctor/dtor: 'gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_GetThreadPrivate(gActivityTLS)) == 0', file /usr/ src/mozilla/xpcom/base/nsTraceRefcntImpl.cpp, line 964 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 ###!!! ASSERTION: Failed to write xpti manifest!: 'Error', file /usr/ src/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp, line 1946 ###!!! ASSERTION: Failed to write xpti manifest!: 'Error', file /usr/ src/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp, line 1946 *** Registering components in: xpconnect *** Registering components in: nsUCvMathModule *** Registering components in: nsUConvModule *** Registering components in: nsI18nModule *** Registering components in: nsChardetModule *** Registering components in: nsUniversalCharDetModule *** Registering components in: necko *** Registering components in: nsCookieModule *** Registering components in: nsPermissionsModule *** Registering components in: nsAuthModule *** Registering components in: nsJarModule *** Registering components in: ZipWriterModule *** Registering components in: nsPrefModule *** Registering components in: nsSecurityManagerModule *** Registering components in: nsRDFModule *** Registering components in: nsXPIntlModule *** Registering components in: nsWindowDataSourceModule *** Registering components in: nsParserModule *** Registering components in: nsGfxModule *** Registering components in: nsWidgetGtk2Module *** Registering components in: nsImageLib2Module *** Registering components in: nsPluginModule *** Registering components in: nsLayoutModule *** Registering components in: docshell_provider *** Registering components in: embedcomponents *** Registering components in: Browser_Embedding_Module *** Registering components in: nsCJVMManagerModule *** Registering components in: nsAccessibilityModule *** Registering components in: appshell *** Registering components in: nsTransactionManagerModule *** Registering components in: nsComposerModule *** Registering components in: nsChromeModule *** Registering components in: application *** Registering components in: nsFindComponent *** Registering components in: Apprunner *** Registering components in: CommandLineModule *** Registering components in: nsFileViewModule *** Registering components in: mozStorageModule *** Registering components in: nsPlacesModule *** Registering components in: tkAutoCompleteModule *** Registering components in: satchel *** Registering components in: PKI *** Registering components in: nsToolkitCompsModule *** Registering components in: RemoteServiceModule *** Registering components in: JavaScript_Debugger *** Registering components in: BOOT *** Registering components in: NSS *** Registering components in: nsAutoConfigModule *** Registering components in: nsSystemPrefModule *** Registering components in: mozSpellCheckerModule *** Registering components in: nsUnixProxyModule WARNING: Couldn't register mGREComponentsDir: file /usr/src/mozilla/ xpcom/components/nsComponentManager.cpp, line 3270 WARNING: Error parsing GRE default preferences. Is this an old-style embedding app?: file /usr/src/mozilla/modules/libpref/src/ nsPrefService.cpp, line 791 WARNING: Error parsing application default preferences.: file /usr/src/ mozilla/modules/libpref/src/nsPrefService.cpp, line 823 *** registering nsTaggingService.js: [ Places Tagging Service, Places Tag AutoComplete ] *** registering nsPlacesDBFlush.js: [ Used to synchronize the temporary and permanent tables of Places ] JS Component Loader: ERROR (null):0 uncaught exception: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: file:///usr/lib/xulrunner-1.9.1/components/nsHelperAppDlg.js :: <TOP_LEVEL> :: line 19" data: no] *** loading ISO8601DateUtils *** registering FeedProcessor.js: [ Feed Processor, Feed Result, Feed, Feed Entry, Feed Text Construct, Feed Generator, Feed Person ] *** registering nsAddonRepository.js: [ Addon Repository ] *** registering nsBlocklistService.js: [ Blocklist Service ] *** registering nsLoginManagerPrompter.js: [ LoginManagerPromptFactory, LoginManagerPrompter ] *** registering nsWebHandlerApp.js: [ A web handler for protocols and content ] *** registering nsLoginInfo.js: [ LoginInfo ] *** registering nsContentPrefService.js: [ Content Pref Service, Hostname Grouper ] *** registering nsUpdateService.js: [ Update Service, Update Checker, Update Prompt, Timer Manager, Update Manager ] *** registering nsLoginManager.js: [ LoginManager ] *** registering storage-mozStorage.js: [ LoginManagerStorage_mozStorage ] *** registering nsBadCertHandler.js: [ XMLHttpRequest Bad Cert Handler ] *** registering nsURLFormatter.js: [ Application URL Formatter Service ] *** registering jsconsole-clhandler.js: [ jsConsoleHandler ] *** registering nsDownloadManagerUI.js: [ Used to show the Download Manager's UI to the user ] *** registering nsContentDispatchChooser.js: [ Used to handle different types of content ] *** registering storage-Legacy.js: [ LoginManagerStorage_legacy ] *** registering nsTryToClose.js: [ tryToClose Service ] *** registering nsHandlerService.js: [ Handler Service ] JS Component Loader: ERROR file:///usr/local/share/gre_3.0.10_release/dist/bin/modules/XPCOMUtils.jsm:115 TypeError: i is undefined *** registering nsExtensionManager.js: [ Extension Manager, Extension Manager Data Source, Update Item ] *** registering nsSearchSuggestions.js: [ Remote Search Suggestions ] JS Component Loader: ERROR (null):0 uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame :: file:///usr/lib/xulrunner-1.9.1/components/nsProxyAutoConfig.js :: <TOP_LEVEL> :: line 186" data: no] ************************************************************ * Call to xpconnect wrapped JSObject produced this error: * [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame :: file:///usr/lib/xulrunner-1.9.1/components/nsUpdateService.js :: UpdateService :: line 1049" data: no] ************************************************************ WARNING: Cannot create startup observer : service,@mozilla.org/updates/ update-service;1: file /usr/src/mozilla/embedding/components/ appstartup/src/nsAppStartupNotifier.cpp, line 113 ----- END EVERYTHINGSALLRIGHT LOG ------------------------------------------ and the next log is when I link xpcomglue, xul, and I MUST link also mozjs and it seems I dont need to link dl any more (and nothing changes if I link it): ----- BEGIN BASTARDANDNASTY LOG ------------------------------------------ WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 *** Registering components in: xpconnect WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule xpconnect: Register hook for JS component loader component returned error => c1f30001 *** Registering components in: nsUCvMathModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsUCvMathModule: Register hook for Unicode Encoder-x- mathematica1 component returned error => c1f30001 *** Registering components in: nsUConvModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsUConvModule: Register hook for Charset Conversion Manager component returned error => c1f30001 *** Registering components in: nsI18nModule *** Registering components in: nsChardetModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsChardetModule: Register hook for Meta Charset component returned error => c1f30001 *** Registering components in: nsUniversalCharDetModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsUniversalCharDetModule: Register hook for Universal Charset Detector component returned error => c1f30001 *** Registering components in: necko WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 WARNING: NS_ENSURE_TRUE(catmgr) failed: file /usr/src/mozilla/netwerk/ build/nsNetModule.cpp, line 354 nsGenericModule necko: Register hook for Stream Converter Service component returned error => 8000ffff *** Registering components in: nsCookieModule *** Registering components in: nsPermissionsModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsPermissionsModule: Register hook for ContentBlocker component returned error => c1f30001 *** Registering components in: nsAuthModule *** Registering components in: nsJarModule *** Registering components in: ZipWriterModule *** Registering components in: nsPrefModule *** Registering components in: nsSecurityManagerModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsSecurityManagerModule: Register hook for scriptsecuritymanager component returned error => c1f30001 *** Registering components in: nsRDFModule *** Registering components in: nsXPIntlModule *** Registering components in: nsWindowDataSourceModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsWindowDataSourceModule: Register hook for nsWindowDataSource component returned error => c1f30001 *** Registering components in: nsParserModule *** Registering components in: nsGfxModule *** Registering components in: nsWidgetGtk2Module *** Registering components in: nsImageLib2Module WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsImageLib2Module: Register hook for image loader component returned error => c1f30001 *** Registering components in: nsPluginModule *** Registering components in: nsLayoutModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsLayoutModule: Register hook for HTML img element component returned error => 80004005 *** Registering components in: docshell_provider *** Registering components in: embedcomponents *** Registering components in: Browser_Embedding_Module WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule Browser_Embedding_Module: Register hook for nsIWebBrowserSetup content policy enforcer component returned error => c1f30001 *** Registering components in: nsCJVMManagerModule *** Registering components in: nsAccessibilityModule *** Registering components in: appshell *** Registering components in: nsTransactionManagerModule *** Registering components in: nsComposerModule *** Registering components in: nsChromeModule *** Registering components in: application WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule application: Register hook for Directory Viewer component returned error => c1f30001 *** Registering components in: nsFindComponent *** Registering components in: Apprunner *** Registering components in: CommandLineModule *** Registering components in: nsFileViewModule *** Registering components in: mozStorageModule *** Registering components in: nsPlacesModule *** Registering components in: tkAutoCompleteModule *** Registering components in: satchel *** Registering components in: PKI *** Registering components in: nsToolkitCompsModule *** Registering components in: RemoteServiceModule *** Registering components in: JavaScript_Debugger *** Registering components in: BOOT *** Registering components in: NSS WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule NSS: Register hook for PSM Content Listeners component returned error => c1f30001 *** Registering components in: nsAutoConfigModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsAutoConfigModule: Register hook for ReadConfig Module component returned error => c1f30001 *** Registering components in: nsSystemPrefModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule nsSystemPrefModule: Register hook for System Preferences component returned error => c1f30001 *** Registering components in: mozSpellCheckerModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 90 nsGenericModule mozSpellCheckerModule: Register hook for mozHunspellDirProvider component returned error => 80004005 *** Registering components in: nsUnixProxyModule WARNING: NS_ENSURE_TRUE(compMgr) failed: file nsComponentManagerUtils.cpp, line 165 ----- END BASTARDANDNASTY LOG ------------------------------------------ When stepping into code, the problem seems @ nsEmbedFunctions.cpp:133, where in XRE_InitEmbedding the last lines ----------------------------------------- nsCOMPtr<nsIObserver> startupNotifier (do_CreateInstance(NS_APPSTARTUPNOTIFIER_CONTRACTID)); if (!startupNotifier) return NS_ERROR_FAILURE; ----------------------------------------- fail and return. I tried to change the link order of xpcom, xul, mozjs, adding and removing dl, howling at the full moon and performing human sacrifices of some junior developers, but nothing seems to happen. I am really clueless. Any idea? Thanks. PS: here is my latest .mozconfig: ---------------------- ac_add_options --enable-application=xulrunner mk_add_options MOZ_CO_PROJECT=xulrunner mk_add_options MOZ_OBJDIR=/usr/local/share/gre_3.0.10_debug_nolibxul mk_add_options MOZ_MAKE_FLAGS="-j5" ac_add_options --disable-javaxpcom ac_add_options --disable-tests ac_add_options --disable-logging ac_add_options --disable-crashreporter ac_add_options --enable-cpp-rtti ac_add_options --enable-cpp-exceptions ac_add_options --enable-debug ac_add_options --disable-optimize ac_add_options --disable-xpinstall ---------------------- _______________________________________________ dev-embedding mailing list dev-embedding@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-embedding