View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010571CMakeCMakepublic2010-04-16 17:022010-09-10 00:00
ReporterDaniel Richard G. 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.3Fixed in VersionCMake 2.8.3 
Summary0010571: Broken binaries on HP-UX
DescriptionBuilding CMake 2.8.1 on a 32-bit PA-RISC HP-UX B.11.00 system stops with this:

[ 97%] Building CXX object Source/CMakeFiles/ctest.dir/ctest.o
Linking CXX executable ../bin/ctest
[ 97%] Built target ctest
Scanning dependencies of target documentation
[ 97%] Generating ../Docs/ctest.txt
/usr/lib/dld.sl: Can't open shared library: libc.2
/usr/lib/dld.sl: No such file or directory
/bin/sh: 14184 Abort
gmake[2]: *** [Docs/ctest.txt] Error 134
gmake[1]: *** [Utilities/CMakeFiles/documentation.dir/all] Error 2
gmake: *** [all] Error 2

Something odd is up here:

user@host:/tmp/cmake-build/bin> ./cmake -h
/usr/lib/dld.sl: Can't open shared library: libc.2
/usr/lib/dld.sl: No such file or directory
Abort
user@host:/tmp/cmake-build/bin> ldd cmake
/usr/lib/dld.sl: Can't open shared library: libc.2
/usr/lib/dld.sl: No such file or directory

Note, too, that the cmake binary built in the bootstrapping stage works correctly:

user@host:/tmp/cmake-build/Bootstrap.cmk> ./cmake -h
CMake Error: The source directory "/tmp/cmake-build/Bootstrap.cmk/-h" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
user@host:/tmp/cmake-build/Bootstrap.cmk> ldd cmake
        /usr/lib/libc.2 => /usr/lib/libc.2
        /usr/lib/libdld.2 => /usr/lib/libdld.2
        /usr/lib/libc.2 => /usr/lib/libc.2
        /usr/lib/libm.2 => /usr/lib/libm.2
TagsNo tags attached.
Attached Filespatch file icon cmake-10571-fix.patch [^] (466 bytes) 2010-04-22 13:56 [Show Content]

 Relationships

  Notes
(0020238)
Bill Hoffman (manager)
2010-04-17 12:28

Strange, we run a dashboard on one of those...

Can you remove one of the binaries, and do a make VERBOSE=1 and see what the link line looks like?
(0020244)
Daniel Richard G. (reporter)
2010-04-17 23:05

Way ahead of you.

Here is how the "cmake" binary is linked in bootstrapping:

tg-g++ -pipe -fmessage-length=0 -fno-for-scope -fno-rtti -W -Wall -Wcast-align -Wformat=2 -Wpointer-arith -Wundef -O3 -I/tmp/cmake-build/Bootstrap.cmk -I/tmp/cmake-2.8.1/Source -I/tmp/cmake-build/Bootstrap.cmk cmake.o cmakemain.o cmakewizard.o cmCommandArgumentLexer.o [lotsa object files] SystemTools.o ProcessUNIX.o String.o System.o -o cmake

And the link line when building normally, with VERBOSE=1:

/opt/tg/bin/tg-g++ -pipe -fmessage-length=0 -fno-for-scope -fno-rtti -W -Wall -Wcast-align -Wformat=2 -Wpointer-arith -Wundef -O3 CMakeFiles/cmake.dir/cmakemain.o -o ../bin/cmake -Wl,+s,-E,+nodefaultrpath libCMakeLib.a kwsys/libcmsys.a ../Utilities/cmexpat/libcmexpat.a ../Utilities/cmtar/libcmtar.a ../Utilities/cmcompress/libcmcompress.a ../Utilities/cmcurl/libcmcurl.a ../Utilities/cmzlib/libcmzlib.a -ldld

If I remove the +nodefaultrpath option, the resulting binary works. However, this is an option you want; from the ld(1) man page...

