MantisBT - CMake
View Issue Details
0015248CMakeCMakeSetuppublic2014-11-12 17:232015-04-06 09:07
Davide Viti 
Brad King 
lowminoralways
closedfixed 
BuildrootLinuxDebian 7.7
CMake 3.0.2 
CMake 3.1CMake 3.1 
0015248: When cross compiling, "make install" invokes target "cmake" instead of host version
Crosscompilation goes smooth up to "make install" step where it fails:

 bin/cmake: 1: bin/cmake: Syntax error: word unexpected (expecting ")")

it is trying to invoke cross compiled cmake instead of the version available for the host machine.

The problem can be workarounded replacing "make install" with "cmake -P cmake_install.cmake"
I've run into the problem while crosscompiling cmake in buildroot (http://buildroot.uclibc.org/ [^]) for arm.
The build process invokes bootstrap:

        LDFLAGS="$(TARGET_LDFLAGS)" \
        CFLAGS="$(TARGET_CFLAGS)" \
        ./bootstrap --prefix=$(TARGET_DIR)/usr \
            --parallel=$(PARALLEL_JOBS) -- \
            -DCMAKE_C_FLAGS="$(TARGET_CFLAGS)" \
            -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS)" \
            -DCMAKE_EXE_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
            -DCMAKE_C_COMPILER="$(TARGET_CC)" \
            -DCMAKE_CXX_COMPILER="$(TARGET_CXX)" \
            -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="NEVER" \
            -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" \
            -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="ONLY" \
            -DBUILD_CursesDialog=OFF

then "make" and finally "make install"
No tags attached.
related to 0000891closed System Admin make install cmake replace 
Issue History
2014-11-12 17:23Davide VitiNew Issue
2014-11-13 08:50Brad KingRelationship addedrelated to 0000891
2014-11-13 08:51Brad KingNote Added: 0037205
2014-11-13 09:01Brad KingNote Added: 0037207
2014-11-14 15:03Brad KingNote Added: 0037225
2014-11-14 15:03Brad KingAssigned To => Brad King
2014-11-14 15:03Brad KingStatusnew => resolved
2014-11-14 15:03Brad KingResolutionopen => fixed
2014-11-14 15:03Brad KingFixed in Version => CMake 3.1
2014-11-14 15:03Brad KingTarget Version => CMake 3.1
2015-04-06 09:07Robert MaynardNote Added: 0038445
2015-04-06 09:07Robert MaynardStatusresolved => closed

Notes
(0037205)
Brad King   
2014-11-13 08:51   
This is due to logic here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalGenerator.cxx;hb=v3.0.2#l2402 [^]

originally added here:

 When building CMake itself, use the new cmake to install so that the current cmake can be overwritten.
 http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94847d0a [^]

Clearly this should not be done when cross-compiling.
(0037207)
Brad King   
2014-11-13 09:01   
Please try this fix:

 Do not use just-built CMake to install itself when cross-compiling
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15f55cca [^]
(0037225)
Brad King   
2014-11-14 15:03   
Re 0015248:0037207: I've merged this fix to the 'release' branch for inclusion in the next 3.1 release candidate.
(0038445)
Robert Maynard   
2015-04-06 09:07   
Closing resolved issues that have not been updated in more than 4 months.