Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
Hi, I identify the root of the problem: if I specify version 3.4 in cmake_minimum_required, generated link command (stored in file link.txt) for an executable does not contains value specified in variable CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS. Specifying 3.3 fix the problem. So this is a regression introduced in 3.4. Problem can be reproduced using this very simple CMakeLists.txt: cmake_minimum_required (VERSION 3.4) project (TEST LANGUAGES CXX) file (WRITE test.cpp "// empty\n") add_executable (test_exe test.cpp) This problem occurs on all platforms (tested on AIX and Linux). Marc On 09/12/15 15:41, "cmake-developers on behalf of CHEVRIER, Marc"wrote: > >Oops ! >You are right, on a simple example, all is OK. So the problem seems on my side. >I will investigate this curious behaviour… > >Sorry for the noise. > >Marc > > > > >On 09/12/15 15:15, "Brad King" wrote: > >>On 12/09/2015 09:09 AM, CHEVRIER, Marc wrote: >>> You are right. I missed this capability. >>> My first idea was to apply to exec the same approach as for shared lib but >>> I didn’t found appropriate variable: something like >>> CMAKE_EXE_CREATE__FLAGS >>> Or may be CMAKE_EXE_LINKER_FLAGS_INIT can be used but I am not sure of the >>> usage of the *_INIT variables. >> >>Actually the old code has it in two places: >> >>> - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # >>> -shared >>> - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS >>> "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib >> >>The CREATE_ value is used when linking a shared library itself. >>The LINK_ value is used to link executables. Both should already >>be getting the flag with no changes. >> >>-Brad >> >-- > >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-developers -- 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-developers
Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
On 12/10/2015 04:03 AM, CHEVRIER, Marc wrote: > I identify the root of the problem: if I specify version 3.4 in > cmake_minimum_required, generated link command (stored in file link.txt) > for an executable does not contains value specified in variable > CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS. Specifying 3.3 fix the problem. > So this is a regression introduced in 3.4. It is not technically a backward incompatibility because project code that worked in 3.3 will still work the same way in 3.4. Only after modifying the code to require 3.4 does the behavior change, but the new behavior is a regression. This is policy CMP0065: https://cmake.org/cmake/help/v3.4/policy/CMP0065.html introduced here: CMP0065: Restrict the use of CMAKE_SHARED_LIBRARY_LINK__FLAGS https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9784af1b The bug is that CMAKE_SHARED_LIBRARY_LINK__FLAGS is intended to be equivalent to "-rdynamic" on Linux, but the AIX platform file is using it for other flags too: > set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") This should be just set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") and the `-Wl,-brtl,-bnoipath` flags should move elsewhere. One could add them directly to the CMAKE_${lang}_LINK_EXECUTABLE command line, for example. Thanks, -Brad -- 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-developers
Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
Ok. I see the problem. Thanks for your investigation. I will work on that and submit a patch to solve this problem. Marc On 10/12/15 14:42, "Brad King"wrote: >On 12/10/2015 04:03 AM, CHEVRIER, Marc wrote: >> I identify the root of the problem: if I specify version 3.4 in >> cmake_minimum_required, generated link command (stored in file link.txt) >> for an executable does not contains value specified in variable >> CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS. Specifying 3.3 fix the problem. >> So this is a regression introduced in 3.4. > >It is not technically a backward incompatibility because project code >that worked in 3.3 will still work the same way in 3.4. Only after >modifying the code to require 3.4 does the behavior change, but the >new behavior is a regression. This is policy CMP0065: > > https://cmake.org/cmake/help/v3.4/policy/CMP0065.html > >introduced here: > > CMP0065: Restrict the use of CMAKE_SHARED_LIBRARY_LINK__FLAGS > https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9784af1b > >The bug is that CMAKE_SHARED_LIBRARY_LINK__FLAGS is intended >to be equivalent to "-rdynamic" on Linux, but the AIX platform file >is using it for other flags too: > >> set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") > >This should be just > > set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") > >and the `-Wl,-brtl,-bnoipath` flags should move elsewhere. One could >add them directly to the CMAKE_${lang}_LINK_EXECUTABLE command line, >for example. > >Thanks, >-Brad > -- 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-developers
Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
On 12/09/2015 09:09 AM, CHEVRIER, Marc wrote: > You are right. I missed this capability. > My first idea was to apply to exec the same approach as for shared lib but I > didn’t found appropriate variable: something like > CMAKE_EXE_CREATE__FLAGS > Or may be CMAKE_EXE_LINKER_FLAGS_INIT can be used but I am not sure of the > usage of the *_INIT variables. Actually the old code has it in two places: > - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared > - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") > # +s, flag for exe link to use shared lib The CREATE_ value is used when linking a shared library itself. The LINK_ value is used to link executables. Both should already be getting the flag with no changes. -Brad -- 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-developers
Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
On 12/09/2015 08:02 AM, CHEVRIER, Marc wrote: > Attached is a patch for AIX enabling correct generation of executables > regarding runtime path handling (currently, build paths could be stored > as part of installed executables): option -bnoipath is required for > executables link command (currently, only shared libs link command > get -bnoipath option). Thanks. I agree that -bnoipath should be used for all linking because we never want the path to a library file to be encoded in its dependents. However, the proposed patch moves the flag over to the flags used to specify the RPATH. These may not be used if CMAKE_SKIP_RPATH or similar options are enabled. We should find another place for the flag that is always used for both shared libraries and executables. Thanks, -Brad -- 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-developers
Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
Oops ! You are right, on a simple example, all is OK. So the problem seems on my side. I will investigate this curious behaviour… Sorry for the noise. Marc On 09/12/15 15:15, "Brad King"wrote: >On 12/09/2015 09:09 AM, CHEVRIER, Marc wrote: >> You are right. I missed this capability. >> My first idea was to apply to exec the same approach as for shared lib but I >> didn’t found appropriate variable: something like >> CMAKE_EXE_CREATE__FLAGS >> Or may be CMAKE_EXE_LINKER_FLAGS_INIT can be used but I am not sure of the >> usage of the *_INIT variables. > >Actually the old code has it in two places: > >> - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared >> - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS >> "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib > >The CREATE_ value is used when linking a shared library itself. >The LINK_ value is used to link executables. Both should already >be getting the flag with no changes. > >-Brad > -- 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-developers
Re: [cmake-developers] [CMake][PATCH] AIX RPATH handling
You are right. I missed this capability. My first idea was to apply to exec the same approach as for shared lib but I didn’t found appropriate variable: something like CMAKE_EXE_CREATE__FLAGS Or may be CMAKE_EXE_LINKER_FLAGS_INIT can be used but I am not sure of the usage of the *_INIT variables. Marc On 09/12/15 15:00, "Brad King"wrote: >On 12/09/2015 08:02 AM, CHEVRIER, Marc wrote: >> Attached is a patch for AIX enabling correct generation of executables >> regarding runtime path handling (currently, build paths could be stored >> as part of installed executables): option -bnoipath is required for >> executables link command (currently, only shared libs link command >> get -bnoipath option). > >Thanks. I agree that -bnoipath should be used for all linking because >we never want the path to a library file to be encoded in its dependents. >However, the proposed patch moves the flag over to the flags used to >specify the RPATH. These may not be used if CMAKE_SKIP_RPATH or similar >options are enabled. We should find another place for the flag that >is always used for both shared libraries and executables. > >Thanks, >-Brad > -- 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-developers