+[no]defaultrpath

    +defaultrpath is the default. Include any paths
    that are specified with -L in the embedded path,
    unless you specify the +b option. If you use +b,
    only the path list specified by +b is in the
    embedded path.

    The +nodefaultrpath option removes all library
    paths that were specified with the -L option from
    the embedded path. The linker searches the
    library paths specified by the -L option at link
    time. At run time, the only library paths
    searched are those specified by the environment
    variables LD_LIBRARY_PATH and SHLIB_PATH, library
    paths specified by the +b linker option, and
    finally the default library paths.

Now here's where things get a bit weird: If I perform the link manually with

    -Wl,+s,-E,+nodefaultrpath

changed to

    -Wl,+s,-E,+nodefaultrpath,+b,/usr/lib

(i.e. explicitly adding the default library path to the binary's rpath), then the resulting binary works. So it seems that this may be a bug in the linker, where +nodefaultrpath doesn't do the "finally the default library paths" bit as advertised.

$ ld -V
92453-07 linker command s800.sgs ld PA64 B.11.53 REL 060322
ld: 92453-07 linker linker ld B.11.53 060322
ld: Usage: ld [options] [flags] files

(One more thing... when linking normally, is the -ldld bit really necessary? I can drop it without consequence.)
(0020249)
Brad King (manager)
2010-04-19 08:15

Something similar happens on AIX. Look at Modules/Platform/AIX.cmake:

  # RPATH support on AIX is called libpath. By default the runtime
  # libpath is paths specified by -L followed by /usr/lib and /lib. In
  # order to prevent the -L paths from being used we must force use of
  # -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not.
  # When our own RPATH is to be added it may be inserted before the
  # "always" paths.
  SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib)

Does adding a line like this to HP-UX.cmake help?
(0020259)
Daniel Richard G. (reporter)
2010-04-19 13:53

I added

    SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib)

to the top of Modules/Platform/HP-UX.cmake, and with that, the build completes successfully.

(/lib is, of course, just a symlink to /usr/lib on this system.)
(0020356)
Daniel Richard G. (reporter)
2010-04-22 13:56

The attached patch, against 2.8.1, fixes this bug.
(0022103)
Magnus Sirviö (reporter)
2010-09-07 08:12

We hit the same issue when building CMake 2.8.2 on an HP-UX 11i system.
# uname -a
HP-UX xxxxx B.11.11 U 9000/800 538706567 unlimited-user license

The attached patch solved the problem.
(0022104)
Brad King (manager)
2010-09-07 08:50

Oops, looks like this issue's patch was missed when preparing 2.8.2. I've merged it to 'next' so it should be in 2.8.3:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11a917d0 [^]

 Issue History
Date Modified Username Field Change
2010-04-16 17:02 Daniel Richard G. New Issue
2010-04-17 12:28 Bill Hoffman Note Added: 0020238
2010-04-17 12:28 Bill Hoffman Status new => assigned
2010-04-17 12:28 Bill Hoffman Assigned To => Bill Hoffman
2010-04-17 23:05 Daniel Richard G. Note Added: 0020244
2010-04-19 08:15 Brad King Note Added: 0020249
2010-04-19 13:53 Daniel Richard G. Note Added: 0020259
2010-04-22 13:56 Daniel Richard G. File Added: cmake-10571-fix.patch
2010-04-22 13:56 Daniel Richard G. Note Added: 0020356
2010-09-07 08:12 Magnus Sirviö Note Added: 0022103
2010-09-07 08:34 Bill Hoffman Assigned To Bill Hoffman => Brad King
2010-09-07 08:50 Brad King Note Added: 0022104
2010-09-07 08:50 Brad King Status assigned => closed
2010-09-07 08:50 Brad King Resolution open => fixed
2010-09-10 00:00 David Cole Fixed in Version => CMake 2.8.3
2010-09-10 00:00 David Cole Target Version => CMake 2.8.3


Copyright © 2000 - 2018 MantisBT Team