Regarding branch stage/add-link-search-static-properties-defaults

When working on a recent branch to allow default initialization of the
target properties LINK_SEARCH_(START|END)_STATIC with a corresponding
CMAKE_* variable, I encountered what I believe to be a bug in how the HP-UX
toolchains are getting used.  When merging for testing, the HP-UX
dashboards bombed out:
https://open.cdash.org/viewTest.php?onlyfailed&buildid=3947999 .  The
repeated error is:

[ 17%] Linking C shared library impl/libtestExe2libImp.sl
cc: warning 901: unknown option: `-a': use +help for online documentation.
cc: warning 1913: `default' does not exist or cannot be read
ld: I/O error, file "default": No such file or directory

>From looking in the Platform/HP-UX.cmake file, the cause of this looks to
be:

# Initialize C and CXX link type selection flags.  These flags are# used
when building a shared library, shared module, or executable# that links to
other libraries to select whether to use the static or# shared versions of
the libraries.  *Note that C modules and shared# libs are built using ld
directly so we leave off the "-Wl," portion.*



*foreach(type SHARED_LIBRARY SHARED_MODULE)
set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive")
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default")endforeach()*
foreach(type EXE)
  set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")
  set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")
endforeach()
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
  set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive")
  set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default")
endforeach()

The comment explains that the linker is used directly for C shared
libraries but for C executables and C++ executables, shared libraries, and
modules, the compiler is used to invoke the linker.  Hence for C shared
libs, -a archive, instead of -Wl,-a archive.  Based of the error message
though, it looks like the C compiler is getting
used as the linker for shared libs and not the linker directly.  So, I ask
you HP-UX devs, which one of the following would be the appropriate fix:

   1. Assume that using the C compiler as the linker is correct so fix the
   documentation and just set the C link flags to use -Wl,-a instead of -a
   2. Assume that the docs in the HP-UX platform file are correct and make
   CMake start using the linker directly for C shared libs
   3. Something else not described by 1 or 2

Thanks for the input

- Chuck
-- 

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

Reply via email to