mingw-cross-env-list
[Top][All Lists]
Advanced

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

Re: [Mingw-cross-env-list] MXE, CMake, QT, undefined references


From: Matthew Bucknall
Subject: Re: [Mingw-cross-env-list] MXE, CMake, QT, undefined references
Date: Tue, 25 Sep 2012 20:22:01 +0100


On 25 September 2012 19:15, Mark Brand <address@hidden> wrote:
Matthew Bucknall wrote:
Hi,

I'm currently trying to cross compile a CMake based QT project for Windows using MXE but I'm getting a whole load of undefined references (abbreviated):

...
/home/matt/Documents/Scratch/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/lib/libtiff.a(tif_lzma.o): In function `LZMAPreEncode':
/home/matt/Documents/Scratch/mxe/tmp-tiff/tiff-4.0.1/libtiff/tif_lzma.c:265: undefined reference to `lzma_stream_encoder'
/home/matt/Documents/Scratch/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/lib/libtiff.a(tif_lzma.o): In function `LZMAPreDecode':
/home/matt/Documents/Scratch/mxe/tmp-tiff/tiff-4.0.1/libtiff/tif_lzma.c:154: undefined reference to `lzma_stream_decoder'
/home/matt/Documents/Scratch/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/lib/libtiff.a(tif_lzma.o): In function `TIFFInitLZMA':
/home/matt/Documents/Scratch/mxe/tmp-tiff/tiff-4.0.1/libtiff/tif_lzma.c:460: undefined reference to `lzma_lzma_preset'
...
/home/matt/Documents/Scratch/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/lib/libmng.a(libmng_cms.o):libmng_cms.c:(.text+0xaab): undefined reference to `cmsCreateTransform'
/home/matt/Documents/Scratch/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/lib/libmng.a(libmng_cms.o):libmng_cms.c:(.text+0xae5): undefined reference to `cmsCreateTransform'
/home/matt/Documents/Scratch/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/lib/libmng.a(libmng_cms.o):libmng_cms.c:(.text+0xba1): undefined reference to `cmsDoTransform'
collect2: error: ld returned 1 exit status
make[2]: *** [src/placer/placer.exe] Error 1
make[1]: *** [src/placer/CMakeFiles/placer.dir/all] Error 2
make: *** [all] Error 2

The project builds fine with my native compiler and my CMakeLists.txt files include FIND_PACKAGE(Qt4 REQUIRED) and TARGET_LINK_LIBRARIES(placer ${QT_LIBRARIES}). I'm pretty new to CMake and MXE so I'd be really grateful if someone could suggest what might be wrong.

libtiff has dependencies -ltiff -llzma -ljpeg -lz. You can use pkg-config to list them:

    i686-pc-mingw32-pkg-config --libs libtiff-4

If you can add these libraries to your link command, it should solve the problem.

Mark


Thanks. I was expecting the Qt4 CMake package to ensure all dependencies are set in ${QT_LIBRARIES}, but evidently they are not. This got the build working:

find_package(Qt4 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(DEPS QtCore QtGui)
...
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
link_directories(${DEPS_LIBRARY_DIRS})
include_directories(${DEPS_INCLUDE_DIRS})
...
target_link_libraries(placer ${QT_LIBRARIES} ${DEPS_LIBRARIES})

Before trying this, I tried find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED), but that still resulted in loads of undefined references. Is this a bug?

Matt.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]