[CMake] Weird linking error while cross compiling

Andreas Pakulat apaku at gmx.de
Tue Oct 25 14:19:04 EDT 2011


On 25.10.11 13:15:37, Jose wrote:
> Hi all,
> 
> I'm cross compiling an app under Fedora.  I get this linking errors while
> building with cmake :
> 
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:
> cannot find -lxerces-c
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:
> cannot find -lportablexdr
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:
> cannot find -lz
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:
> cannot find -lsqlite3
> 
> 
> The thing is that the libraries have been found,included and linked with
> target_link_libraries. I'm adding all the necessary flags to link statically
> and the libraries are the ones included in the mingw package. It shoud work
> because a different part of the application that uses almost the same
> libraries is cross compiling perfectly. The cmake files are actually pretty
> much the same so I don't really know what I'm doing wrong. Cmake might be
> missing the libraries or the path of the libraries....

Hmm, -lfoo means the linker will search for a shared library. Linking
static libraries is done by specifying the absolute path to the library
file. How exactly are you calling target_link_libraries and assuming
that you're passing above libraries via cmake-variables whats the
content of those variables?

Andreas



More information about the CMake mailing list