When building a component against 1.8 sdk on Windows, which i had to build myself by building fx 1.5, linker fails with unresolved external symbol errors

RESOLVED INVALID

Status

()

Core
XPCOM
RESOLVED INVALID
13 years ago
13 years ago

People

(Reporter: Reşat SABIQ (Reshat), Assigned: dougt)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050919 Firefox/1.0.7
Build Identifier: gecko 1.8 SDK

xpcomglue.lib(nsXPCOMGlue.obj) : warning LNK4217: locally defined symbol _fopen imported in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : warning LNK4217: locally defined symbol _sprintf imported in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : warning LNK4217: locally defined symbol _strncpy imported in function _GRE_Startup
xpcomglue.lib(nsXPCOMGlue.obj) : warning LNK4217: locally defined symbol _strrchr imported in function _GRE_Startup
xpcomglue.lib(nsGREDirServiceProvider.obj) : warning LNK4217: locally defined symbol __mbsrchr imported in function "int __cdecl GRE_GetCurrentProcessDirectory(char *)" (?GRE_GetCurrentProcessDirectory@@YAHPAD@Z)
xpcomglue.lib(nsGREGlue.obj) : warning LNK4217: locally defined symbol _getenv imported in function _GRE_GetGREPathWithProperties
xpcomglue.lib(nsVersionComparator.obj) : warning LNK4217: locally defined symbol _free imported in function "int __cdecl NS_CompareVersions(char const *,char const *)" (?NS_CompareVersions@@YAHPBD0@Z)
xpcomglue.lib(nsVersionComparator.obj) : warning LNK4217: locally defined symbol _strpbrk imported in function "char * __cdecl ParseVP(char *,struct VersionPart &)" (?ParseVP@@YAPADPADAAUVersionPart@@@Z)
xpcomglue.lib(nsVersionComparator.obj) : warning LNK4217: locally defined symbol _strtol imported in function "char * __cdecl ParseVP(char *,struct VersionPart &)" (?ParseVP@@YAPADPADAAUVersionPart@@@Z)
xpcomglue.lib(nsVersionComparator.obj) : warning LNK4217: locally defined symbol _strchr imported in function "char * __cdecl ParseVP(char *,struct VersionPart &)" (?ParseVP@@YAPADPADAAUVersionPart@@@Z)
OLDNAMES.lib(access.obi) : warning LNK4049: locally defined symbol __access imported
OLDNAMES.lib(strdup.obi) : warning LNK4049: locally defined symbol __strdup imported
ImageLauncher.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl NS_NewGenericModule2(struct nsModuleInfo const *,class nsIModule * *)" (?NS_NewGenericModule2@@YAIPBUnsModuleInfo@@PAPAVnsIModule@@@Z) referenced in function _NSGetModule
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol __imp___snprintf referenced in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol __imp__fgets referenced in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsGlueLinkingWin.obj) : error LNK2019: unresolved external symbol __imp___fullpath referenced in function "unsigned int (__cdecl*__cdecl XPCOMGlueLoad(char const *))(struct XPCOMFunctions *,char const *)" (?XPCOMGlueLoad@@YAP6AIPAUXPCOMFunctions@@PBD@Z1@Z)
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol __imp___fullpath referenced in function _GRE_GetGREPathWithProperties
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: unresolved external symbol __imp__stat referenced in function _GRE_GetXPCOMPath
OLDNAMES.lib(stat.obi) : error LNK2001: unresolved external symbol __imp__stat
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol __imp__access referenced in function "int __cdecl GRE_GetPathFromRegKey(struct HKEY__ *,struct GREVersionRange const *,unsigned int,struct GREProperty const *,unsigned int,char *,unsigned int)" (?GRE_GetPathFromRegKey@@YAHPAUHKEY__@@PBUGREVersionRange@@IPBUGREProperty@@IPADI@Z)
OLDNAMES.lib(access.obi) : error LNK2001: unresolved external symbol __imp__access
xpcomglue.lib(nsVersionComparator.obj) : error LNK2019: unresolved external symbol __imp__strdup referenced in function "int __cdecl NS_CompareVersions(char const *,char const *)" (?NS_CompareVersions@@YAHPBD0@Z)
OLDNAMES.lib(strdup.obi) : error LNK2001: unresolved external symbol __imp__strdup
OLDNAMES.lib(stat.obi) : error LNK2001: unresolved external symbol __imp___stat


