[CMake] Linker command line length issues when cross-compiling from Windows->Linux

Eric Gross eric.gross at ni.com
Tue Feb 5 20:46:10 EST 2013


Hi,

I'm using CMake 2.8.10.2 with the "Unix Makefiles" generator on Windows 
and cross-compiling for Linux using GCC. I have Cygwin in the path for 
make/sh/etc.

To cross compile I have the following items set:
CMAKE_SYSTEM_NAME:STRING=Linux
CMAKE_CXX_COMPILER:STRING=<path to cross-compiler gcc>
CMAKE_C_COMPILER:STRING=<path to cross-compiler gcc>

This process works perfectly with the exception of some larger components 
that have a few hundred object files to link in. When linking those larger 
components I get an error about unterminated quotes from sh.exe. By 
cutting down the number of objects I have deduced that I am reaching the 
command line length limits of Cygwin's sh.exe (or possibly OS limits).

It appears that the generated Makefiles are passing all the objects on the 
command line rather than using a response file. Googling the CMake email 
lists seems to indicate that on Windows this is worked around already in 
the platform-specific files used by CMake and it uses a response file 
there. I'm guessing that code is not being used here for me because I am 
cross-compiling. Is this correct? Is there any way to force it to use that 
same mechanism?

I thought about trying the "MinGW Makefiles" generator which appears to 
use cmd.exe, but it does not allow Cygwin's sh.exe to be in the path and 
our larger build system that calls into CMake requires it. I'm also not 
clear if it would expect to use the MinGW version of GCC rather than the 
cross-compiler GCC.

Any ideas?

Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130205/497d2231/attachment-0001.htm>


More information about the CMake mailing list