User forums > Using Code::Blocks
Howto - Cross Compiling in Linux using MingW32
milope:
--- Quote from: jens on January 04, 2009, 11:16:31 am ---You can not use the same library for linux and windows builds.
the linux libs are under "/usr/lib[32|64]/" or "/usr/local/lib[32|64]", the windows libs under "/usr/i586-mingw32msvc/lib".
That a library is a cross-platform only means that the sources can be compiled on different platforms, the binaries are different.
--- End quote ---
Helo guys,
Same problem : I need to use libxml2 in a cross project .
- I tried lots of manips like to put libxml2 win32 on mingw directory (it give /usr/i586-mingw32msvc/lib/libxml2_a.lib and /usr/i586-mingw32msvc/include/libxml/lots-of-.h-files ) but nothing work...
Any body can help me ?
MortenMacFly:
--- Quote from: milope on February 04, 2010, 10:21:30 am ---Any body can help me ?
--- End quote ---
What about adding it to the libraries to link against and providing the path to the lib to the linker directories in the project (target) settings?
However, without a full compiler log of the actual error you won't get much help.
rcoll:
--- Quote from: milope on February 04, 2010, 10:21:30 am ---
--- Quote from: jens on January 04, 2009, 11:16:31 am ---You can not use the same library for linux and windows builds.
the linux libs are under "/usr/lib[32|64]/" or "/usr/local/lib[32|64]", the windows libs under "/usr/i586-mingw32msvc/lib".
That a library is a cross-platform only means that the sources can be compiled on different platforms, the binaries are different.
--- End quote ---
Helo guys,
Same problem : I need to use libxml2 in a cross project .
- I tried lots of manips like to put libxml2 win32 on mingw directory (it give /usr/i586-mingw32msvc/lib/libxml2_a.lib and /usr/i586-mingw32msvc/include/libxml/lots-of-.h-files ) but nothing work...
Any body can help me ?
--- End quote ---
You are not clear -- are you trying to use the same binary library on both systems (linux and windows)?
If so, that will not work.
Ringo
milope:
->MortenMacFly
Sorry, this is build log :
--- Code: ---obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|66|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|89|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|53|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|34|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|34|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|34|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|34|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|30|first defined here|
obj/Release/main.o:/home/equipement/dev/test_libxml2/main.cpp|30|first defined here|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.data+0xec)||undefined reference to `_gzopen'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlWrapGzOpenUtf8]+0xf)||undefined reference to `_gzopen'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlWrapGzOpenUtf8]+0x6b)||undefined reference to `_gzdopen'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlInitPlatformSpecificIo]+0x75)||undefined reference to `_gzopen'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlGzfileOpen_real]+0x25)||undefined reference to `_gzdopen'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlGzfileOpenW]+0x42)||undefined reference to `_gzdopen'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlGzfileRead]+0x11)||undefined reference to `_gzread'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlGzfileWrite]+0x11)||undefined reference to `_gzwrite'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlGzfileClose]+0x7)||undefined reference to `_gzclose'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlFreeZMemBuff]+0x13)||undefined reference to `_deflateEnd'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlCreateZMemBuff]+0xa8)||undefined reference to `_deflateInit2_'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlCreateZMemBuff]+0x102)||undefined reference to `_crc32'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlZMemBuffAppend]+0x52)||undefined reference to `_deflate'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlZMemBuffAppend]+0x6b)||undefined reference to `_crc32'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlZMemBuffGetContent]+0x34)||undefined reference to `_deflate'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[___xmlParserInputBufferCreateFilename]+0xbd)||undefined reference to `_gzread'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[___xmlParserInputBufferCreateFilename]+0xe1)||undefined reference to `_gzrewind'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xmlIO.obj):../xmlIO.c:(.text[_xmlFreeHTTPWriteCtxt]+0x2d)||undefined reference to `_deflateEnd'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlIconvWrapper]+0x59)||undefined reference to `_libiconv'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlCharEncCloseFunc]+0x3f)||undefined reference to `_libiconv_close'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlCharEncCloseFunc]+0x5d)||undefined reference to `_libiconv_close'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlByteConsumed]+0x6)||undefined reference to `__chkstk'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlFindCharEncodingHandler]+0xd2)||undefined reference to `_libiconv_open'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlFindCharEncodingHandler]+0xdf)||undefined reference to `_libiconv_open'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlFindCharEncodingHandler]+0xf8)||undefined reference to `_libiconv_open'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlFindCharEncodingHandler]+0x111)||undefined reference to `_libiconv_open'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlFindCharEncodingHandler]+0x137)||undefined reference to `_libiconv_close'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/encoding.obj):../encoding.c:(.text[_xmlFindCharEncodingHandler]+0x13d)||undefined reference to `_libiconv_close'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/valid.obj):../valid.c:(.text[_xmlValidBuildContentModel]+0x6)||undefined reference to `__chkstk'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/valid.obj):../valid.c:(.text[_xmlValidateElementContent]+0x6)||undefined reference to `__chkstk'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xpath.obj):../xpath.c:(.text[_xmlXPathFormatNumber]+0xa4)||undefined reference to `__ftol2'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xpath.obj):../xpath.c:(.text[_xmlXPathFormatNumber]+0x1a4)||undefined reference to `__ftol2'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xpath.obj):../xpath.c:(.text[_xmlXPathIsPositionalPredicate]+0x3c)||undefined reference to `__ftol2'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xpath.obj):../xpath.c:(.text[_xmlXPathFloorFunction]+0x6a)||undefined reference to `__ftol2'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/xpath.obj):../xpath.c:(.text[_xmlXPathCeilingFunction]+0x6e)||undefined reference to `__ftol2'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/nanohttp.obj):../nanohttp.c:(.text[_xmlNanoHTTPFreeCtxt]+0xcb)||undefined reference to `_inflateEnd'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/nanohttp.obj):../nanohttp.c:(.text[_xmlNanoHTTPReadLine]+0x6)||undefined reference to `__chkstk'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/nanohttp.obj):../nanohttp.c:(.text[_xmlNanoHTTPScanAnswer]+0x449)||undefined reference to `_inflateInit2_'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/nanohttp.obj):../nanohttp.c:(.text[_xmlNanoHTTPRead]+0x97)||undefined reference to `_inflate'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/nanoftp.obj):../nanoftp.c:(.text[_xmlNanoFTPList]+0x6)||undefined reference to `__chkstk'|
/usr/i586-mingw32msvc/lib/libxml2.a(int.a.msvc/nanoftp.obj):../nanoftp.c:(.text[_xmlNanoFTPGet]+0x6)||undefined reference to `__chkstk'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 36 warnings ===|
--- End code ---
-> rcoll
My program work fine under linux, with gcc and distrib libxml2-2.7.5 package -> Ok
I also want to build a windows version, also under linux, using mingw and libxml2-2.7.6.win32 binaries (/usr/i586-mingw32msvc/lib/libxml2_a.lib and /usr/i586-mingw32msvc/include/libxml/lots-of-.h-files ) -> there is the problem...
I'v also tried to compile libxml with mingw but not successfully...
-----Edit...
Execution is ok if I put libxml2.dll into the program folder without any libs or .h with libxml2_a.lib (witch is renamed libxml2.a) and includes files in /usr/i586-mingw32msvc/.
But I want only one static file ! Can you tell me how can I do this ?
Thanks !
MortenMacFly:
--- Quote from: milope on February 04, 2010, 02:44:05 pm ---But I want only one static file ! Can you tell me how can I do this ?
--- End quote ---
You'll most likely need to create the static lib from the sources, sorry.
BTW: you have a broken project setup. It seems you imported a Visual Studio project and didn't clear up the settings for MinGW. Or you are using a wrong version of the VC compiler. I could tell but unfortunately you did not post the full "build log" (see my sig how to enable this). I don't need to see the errors, but the full log (including the compiler / linker commands). Just right-click on the "Build log" tab, select "Copy contents to clipboard" and paste here. Again: Don't forget to enable the full compiler log first.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version