[cmake-developers] Cannot cross-compile CMake

Rolf Eike Beer eike at sf-mail.de
Mon Sep 12 08:14:15 EDT 2011


Hi,

I just tried to cross-compile CMake for an ARM target. Which I did was
basically:

-bootstrap and build CMake for the host
-create a toolchain file for the target
-call this to configure CMake:

cmake \
	-D CMAKE_TOOLCHAIN_FILE=${prefix}/etc/toolchain.cmake \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D KWSYS_LFS_WORKS=TRUE \
	-D KWSYS_CHAR_IS_SIGNED=TRUE \
	../cmake \
	;

The last two were needed because CMake can't determine those because it's
using a cross compiler. Annoying, but easily solved. But then I tried to
build and ended with this:

Scanning dependencies of target documentation
[ 98%] [ 98%] [ 98%] Generating ../Docs/ctest.txt
Generating ../Docs/cpack.txt
Generating ../Docs/cmake.txt
/bin/sh: ../bin/ctest: cannot execute binary file
make[2]: *** [Docs/ctest.txt] Error 126
make[2]: *** Waiting for unfinished jobs....
/bin/sh: ../bin/cmake: cannot execute binary file
make[2]: *** [Docs/cmake.txt] Error 126
/bin/sh: ../bin/cpack: cannot execute binary file
make[2]: *** [Docs/cpack.txt] Error 126
make[1]: *** [Utilities/CMakeFiles/documentation.dir/all] Error 2

Well, of course this will not work, this is _cross_ compiling...

For now my solution is this:

sed 's/^ADD_CUSTOM_TARGET(documentation/#&/;s/^INSTALL_FILES(/#&/' -i
cmake/Utilities/CMakeLists.txt

This is no problem for me since I don't need the documentation on the
target anyway.

Are there any hints on this subject or should I just go and create a bug
report?

Eike



More information about the cmake-developers mailing list