MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015650 | CMake | CMake | public | 2015-07-14 07:07 | 2016-06-10 14:31 |
Reporter | Abigail | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | Apple Mac | OS | Mac OS X | OS Version | 10.10.3 |
Product Version | CMake 3.2.3 | ||||
Target Version | Fixed in Version | ||||
Summary | 0015650: Linking large files on OS X can result in linker failing with "command line too long" error | ||||
Description | When a project contains sufficiently many source files - the one I'm compiling has 1689 .cpp files - the linker will fail, with the message "Error running link command: Argument list too long". When using response lists (via set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)), the issue still occurs. This is because the response file is specified as a linker flag with @ResponseFile.rsp syntax, which is expanded by the compiler driver rather than being passed through and then expanded internally by the linker. OS X's linker, ld64, doesn't support the @ResponseFile.rsp syntax, so it's not possible to work around this with set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "-Wl,@"). However, it does support -filelist, but this requires the file to be newline-separated rather than space-separated. | ||||
Steps To Reproduce | In an empty directory: for i in {0000..9999}; echo "void f$i() {}" >> $i.c find . > files.txt cat << EOF > CMakeLists.txt cmake_minimum_required(VERSION 2.8) project(long_file_test) file(STRINGS "files.txt" files) add_executable(long_file_test ${files}) EOF cmake . && cmake --build . -- -j 24 ...This will compile everything correctly, and then at the end emit: [100%] Linking C executable long_file_test Error running link command: Argument list too long make[2]: *** [long_file_test] Error 2 make[1]: *** [CMakeFiles/long_file_test.dir/all] Error 2 make: *** [all] Error 2 | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-07-14 07:07 | Abigail | New Issue | |||
2015-07-14 09:19 | Abigail | Note Added: 0039136 | |||
2015-07-14 09:38 | Brad King | Note Added: 0039137 | |||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042808 | |||
2016-06-10 14:29 | Kitware Robot | Status | new => resolved | ||
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|