I've just moved from CMake 2.8.6 to 3.3.2 and creation of static libraries is now failing. I've localised the problem as far as the generated link.txt linker script. With 2.8 it begins with:

/usr/bin/ar cr target/usr/local/lib/libhadoop.a

with 3.3.2 it begins with:

/usr/bin/ar cq target/usr/local/lib/libhadoop.a -m64

The "-m64" flag is used to tell the compiler/linker to create 64-bit executables and is set via the following CMake variables:

CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_STATIC_LINKER_FLAGS

However "-m64" is not a valid "ar" flag. I haven't been able to find exactly how the linker flags are transmogrified into ar flags but I did find the following in Modules/CMakeCXXInformation.cmake:

if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE)
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()

But I'm struggling to understand when passing in linker flags to ar *ever* makes sense, at least on *nix platforms. And that code seems to be the same in 2.8.6 and 3.3.2 so it doesn't explain why the incorrect flags to ar have appeared in 3.3.2.

This looks like a bug to me...

--
Alan Burlison
--
--

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

Reply via email to