Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

XMl-Parser build failed on windows X64 with VStuido10

by pthiru (Novice)
on Sep 25, 2012 at 07:14 UTC ( [id://995499]=perlquestion: print w/replies, xml ) Need Help??

pthiru has asked for the wisdom of the Perl Monks concerning the following question:

C:\mssdk\lib\AMD64\comctl32.lib C:\mssdk\lib\AMD64\bufferoverflowU.lib C:\VStudio10\VC\lib\amd64\msvcrt.lib -def:Expat.def
Creating library ..\..\..\lib\auto\XML\Parser\Expat\Expat.lib and object ..\..\..\lib\auto\XML\Parser\Expat\Expat.exp
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEndDoctypeDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetBase
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetElementDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_DefaultCurrent
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetStartCdataSectionHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetBuffer
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetDefaultHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEndCdataSectionHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetBase
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetUnparsedEntityDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetSpecifiedAttributeCount
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetCurrentByteIndex
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetAttlistDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetStartDoctypeDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetCurrentColumnNumber
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetProcessingInstructionHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetNotationDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetCommentHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetNamespaceDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetElementHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetDefaultHandlerExpand
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_ParserFree
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_ErrorString
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetCdataSectionHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetInputContext
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEntityDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_ParserCreate_MM
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_Parse
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_ExternalEntityParserCreate
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetCharacterDataHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetParamEntityParsing
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetXmlDeclHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetExternalEntityRefHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_ParseBuffer
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetCurrentByteCount
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetUnknownEncodingHandler
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetUserData
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetErrorCode
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetCurrentLineNumber
..\..\..\lib\auto\XML\Parser\Expat\Expat.dll : fatal error LNK1120: 39 unresolved externals
NMAKE : fatal error U1077: 'C:\VStudio10\VC\BIN\amd64\link.EXE' : return code '0x460'
Stop.
NMAKE : fatal error U1077: 'C:\VStudio10\VC\BIN\amd64\nmake.EXE' : return code '0x2' Stop.

I am trying to build XML-Parser-2.41 module with perl-5.16.0
Please guide me on this issue.
  • Comment on XMl-Parser build failed on windows X64 with VStuido10

Replies are listed 'Best First'.
Re: XMl-Parser build failed on windows X64 with VStuido10
by syphilis (Archbishop) on Sep 25, 2012 at 09:37 UTC
    I would expect that at least some (and probably all) of those "unresolved external symbol" errors would be resolved by your libexpat.lib ... but apparently that's not the case.

    Is your libexpat.lib an import lib for a dll ?
    If so, then I think it should resolve those symbols. But, if it's a static library, then it won't resolve those symbols (because the "imp" part will be missing).

    I guess another possibility is that your libexpat.lib is too old, but I think that's unlikely.
    Try doing a search of libexpat.lib for the strings "XML_SetCommentHandler", "imp__XML_SetCommentHandler" and "imp_XML_SetCommentHandler". Are *any* of those strings found ? If so, which one(s) ?
    It's the (first and) last of those 3 that needs to be found for you. However, in the libexpat import library that I looked at, it was the first 2 that could be found - so I think there's at least a chance that the difference in the number of underscores (1 versus 2) between the "imp" and the "XML" is bringing you undone.

    If "imp_XML_SetCommentHandler" *does* exist in libexpat.lib, how many leading underscores come before "imp" ?

    Cheers,
    Rob
      Use MS dumpbin on the .lib file. Much cleaner than use a text editor.
      I have first and last occurance in my lib file,please help how to resolve this issue
        I have first and last occurance in my lib file,please help how to resolve this issue

        Do you also have all of the "unresolved external symbol" errors in between the first and last occurrences ?
        Could you please provide the output of running  perl -V
        Are you actually using Visual Studio 10 as your C compiler ? (Assuming that you are using a Microsoft Compiler, the output of running  cl /? might also be useful.)

        Cheers,
        Rob
Re: XMl-Parser build failed on windows X64 with VStuido10
by BrowserUk (Patriarch) on Sep 25, 2012 at 12:00 UTC

    Are you sure you're not trying to link X64 code against a 32-bit library?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

Re: XMl-Parser build failed on windows X64 with VStuido10
by mfort (Novice) on Apr 21, 2017 at 18:57 UTC
    I found this thread much later and think I might have something to add.

    I got similar output:
    Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEnd +DoctypeDeclHandler Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetBas +e Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEle +mentDeclHandler Expat.obj : error LNK2001: unresolved external symbol __imp_XML_Defaul +tCurrent Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetSta +rtCdataSectionHandler ...
    When I searched for one of the symbol in the libexpat.lib file, I found something interesting.
    $ grep _imp__XML_SetCommentHandler libexpat.lib Binary file libexpat.lib matches $ grep __imp_XML_SetCommentHandler libexpat.lib Exit 1
    The short of it is that the symbol name is not correct. I think the toolchain (gcc, other VC version) used to build libexpat.lib was different from the toolchain that I am using to build XML::Parser::Expat and that is why the link is failing.

    I have a theory on what is actually happening, but it is only a theory, so take it for what it is...
  • The libexpat.lib contains a XML_SetCommentHandler function that knows how to load the libexpat.dll and then call a differently named version of the function that resides in the DLL. This naming is the root problem.
  • When the libexpat.lib was compiled, the prototype of the DLL version of the function had extern "c", and some "declspec" keyword, added to the name. The use of extern "c" prepends a "_" to the symbol name. The use of "declspec" prepends a "_imp_" to the symbol name.
  • When the toolchain used to build libexpat.dll built the function, it honored the order of the extern "c" and "declspec" differently than the toolchain that I am using to build/link the libexpat.lib.
Re: XMl-Parser build failed on windows X64 with VStuido10
by Anonymous Monk on Sep 25, 2012 at 07:52 UTC

    The error text is on my scratchpad. Please guide me on this issue.

    It should be in your post and not in your scratchpad.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://995499]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found