Reproducible: Always

Steps to Reproduce:
1. Try to build a component against 1.8 SDK
2. 
3.

Actual Results:  
Linker errors

Expected Results:  
Successful build

My extension uses a non-frozen interface, and so pulls in a header from fx source. I don't expect this to be affecting anything.
The extension built fine against 1.7.8 SDK for fx 1.0.7, and non-frozen interface usage has been adjusted for fx 1.5. The extension component built fine on Linux.
(Reporter)

Updated

13 years ago
Summary: When building a component against 1.8 sdk on Windows, which i had to build myself by build fx 1.5, linker fails with unresolved external symbol errors → When building a component against 1.8 sdk on Windows, which i had to build myself by building fx 1.5, linker fails with unresolved external symbol errors
(Reporter)

Comment 1

13 years ago
Linker command line:

/OUT:"Release/imageassistant.dll" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Development\c-c++\gecko-sdk-1.8\bin" /LIBPATH:"C:\Development\c-c++\gecko-sdk-1.8\lib" /DLL /NODEFAULTLIB:"MSVCRT" /DEBUG /PDB:"Release/imageassistant.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /IMPLIB:"Release/imageassistant.lib" /MACHINE:IX86 xpcomglue.lib nspr4.lib plds4.lib xpcom.lib embed_base_s.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Development\c-c++\gecko-sdk-1.8\lib\xpcomglue.lib" "\Development\c-c++\gecko-sdk-1.8\lib\nspr4.lib" "\Development\c-c++\gecko-sdk-1.8\lib\plds4.lib" "\Development\c-c++\gecko-sdk-1.8\lib\xpcom.lib" "\Development\c-c++\gecko-sdk-1.8\lib\embed_base_s.lib"
(Reporter)

Comment 2

13 years ago
If using /MD instead of /MT, # of errors increased:

