[CMake] crosscompiling problems on XP

kitts kitts.mailinglists at gmail.com
Thu Mar 1 23:18:30 EST 2007


On Thursday 01 Mar 2007 IST, Kishore, Jonnalagadda (IE10) wrote:
> I have recently tried porting a project to CMake but I am facing a few
> issues when cross-compiling
>
> The project can be compiled with a varying set of compilers (already
> works with our custom makefiles) and currently the only option seems to
> be passing this information along with the cmake command. This fails with
> different errors when executed from within the cygwin shell or the
> windows command prompt.
>
> I am doing a simple test with just two files.
>
> main.c:
> 	main()
> 	{
> 	}
>
> CMakeLists.txt:
> 	PROJECT(test)
> 	ADD_EXECUTABLE(test main.c)
>
> In the cygwin shell I get;
> $ cmake -DCMAKE_C_COMPILER=avr-gcc -DCMAKE_CXX_COMPILER=avr-g++ -G "Unix
> Makefi les" .
> -- Check for working C compiler: avr-gcc
> -- Check for working C compiler: avr-gcc -- broken
> CMake Error: The C compiler "avr-gcc" is not able to compile a simple
> test progr am.
> It fails with the following output:
>  make: Warning: File `CMakeFiles/progress.make' has modification time
> 0.24 s in the future
> /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
> CMakeFiles/cmTryComp ileExec.dir/build
> make[1]: Entering directory
> `/cygdrive/e/temp/cmake_test/CMakeFiles/CMakeTmp' make[1]: Warning: File
> `CMakeFiles/cmTryCompileExec.dir/flags.make' has modifica tion time 0.19
> s in the future
> c:/Program\ Files/CMake\ 2.4/bin/cmake.exe -E cmake_progress_report
> e:/temp/cmak e_test/CMakeFiles/CMakeTmp/CMakeFiles 1
> ←[32mBuilding C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.obj
> ←[0mc:/WinAVR/bin/avr-gcc.exe   -o
> CMakeFiles/cmTryCompileExec.dir/testCCompiler .obj   -c
> e:/temp/cmake_test/CMakeFiles/CMakeTmp/testCCompiler.c ←[31m←[1mLinking C
> executable cmTryCompileExec.exe
> ←[0mc:/Program\ Files/CMake\ 2.4/bin/cmake.exe -P
> CMakeFiles/cmTryCompileExec.di r/cmake_clean_target.cmake
> c:/WinAVR/bin/avr-gcc.exe        
> "CMakeFiles/cmTryCompileExec.dir/testCCompiler .obj"   -o
> cmTryCompileExec.exe -Wl,--major-image-version,0,--minor-image-versio n,0
> c:\winavr\bin\..\lib\gcc\avr\4.1.1\..\..\..\..\avr\bin\ld.exe:
> unrecognized opti on '--major-image-version'
> c:\winavr\bin\..\lib\gcc\avr\4.1.1\..\..\..\..\avr\bin\ld.exe: use the
> --help op tion for usage information
> make[1]: *** [cmTryCompileExec.exe] Error 1
> make[1]: Leaving directory
> `/cygdrive/e/temp/cmake_test/CMakeFiles/CMakeTmp' make: ***
> [cmTryCompileExec/fast] Error 2
>
>
> CMake will not be able to correctly generate this project.
> -- Configuring done
>
> Then I delete all the other files generated by cmake, open 'cmd' and here
> is get;
>
> E:\temp\cmake_test>cmake -DCMAKE_C_COMPILER=avr-gcc
> -DCMAKE_CXX_COMPILER=avr-g++ -G "Unix Makefiles" .
> -- Check for working C compiler: avr-gcc
> -- Check for working C compiler: avr-gcc -- broken
> CMake Error: The C compiler "avr-gcc" is not able to compile a simple
> test progr am.
> It fails with the following output:
>  C:/WinAVR/utils/bin/make.exe -f
> CMakeFiles/cmTryCompileExec.dir/build.make CMak
> eFiles/cmTryCompileExec.dir/build
> make.exe[1]: Entering directory `E:/temp/cmake_test/CMakeFiles/CMakeTmp'
> C:/Program\ Files/CMake\ 2.4/bin/cmake.exe -E cmake_progress_report
> E:/temp/cmak e_test/CMakeFiles/CMakeTmp/CMakeFiles 1
> /usr/bin/sh: -c: line 3: syntax error: unexpected end of file
> make.exe[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCCompiler.obj]
> Error 258 make.exe[1]: Leaving directory
> `E:/temp/cmake_test/CMakeFiles/CMakeTmp' make.exe: ***
> [cmTryCompileExec/fast] Error 2
>
>
> CMake will not be able to correctly generate this project.
> -- Configuring done
>
> I have also tried to do the same thing on a Linux box where it works as
> expected. Cmake passes when I do not issue '-G "Unix Makefiles"' but then
> the compiler used is cl and not the intended avr-gcc. For various
> reasons, I cannot use the Linux box for the build.
>
> What is the solution to this?
>
> Warm regards,
> Kishore

I even tried setting the C, CXX and linker flags to a blank but i still 
could not avoid -
> c:/WinAVR/bin/avr-gcc.exe        
> "CMakeFiles/cmTryCompileExec.dir/testCCompiler .obj"   -o
> cmTryCompileExec.exe -Wl,--major-image-version,0,--minor-image-versio n,0
> c:\winavr\bin\..\lib\gcc\avr\4.1.1\..\..\..\..\avr\bin\ld.exe:
> unrecognized opti on '--major-image-version'

Is there something i am doing wrong? Everything works fine when i use the 
native compiler 'gcc' instead of 'avr-gcc'.

But then as i have mentioned... it works fine on a linux box.
-- 
Warm regards,
Kishore


More information about the CMake mailing list