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

David Carricajo david.carricajo at gmail.com
Wed Feb 6 08:31:21 EST 2013


Hi Eric

On Wed, Feb 6, 2013 at 2:46 AM, Eric Gross <eric.gross at ni.com> wrote:

> 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).
>
> I've come across this limitation only for Cygwin, since you don't mention
where did you get CMake, it's a better approach to use the one provided by
the Cygwin distribution instead. As for MingGW, by using CMake 2.8.9 and
MinGW x86_64-w64-mingw32 (reads mingw 32 bits toolchain in windows to build
windows 64 bits apps) i was able to build projects i couldn't do with
Cygwin targeted Makefiles. I've no idea why Makefiles generated for cygwin
didn't use response files while MinGW ones did.


> 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?
>

No clue, i'm also interested.

>
> 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.
>
> You can use MinGW as well, you should generate "MSYS Makefiles", get rid
of cygwin in the %path% and use, if you don't feel like using cmd try the
MSYS  shell instead which is started by msys.bat. For CMake, depending on
the toolchain you choose you might have to manually set up CMake like this:

set CC=x86_64-w64-mingw32-gcc
set CXX=x86_64-w64-mingw32-g++
set AR=x86_64-w64-mingw32-ar
set LINKER=x86_64-w64-mingw32-ld
 ...
etc,
Regards


>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130206/f98852af/attachment.htm>


More information about the CMake mailing list