Hi,
I get a link error when linking a shared C library on HP-UX using gcc.
the compiler complains about:
---
Linking C shared library libxgentls.sl
gcc: archive: No such file or directory
gcc: default: No such file or directory
---
the command line of the link (link.txt in the build directory) is:
---
/space/opt/hp-gcc-4.2.1/bin/gcc  -fPIC -g  
-L/GenSpace/mhufer/xgen-head/external/HP-UX/tcl-8.5/lib 
-L/GenSpace/mhufer/xgen-head/external/HP-UX/openssl-0.9.8h/lib 
-L/GenSpace/mhufer/xgen-head/external/HP-UX/openssl-0.9.8h/lib -shared 
-Wl,-E,-b,
+nodefaultrpath -Wl,+hlibxgentls.sl.1.5.2 -o libxgentls.sl.1.5.2 
CMakeFiles/xgentls.dir/tls.o CMakeFiles/xgentls.dir/tlsBIO.o 
CMakeFiles/xgentls.dir/tlsIO.o 
CMakeFiles/xgentls.dir/tlsX509.o -L/GenSpace/mhufer/xgen-head/lib/HP-UX -a 
archive -ltclstub8.5 -a default -lssl -lcrypto -Wl,
+b/GenSpace/mhufer/xgen-head/lib/HP-UX 
---
The '-a archive' and '-a default' arguments are clearly wrong here! 

In the share/cmake-2.6/Modules/Platform/HP-UX.cmake
the comment:
---
# 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(type)
---
is clearly wrong as the link.txt generated by cmake clearly calls the compiler 
(gcc) NOT ld directly as the writer of the note in the comment believed! It 
may be a native HP compiler vs. gcc difference, thought. 

I changed the offending lines in HP-UX.cmake to 
--
FOREACH(type SHARED_LIBRARY SHARED_MODULE)
  SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")
  SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")
ENDFOREACH(type)
--
and it now links fine.
---
bash> cmake --version
cmake version 2.6-patch 1
---
Note:
This issue seems to be related to Bug report 158 in the cmake bug tracker.

Regards,
-- 
Michael Hufer
Software Developer
--------------------------------
Swissrisk Financial Systems

www.swissrisk.com
-------------------------------
Swissrisk Financial Systems GmbH
Sitz / Registered Office: Holzhausenstrasse 44, 60322 Frankfurt/Main
HRB-Nr. / Commercial Register No.  83397
Geschäftsführer / Managing Directors: Dr. Peter Marshall, Jürgen Dahmen, 
Andreas Wagner, Peter Hemmer
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to