ImageLauncher.obj : error LNK2019: unresolved external symbol __imp___errno referenced in function "protected: virtual unsigned int __thiscall ImageLauncher::OpenFile(char const *,struct _iobuf * *)" (?OpenFile@ImageLauncher@@MAEIPBDPAPAU_iobuf@@@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__fopen referenced in function "protected: virtual unsigned int __thiscall ImageLauncher::OpenFile(char const *,struct _iobuf * *)" (?OpenFile@ImageLauncher@@MAEIPBDPAPAU_iobuf@@@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2001: unresolved external symbol __imp__fopen
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__fclose referenced in function "protected: virtual unsigned int __thiscall ImageLauncher::WriteToFile(class nsIInputStream *,struct _iobuf *)" (?WriteToFile@ImageLauncher@@MAEIPAVnsIInputStream@@PAU_iobuf@@@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__fwrite referenced in function "protected: virtual unsigned int __thiscall ImageLauncher::WriteToFile(class nsIInputStream *,struct _iobuf *)" (?WriteToFile@ImageLauncher@@MAEIPAVnsIInputStream@@PAU_iobuf@@@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "protected: virtual unsigned int __thiscall ImageLauncher::WriteToFile(class nsIInputStream *,struct _iobuf *)" (?WriteToFile@ImageLauncher@@MAEIPAVnsIInputStream@@PAU_iobuf@@@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function "protected: virtual unsigned int __thiscall ImageLauncher::WriteToFile(class nsIInputStream *,struct _iobuf *)" (?WriteToFile@ImageLauncher@@MAEIPAVnsIInputStream@@PAU_iobuf@@@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__perror referenced in function "public: virtual unsigned int __thiscall ImageLauncher::LaunchFromFile(char const *)" (?LaunchFromFile@ImageLauncher@@UAEIPBD@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp___spawnvp referenced in function "public: virtual unsigned int __thiscall ImageLauncher::LaunchFromFile(char const *)" (?LaunchFromFile@ImageLauncher@@UAEIPBD@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__strstr referenced in function "public: virtual unsigned int __thiscall ImageLauncher::LaunchFromFile(char const *)" (?LaunchFromFile@ImageLauncher@@UAEIPBD@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl NS_NewGenericModule2(struct nsModuleInfo const *,class nsIModule * *)" (?NS_NewGenericModule2@@YAIPBUnsModuleInfo@@PAPAVnsIModule@@@Z) referenced in function _NSGetModule
ImageLauncher.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) referenced in function "private: void * __thiscall ImageLauncher::`scalar deleting destructor'(unsigned int)" (??_GImageLauncher@@AAEPAXI@Z)
xpcomglue.lib(nsGlueLinkingWin.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__strncpy referenced in function "public: virtual unsigned int __stdcall ImageLauncher::Launch(char const *,unsigned int *)" (?Launch@ImageLauncher@@UAGIPBDPAI@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2001: unresolved external symbol __imp__strncpy
ImageLauncher.obj : error LNK2019: unresolved external symbol __imp__strrchr referenced in function "public: virtual unsigned int __thiscall ImageLauncher::GetLocalFileName(char const *,class nsCString_external &)" (?GetLocalFileName@ImageLauncher@@UAEIPBDAAVnsCString_external@@@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2001: unresolved external symbol __imp__strrchr
LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol _memset referenced in function _XPCOMGlueStartup
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol __imp___snprintf referenced in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol _strlen referenced in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2001: unresolved external symbol _strlen
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol _strlen referenced in function "int __cdecl GRE_GetPathFromRegKey(struct HKEY__ *,struct GREVersionRange const *,unsigned int,struct GREProperty const *,unsigned int,char *,unsigned int)" (?GRE_GetPathFromRegKey@@YAHPAUHKEY__@@PBUGREVersionRange@@IPBUGREProperty@@IPADI@Z)
xpcomglue.lib(nsVersionComparator.obj) : error LNK2001: unresolved external symbol _strlen
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol __imp__fgets referenced in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol __imp__sprintf referenced in function "void __cdecl XPCOMGlueLoadDependentLibs(char const *,void (__cdecl*)(char const *))" (?XPCOMGlueLoadDependentLibs@@YAXPBDP6AX0@Z@Z)
xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2019: unresolved external symbol __alloca_probe referenced in function _GRE_Startup
xpcomglue.lib(nsGlueLinkingWin.obj) : error LNK2019: unresolved external symbol __imp___fullpath referenced in function "unsigned int (__cdecl*__cdecl XPCOMGlueLoad(char const *))(struct XPCOMFunctions *,char const *)" (?XPCOMGlueLoad@@YAP6AIPAUXPCOMFunctions@@PBD@Z1@Z)
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol __imp___fullpath referenced in function _GRE_GetGREPathWithProperties
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: unresolved external symbol _strcmp referenced in function "public: virtual unsigned int __stdcall nsGREDirServiceProvider::GetFile(char const *,int *,class nsIFile * *)" (?GetFile@nsGREDirServiceProvider@@UAGIPBDPAHPAPAVnsIFile@@@Z)
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol _strcmp referenced in function "int __cdecl GRE_GetPathFromRegKey(struct HKEY__ *,struct GREVersionRange const *,unsigned int,struct GREProperty const *,unsigned int,char *,unsigned int)" (?GRE_GetPathFromRegKey@@YAHPAUHKEY__@@PBUGREVersionRange@@IPBUGREProperty@@IPADI@Z)
xpcomglue.lib(nsVersionComparator.obj) : error LNK2001: unresolved external symbol _strcmp
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: unresolved external symbol __imp__stat referenced in function _GRE_GetXPCOMPath
OLDNAMES.lib(stat.obi) : error LNK2001: unresolved external symbol __imp__stat
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: unresolved external symbol _strcpy referenced in function _GRE_GetXPCOMPath
xpcomglue.lib(nsGREGlue.obj) : error LNK2001: unresolved external symbol _strcpy
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function "int __cdecl GRE_GetCurrentProcessDirectory(char *)" (?GRE_GetCurrentProcessDirectory@@YAHPAD@Z)
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol __imp__getenv referenced in function _GRE_GetGREPathWithProperties
xpcomglue.lib(nsGREGlue.obj) : error LNK2019: unresolved external symbol __imp__access referenced in function "int __cdecl GRE_GetPathFromRegKey(struct HKEY__ *,struct GREVersionRange const *,unsigned int,struct GREProperty const *,unsigned int,char *,unsigned int)" (?GRE_GetPathFromRegKey@@YAHPAUHKEY__@@PBUGREVersionRange@@IPBUGREProperty@@IPADI@Z)
OLDNAMES.lib(access.obi) : error LNK2001: unresolved external symbol __imp__access
xpcomglue.lib(nsVersionComparator.obj) : error LNK2019: unresolved external symbol __imp__free referenced in function "int __cdecl NS_CompareVersions(char const *,char const *)" (?NS_CompareVersions@@YAHPBD0@Z)
xpcomglue.lib(nsVersionComparator.obj) : error LNK2019: unresolved external symbol __imp__strdup referenced in function "int __cdecl NS_CompareVersions(char const *,char const *)" (?NS_CompareVersions@@YAHPBD0@Z)
OLDNAMES.lib(strdup.obi) : error LNK2001: unresolved external symbol __imp__strdup
xpcomglue.lib(nsVersionComparator.obj) : error LNK2019: unresolved external symbol __imp__strpbrk referenced in function "char * __cdecl ParseVP(char *,struct VersionPart &)" (?ParseVP@@YAPADPADAAUVersionPart@@@Z)
xpcomglue.lib(nsVersionComparator.obj) : error LNK2019: unresolved external symbol __imp__strtol referenced in function "char * __cdecl ParseVP(char *,struct VersionPart &)" (?ParseVP@@YAPADPADAAUVersionPart@@@Z)
xpcomglue.lib(nsVersionComparator.obj) : error LNK2019: unresolved external symbol __imp__strchr referenced in function "char * __cdecl ParseVP(char *,struct VersionPart &)" (?ParseVP@@YAPADPADAAUVersionPart@@@Z)
msvcprt.lib(newop_s.obj) : error LNK2019: unresolved external symbol _malloc referenced in function "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
msvcprt.lib(newop_s.obj) : error LNK2019: unresolved external symbol __callnewh referenced in function "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
OLDNAMES.lib(stat.obi) : error LNK2001: unresolved external symbol __imp___stat
OLDNAMES.lib(access.obi) : error LNK2001: unresolved external symbol __imp___access
OLDNAMES.lib(strdup.obi) : error LNK2001: unresolved external symbol __imp___strdup
Release/imageassistant.dll : fatal error LNK1120: 37 unresolved externals
(Reporter)

Comment 3

13 years ago
With /MD, and w/o /NODEFAULTLIB:"MSVCRT", there is only 1 error:

ImageLauncher.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl NS_NewGenericModule2(struct nsModuleInfo const *,class nsIModule * *)" (?NS_NewGenericModule2@@YAIPBUnsModuleInfo@@PAPAVnsIModule@@@Z) referenced in function _NSGetModule
(Reporter)

Comment 4

13 years ago
The last error got resolved by replacing xpcomglue w/ xpcomglue_s in libs list. Closing...
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID

Comment 5

13 years ago
Right: if you're linking with xpcomglue.lib you have to define XPCOM_GLUE.
(Reporter)

Comment 6

13 years ago
XPCOM_GLUE actually was defined. The thing is NS_NewGenericModule2 is defined in dynamic glue (_s.lib) only.
It appears static glue is only recommended for embedders who need to find the GRE and start it up themselves. 
As i have only a component, it appears _s is what i should link to anyway. I'll probably change my Linux build to match this as well.
You need to log in before you can comment on or make changes to this bug.