Re: [xml] MSYS and MINGW: undefined reference to _imp__xmlFree



On 16/11/2012 08:06, Daniel Richard G. wrote:
On Fri, 9 Nov 2012, Mike Peat wrote:

I am trying to do that under MinGW/MSys (having had no joy with MSVC due to msvcrt.dll incompatibilities), but am running into the error "undefined reference to _imp__xmlFree". If anybody knows how to solve this problem then I would be extremely grateful if they would let me know how.

That's a sign that you compiled LibXML2 as a static library, but compiled your application to consume LibXML2 as a DLL. When "_imp_" is prepended to a function name, that means the function lives (or is expected to live) in a DLL.

Try compiling your application with -DLIBXML_STATIC.


--Daniel

Daniel - thank you for that (if nothing else it is improving my limited insight), but I am running into the problem in compiling libxml2 itself, rather than in compiling things that depend on it (actually this may be only half true - the error is coming when it gets - I think - to linking xmllint.exe). In any case I think I *need* to build DLLs for what I am doing.

What I am trying to do is build xmlsec, and (if I am understanding correctly... improbable, I suspect) that means I have to first build the things it depends on: zlib, libiconv, libxml2, openssl and libxslt. I have (I think) built openssl, libiconv and zlib OK in msys using mingw, but when I try to build libxml2 I run into the error:

...
  CCLD   xmllint.exe
xmllint.o: In function `processNode': E:\MinGW\msys\1.0\projects\xmlsec\libxml2-2.9.0/xmllint.c:1820: undefined reference to `_imp__xmlFree'
...

followed by many more of the same sort of thing.

There is mention of what sounds like this problem in xmlexports.h (line 111):

  /*
   * if defined(IN_LIBXML) this raises problems on mingw with msys
   * _imp__xmlFree listed as missing. Try to workaround the problem
   * by also making that declaration when compiling client code.
   */

I am doing (in /projects/xmlsec/libxml2-2.9.0):

make clean

./configure --prefix=/projects/xmlsec/libxml2-2.9.0 --build=i686-pc-mingw32 --host=i686-pc-winnt --with-iconv=/projects/xmlsec/libiconv-1.14 --with-zlib=/projects/xmlsec/zlib-1.2.7

make

Any suggestions *very* gratefully received. :-(

--Mike



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]