[CMake] Cross-compiling: Cmake compiler and ABI check don´t work / TRY_COMPILE and EXECUTABLE_SUFFIX problem

Schmid Alexander A.Schmid at de.ccv.eu
Mon Feb 21 07:55:25 EST 2011


> -----Ursprüngliche Nachricht-----
> Von: David Cole [mailto:david.cole at kitware.com]
> Gesendet: Montag, 21. Februar 2011 13:41
> An: Schmid Alexander
> Cc: a.neundorf-work at gmx.net; cmake at cmake.org
> Betreff: Re: [CMake] Cross-compiling: Cmake compiler and ABI check don´t work /
> TRY_COMPILE and EXECUTABLE_SUFFIX problem
> 
> On Mon, Feb 21, 2011 at 2:14 AM, Schmid Alexander <A.Schmid at de.ccv.eu>
> wrote:
> > On Friday 18 February 2011, Schmid Alexander wrote:
> >> Hi,
> >>
> >> of course, I´d like to have you think further about it, so here you go...
> >
> > ;-)
> >
> >> This is the toolchain file I use.
> >> The specialty about is that I want to use the ARMCC as compiler and an
> >> SDK-provided linker tool for linking.
> >>
> >> # this one is important
> >> SET( CMAKE_SYSTEM_NAME Generic )
> >> # this one not so much
> >> SET( CMAKE_SYSTEM_VERSION 1 )
> >>
> >> #
> >> ---------------------------------------------------------------------------
> >>------ # setup local variables used
> >> #
> >> ---------------------------------------------------------------------------
> >>------
> >>
> >> SET( SDK1_ROOT "$ENV{PROJ_ROOT}\\tools\\Sdk1" )
> >> message( STATUS "The SDK1 can be found at ${SDK1_ROOT}" )
> >> SET( SDK1_INCLUDE "${SDK1_ROOT}/include" )
> >> STRING( REPLACE "\\" "/" SDK1_INCLUDE ${SDK1_INCLUDE} )
> >> SET( SDK1_LIB "${SDK1_ROOT}/lib" )
> >> STRING( REPLACE "\\" "/" SDK1_LIB ${SDK1_LIB} )
> >>
> >> SET( SDK2_ROOT "$ENV{PROJ_ROOT}\\tools\\Sdk2" )
> >> message( STATUS "The SDK2 can be found at ${SDK2_ROOT}" )
> >> SET( SDK2_INCLUDE "${SDK2_ROOT}/include" )
> >> STRING( REPLACE "\\" "/" SDK2_INCLUDE ${SDK2_INCLUDE} )
> >> SET( SDK2_LIB "${SDK2_ROOT}/lib" )
> >> STRING( REPLACE "\\" "/" SDK2_LIB ${SDK2_LIB} )
> >>
> >> SET( RVCT40_BIN "$ENV{RVCT40BIN}" )
> >> message( STATUS "The ARM Tools can be found at ${RVCT40_BIN}" )
> >
> >
> > Does it work if you replace the all the $ENV{}s with hardcoded paths ?
> > Please try that and let me know if it works then, so we can figure out a
> > solution.
> >
> > Alex
> >
> >
> >>>>
> >
> > Hi Alex,
> >
> > replacing doesn´t work.
> > I also did some further investigation and it led me to a different problem, that may
> be the reason for all this.
> >
> > I think that the TRY_COMPILE macro of Cmake does not respect the
> CMAKE_EXECUTABLE_SUFFIX that I have set to ".out".
> > So the TRY_COMPILE does not find the correctly built output file and further
> processing fails.
> >
> > Here´s the output of CMAKE:
> > -- Check for working CXX compiler:
> C:/Programme/ARM/RVCT/Programs/4.0/436/multi1/win_32-pentium/armcc.exe
> > -- Check for working CXX compiler:
> C:/Programme/ARM/RVCT/Programs/4.0/436/multi1/win_32-pentium/armcc.exe --
> works
> > -- Detecting CXX compiler ABI info
> > CMake Error: Could not COPY_FILE.
> >  OutputFile: ''
> >    copyFile:
> 'D:/proj/build/test2/CMakeFiles/CMakeDetermineCompilerABI_CXX.bin'
> >
> > Unable to find executable for try_compile: tried
> "D:/proj/build/test2/CMakeFiles/CMakeTmp/cmTryCompileExec" and "D:/proj/build
> > /test2/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec" and
> "D:/proj/build/test2/CMakeFiles/CMakeTmp/Development/cmTryCompileExec".
> >
> > -- Suffix is:
> > -- Output is:
> >
> > As you can see, I manually added the last to MESSAGEs to the
> CmakeDetermineCompilerAbi.cmake that was shipped with Cmake 2.8.3.
> >
> > When I add the line
> > SET( CMAKE_EXECUTABLE_SUFFIX .out )
> > In that file, the ABI check seems to work. So the big question is how to make
> Cmake use the CMAKE_EXECUTABLE_SUFFIX that was given in the toolchain
> file?
> >
> > Regards,
> > Alex
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> >
> 
> CMAKE_EXECUTABLE_SUFFIX is not intended to be "settable"... That's
> completely unexpected from the CMake development team's point of view.
> I'm not surprised that it doesn't work.
> 
> Why do you need to set it?

Hi David,

thanks for participating!

I did some tests and from my point of view you are right - I do not have to set it at all. 
But, nevertheless, the problem stays. 
The crosscompiling toolchain produces binary files with .out suffix, and for me it seems that the the TRY_COMPILE macro does not recognize this file as the result of the building step.
Can you please give me some help what I can do to get it working?



More information about the CMake mailing list