When building OpenBLAS on OSX, the link line generated contains around 350K of
text, and the max supported arg length is
getconf ARG_MAX - returns 262144.
This causes the link phase to abort with
Error running link command: Argument list too long
The reason for the problem is that many libraries of Type OBJECT are built and
produce huge numbers of object files are then added to one very large list
which is then passed to the linker.
I implemented a simple(ish) fix, that doesn't quite work - for each
subdirectory that generates object files, I set the CMAKE_FILES_DIRECTORY and
specify the binary directory where the build should go using a single character
counter 0,1,2,3,4 which is much shorter than the target name and it reduces the
final arg size down almost enough
set(COUNTER_ 0)
foreach (SUBDIR ${SUBDIRS})
set(CMAKE_FILES_DIRECTORY "/${COUNTER_}")
add_subdirectory(${SUBDIR} ${CMAKE_BINARY_DIR}/${COUNTER_})
.....
MATH(EXPR COUNTER_ "${COUNTER_}+1")
endforeach ()
example : make driver_level2 target
[ 0%] Building C object
OpenBLAS/driver/level2/CMakeFiles/driver_level2.dir/CMakeFiles/ssbmv_U.c.o
becomes
[ 0%] Building C object 1/CMakeFiles/driver_level2.dir/1/ssbmv_U.c.o
and the link line is correspondingly shorter as the driver_level2 has been
replaced in 2 places. The problem is that there is still an extra
"CMakeFiles/driver_level2.dir" in the path to the object file that I would like
to shorten/remove.
How can I do that?
NB. I am aware that I can turn the OBJECT libraries into normal libraries and
link them conventionally, but I'd like to make this path shortening method work.
Thanks
JB
--
John Biddiscombe, email:biddisco @.at.@ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Trevano 131, 6900 Lugano, Switzerland | Fax: +41 (91) 610.82.82
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake