[cmake-developers] [CMake 0013332]: Can't link a shared library with cc on HP-UX

Mantis Bug Tracker mantis at public.kitware.com
Wed Jun 20 15:48:06 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13332 
====================================================================== 
Reported By:                Daniel R. Gomez
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13332
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-06-20 15:48 EDT
Last Modified:              2012-06-20 15:48 EDT
====================================================================== 
Summary:                    Can't link a shared library with cc on HP-UX
Description: 
Bootstrapping 2.8.8 on HP-UX 11.00 with the vendor compiler fails with

[...]
Linking C shared module libcmsysTestDynload.sl
cd /tmp/cmake-2.8.8-test/_build-cc/Source/kwsys &&
/tmp/cmake-2.8.8-test/_build-cc/Bootstrap.cmk/cmake -E cmake_link_script
CMakeFiles/cmsysTestDynload.dir/link.txt --verbose=1
/opt/ansic/bin/cc  +Z -Ae +DA2.0 +ESlit +w1 -z -Wp,-H262144 +O2   
-Wl,-E,+nodefaultrpath -b -L/usr/lib -Wl,+hlibcmsysTestDynload.sl -o
libcmsysTestDynload.sl CMakeFiles/cmsysTestDynload.dir/testDynload.c.o
-Wl,+b/usr/lib 
cc: warning 488: "cc +help" invokes On-Line C reference manual.
cc: warning 422: Unknown option "b" ignored.
/usr/ccs/bin/ld: Unsatisfied symbols:
   main (Not referenced yet! Probably due to -u option)
gmake[2]: *** [Source/kwsys/libcmsysTestDynload.sl] Error 1
gmake[2]: Leaving directory `/tmp/cmake-2.8.8-test/_build-cc'
gmake[1]: *** [Source/kwsys/CMakeFiles/cmsysTestDynload.dir/all] Error 2
gmake[1]: Leaving directory `/tmp/cmake-2.8.8-test/_build-cc'
gmake: *** [all] Error 2


For one, that -b needs to be a -Wl,-b. If I do the compiler invocation that way,
I get

host:/tmp/cmake-2.8.8-test/_build-cc/Source/kwsys$ /opt/ansic/bin/
cc +Z -Ae +DA2.0 +ESlit +w1 -z -Wp,-H262144 +O2 -Wl,-E,+nodefaultrpath -Wl,-b -L
/usr/lib -Wl,+hlibcmsysTestDynload.sl -o libcmsysTestDynload.sl CMakeFiles/cmsys
TestDynload.dir/testDynload.c.o -Wl,+b/usr/lib
/usr/ccs/bin/ld: CODE_ONE_SYM fixup to non-code subspace in file
/opt/langtools/lib/crt0.o - shared library must be position independent. Use +z
or +Z to recompile.


Adding -v to that gives me

cc: NLSPATH is /opt/ansic/lib/nls/msg/%L/%N.cat:/opt/ansic/lib/nls/msg/C/%N.cat:
cc: CCOPTS is not set.
cc: INCLUDIR is INCLUDIR=/usr/include
cc: LPATH is /usr/lib:/opt/langtools/lib:
/usr/ccs/bin/ld /opt/langtools/lib/crt0.o -u main -z -E +nodefaultrpath -b
-L/usr/lib +hlibcmsysTestDynload.sl -o libcmsysTestDynload.sl
CMakeFiles/cmsysTestDynload.dir/testDynload.c.o +b/usr/lib -lc 
cc: Entering Link editor.
/usr/ccs/bin/ld: CODE_ONE_SYM fixup to non-code subspace in file
/opt/langtools/lib/crt0.o - shared library must be position independent. Use +z
or +Z to recompile.


I don't know how crt0.o is getting in there, but if I invoke ld directly without
that, the link works. There is probably an option that can be given to cc(1) so
that it doesn't pass crt0.o to the linker, but I'm not seeing anything along
those lines in the man page...
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-06-20 15:48 Daniel R. GomezNew Issue                                    
======================================================================




More information about the cmake-developers mailing list