[CMake] Problems setting -ar -ranlib and other binutils

Alexander Neundorf a.neundorf-work at gmx.net
Wed Oct 22 15:36:25 EDT 2008


On Tuesday 21 October 2008, larrysb at aol.com wrote:
> I'm using cmake 2.6.1 under Ubuntu Linux to cross compile for a target. I
> have a toolchain file which sets the full paths to the cross compiler
> binaries.The c-compiler and c++ compiler always work and setup correctly
> and appear in the CMakeCache.txt file. However, the other binutils, such as
> 'ar', 'ranlib', 'objcopy' and so on, just show up as blank entries in the
> CMakeCache.txt file.
...
> I'm stumped at this point and I need to get this cleaned up so the rest of
> my team can check out and build the code without manually fussing around
> with cmake-generated products first. 
>
>
>
>
> For instance: 
>
>
>
>
> Excerpt of cmake-toolchain file:
>
>
>
>
> Toolchain-arm-none-linux-gnueabi.cmake
>
>
>
>
>
>
> # specify the cross compiler
>
>
> SET(CMAKE_AR ${MY_CROSS_DIR}/${MY_CROSS_prefix}ar)
>
>
> SET(CMAKE_CXX_COMPILER ${MY_CROSS_DIR}/${MY_CROSS_prefix}c++)
>
>
> SET(CMAKE_C_COMPILER   ${MY_CROSS_DIR}/${MY_CROSS_prefix}gcc)

You should only need to set these two, all the others should then be found 
automatically.
If that doesn't work (it's only done on the first cmake run), I suggest you 
insert some debug output into Modules/CMakeFindBinUtils.cmake and check the 
values of _CMAKE_TOOLCHAIN_PREFIX and _CMAKE_TOOLCHAIN_LOCATION.
They should be properly extracted from the given compiler paths.
If not, please send the output you get.

Alex


More information about the CMake mailing list