<div dir="ltr">Regarding branch stage/add-link-search-static-properties-defaults<br><br>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: <a href="https://open.cdash.org/viewTest.php?onlyfailed&buildid=3947999">https://open.cdash.org/viewTest.php?onlyfailed&buildid=3947999</a> . The repeated error is:<br><span style="font-family:monospace,monospace"><br>[ 17%] Linking C shared library impl/libtestExe2libImp.sl<br>cc: warning 901: unknown option: `-a': use +help for online documentation. <br>cc: warning 1913: `default' does not exist or cannot be read<br>ld: I/O error, file "default": No such file or directory</span><br><br>From looking in the Platform/HP-UX.cmake file, the cause of this looks to be:<br><br><span style="font-family:monospace,monospace"># 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. <b>Note that C modules and shared# libs are built using ld directly so we leave off the "-Wl," portion.</b><br><b>foreach(type SHARED_LIBRARY SHARED_MODULE)<br> set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive")<br> set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default")<br>endforeach()</b><br>foreach(type EXE)<br> set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")<br> set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")<br>endforeach()<br>foreach(type SHARED_LIBRARY SHARED_MODULE EXE)<br> set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive")<br> set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default")<br>endforeach()</span><br><br>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, <span style="font-family:monospace,monospace">-a archive</span>, instead of <span style="font-family:monospace,monospace">-Wl,-a archive</span>. Based of the error message though, it looks like the C compiler is getting<br>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:<br><ol><li>Assume that using the C compiler as the linker is correct so fix the documentation and just set the C link flags to use -<span style="font-family:monospace,monospace">Wl,-a</span> instead of <span style="font-family:monospace,monospace">-a</span></li><li>Assume that the docs in the HP-UX platform file are correct and make CMake start using the linker directly for C shared libs</li><li>Something else not described by 1 or 2</li></ol><p>Thanks for the input</p><p>- Chuck<br></p><br></div>