Last Comment Bug 682259 - Problem linking code with XulRunner SDK 7.0
: Problem linking code with XulRunner SDK 7.0
Status: RESOLVED FIXED
: dev-doc-complete
Product: Firefox
Classification: Client Software
Component: Extension Compatibility (show other bugs)
: 7 Branch
: x86 Windows XP
: -- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-26 04:42 PDT by Sergey
Modified: 2014-12-05 05:08 PST (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Sergey 2011-08-26 04:42:21 PDT
User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.215 Safari/535.1

Steps to reproduce:

I have extension that supports multiples version of FF (3.6-6) and contains native code. I have tried to recompile my native code using latest xulrunner 7.0 SDK (http://download02.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-mozilla-beta/).

I have compiled my code via VS 2008 with following xulrunner libs included for linker (the same as with previous version of xulrunner)

xpcom.lib
xpcomglue_s_nomozalloc.lib
nspr4.lib


Actual results:

Compilation stage completed successfully but linking failed with fallowing errors


Error	3	error LNK2019: unresolved external symbol "public: unsigned short const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPBGXZ) referenced in function "public: unsigned short const * __thiscall nsString_external::get(void)const " (?get@nsString_external@@QBEPBGXZ)	ENmozUtils.obj	enbar
Error	4	error LNK2001: unresolved external symbol "public: unsigned short const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPBGXZ)	ENTool.obj	enbar
Error	5	error LNK2019: unresolved external symbol "public: int __thiscall nsAString::FindChar(unsigned short,unsigned int)const " (?FindChar@nsAString@@QBEHGI@Z) referenced in function "class nsString_external & __cdecl ReplaceDoubleQuotes(class nsString_external &)" (?ReplaceDoubleQuotes@@YAAAVnsString_external@@AAV1@@Z)	ENmozUtils.obj	enbar
Error	6	error LNK2019: unresolved external symbol "public: unsigned short const * __thiscall nsAString::EndReading(void)const " (?EndReading@nsAString@@QBEPBGXZ) referenced in function "unsigned int __stdcall MakeBody(class nsIDOMWindow *,class nsIDOMHTMLDocument *,class nsString_external &,unsigned short * * *,unsigned int *,int)" (?MakeBody@@YGIPAVnsIDOMWindow@@PAVnsIDOMHTMLDocument@@AAVnsString_external@@PAPAPAGPAIH@Z)	ENmozUtils.obj	enbar



Expected results:

I have read "Firefox 7 for developers" article and have not found any changes in nsAString class, so I think my code should be linked without any problems (or changes in nsAString should be listed in the article mentioned above)
Comment 1 Jorge Villalobos [:jorgev] 2011-08-31 16:00:58 PDT
Could this be because of the patch in bug 540322?
Comment 2 Jeff 2011-09-07 10:39:45 PDT
I have this same issue, but only on Windows.  The signature of the function in the referenced libs changed between Gecko 6.0 and Gecko 7.0:

d:\gecko_6.0\win\lib>dumpbin /symbols *.lib | findstr /i BeginReading
036 00000000 UNDEF  notype ()    External     | ?BeginReading@nsAString@@QBEPBGXZ (public: unsigned short const * __thiscall nsAString::BeginReading(void)const )
...

d:\gecko_7.0\win\lib>dumpbin /symbols *.lib | findstr /i BeginReading
036 00000000 UNDEF  notype ()    External     | ?BeginReading@nsAString@@QBEPB_WXZ (public: wchar_t const * __thiscall nsAString::BeginReading(void)const )
...
Comment 3 Mook (as) 2011-09-07 16:22:59 PDT
This is probably fallout from bug 508905; try not using -Zc:wchar_t- in the cl.exe command line? For those using the Visual Studio projects, I believe it's Project Properties -> C/C++ -> Language -> Treat wchar_t as Built-in Type -> Yes.

Marking as dev-doc-needed even though that should really go on bug 508905.
Comment 4 Jeff 2011-09-07 17:32:40 PDT
Okay, removing -Zc:wchar_t- does indeed seem to fix the linker error.  I will update our build scripts.  Thanks.
Comment 5 Jorge Villalobos [:jorgev] 2011-09-07 17:36:37 PDT
Calling this fixed, but still pending documentation.
Comment 6 Eric Shepherd [:sheppy] 2011-09-08 06:13:00 PDT
Added a note about this change here:

https://developer.mozilla.org/En/Developer_Guide/Build_Instructions#Build_and_install

And added a mention to Firefox 7 for developers.
Comment 7 Friedemann Kunze 2012-03-09 02:44:12 PST
Sorry, but I have the same problem (linker error) with xul-runner 10.0.2:
...
Error	24	error LNK2019: unresolved external symbol "public: unsigned short const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPBGXZ) referenced in function "public: unsigned short const * __thiscall nsString_external::get(void)const " (?get@nsString_external@@QBEPBGXZ)	embed.obj	HTMLRenderer
...

And in my VS project settings the option 'Treat wchar_t as Built-in Type' is set to 'yes'.
Comment 8 JustMe 2014-12-05 05:08:45 PST
(In reply to Friedemann Kunze from comment #7)
> Sorry, but I have the same problem (linker error) with xul-runner 10.0.2:
> ...
> Error	24	error LNK2019: unresolved external symbol "public: unsigned short
> const * __thiscall nsAString::BeginReading(void)const "
> (?BeginReading@nsAString@@QBEPBGXZ) referenced in function "public: unsigned
> short const * __thiscall nsString_external::get(void)const "
> (?get@nsString_external@@QBEPBGXZ)	embed.obj	HTMLRenderer
> ...
> 
> And in my VS project settings the option 'Treat wchar_t as Built-in Type' is
> set to 'yes'.

Hi there.
I have exactly the same problem as you.
Did you manage to find any solution?

Note You need to log in before you can comment on or make changes to this bug.