View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013497CMakeCMakepublic2012-08-30 10:342013-03-04 08:38
Reportermarled 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSLinuxOS VersionopenSuSE 11.4
Product VersionCMake 2.8.9 
Target VersionCMake 2.8.10Fixed in VersionCMake 2.8.10 
Summary0013497: CMAKE_SKIP_INSTALL_RPATH removes RPATH but leaves empty RUNPATH.
DescriptionHello,

I used the downloadable binary version of cmake for this test.

If I do not specify options for RPATH specific features, then the behaviour is the same - this is probably the default anyway.

My first question is that if this behaviour (= empty RUNPATH) is intendend?

Since I assume not, both fields, RPATH and RUNPATH, should always have the same contents or should both not exist at all. I could use CMAKE_BUILD_WITH_INSTALL_RPATH or CMAKE_SKIP_BUILD_RPATH which works around the problem, but then of course I would not be able to run programs from the build directory.

Thank you for your answer,

Martin Lederhilger
Steps To ReproducePlease see the test case in the attached tar.gz-file.

#CONFIGURATION, BUILDING AND INSTALLING:
frosch3:/home/lederhi/rpath/build $ cmake -DCMAKE_INSTALL_PREFIX=`pwd`/../install ..
-- The C compiler identification is GNU 4.5.0
-- The CXX compiler identification is GNU 4.5.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lederhi/rpath/build

frosch3:/home/lederhi/rpath/build $ make install
Scanning dependencies of target a
[ 33%] Building C object liba/CMakeFiles/a.dir/a.c.o
Linking C shared library liba.so
[ 33%] Built target a
Scanning dependencies of target b
[ 66%] Building C object libb/CMakeFiles/b.dir/b.c.o
Linking C shared library libb.so
[ 66%] Built target b
Scanning dependencies of target prg
[100%] Building C object CMakeFiles/prg.dir/prg.c.o
Linking C executable prg
[100%] Built target prg
Install the project...
-- Install configuration: ""
-- Installing: /home/lederhi/rpath/install/bin/prg
-- Removed runtime path from "/home/lederhi/rpath/install/bin/prg"
-- Installing: /home/lederhi/rpath/install/liba/liba.so
-- Installing: /home/lederhi/rpath/install/libb/libb.so
-- Removed runtime path from "/home/lederhi/rpath/install/libb/libb.so"

#IN THE BUILD DIRECTORY
frosch3:/home/lederhi/rpath/build $ readelf -d prg liba/liba.so libb/libb.so

File: prg

Dynamic section at offset 0xf08 contains 24 entries:
  Tag Type Name/Value
 0x00000001 (NEEDED) Shared library: [libb.so]
 0x00000001 (NEEDED) Shared library: [libc.so.6]
 0x0000000f (RPATH) Library rpath: [/home/lederhi/rpath/build/libb:/home/lederhi/rpath/build/liba:]
 0x0000001d (RUNPATH) Library runpath: [/home/lederhi/rpath/build/libb:/home/lederhi/rpath/build/liba:]
 0x0000000c (INIT) 0x804852c
 0x0000000d (FINI) 0x804871c
 0x00000004 (HASH) 0x80481c4
 0x6ffffef5 (GNU_HASH) 0x8048258
 0x00000005 (STRTAB) 0x80483d8
 0x00000006 (SYMTAB) 0x80482b8
 0x0000000a (STRSZ) 238 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000015 (DEBUG) 0x0
 0x00000003 (PLTGOT) 0x8049ff4
 0x00000002 (PLTRELSZ) 24 (bytes)
 0x00000014 (PLTREL) REL
 0x00000017 (JMPREL) 0x8048514
 0x00000011 (REL) 0x804850c
 0x00000012 (RELSZ) 8 (bytes)
 0x00000013 (RELENT) 8 (bytes)
 0x6ffffffe (VERNEED) 0x80484ec
 0x6fffffff (VERNEEDNUM) 1
 0x6ffffff0 (VERSYM) 0x80484c6
 0x00000000 (NULL) 0x0

File: liba/liba.so

Dynamic section at offset 0xf18 contains 22 entries:
  Tag Type Name/Value
 0x00000001 (NEEDED) Shared library: [libc.so.6]
 0x0000000e (SONAME) Library soname: [liba.so]
 0x0000000c (INIT) 0x30c
 0x0000000d (FINI) 0x478
 0x00000004 (HASH) 0x118
 0x6ffffef5 (GNU_HASH) 0x154
 0x00000005 (STRTAB) 0x230
 0x00000006 (SYMTAB) 0x190
 0x0000000a (STRSZ) 117 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000003 (PLTGOT) 0x1ff4
 0x00000002 (PLTRELSZ) 16 (bytes)
 0x00000014 (PLTREL) REL
 0x00000017 (JMPREL) 0x2fc
 0x00000011 (REL) 0x2dc
 0x00000012 (RELSZ) 32 (bytes)
 0x00000013 (RELENT) 8 (bytes)
 0x6ffffffe (VERNEED) 0x2bc
 0x6fffffff (VERNEEDNUM) 1
 0x6ffffff0 (VERSYM) 0x2a6
 0x6ffffffa (RELCOUNT) 1
 0x00000000 (NULL) 0x0

File: libb/libb.so

Dynamic section at offset 0xf00 contains 25 entries:
  Tag Type Name/Value
 0x00000001 (NEEDED) Shared library: [liba.so]
 0x00000001 (NEEDED) Shared library: [libc.so.6]
 0x0000000e (SONAME) Library soname: [libb.so]
 0x0000000f (RPATH) Library rpath: [/home/lederhi/rpath/build/liba:]
 0x0000001d (RUNPATH) Library runpath: [/home/lederhi/rpath/build/liba:]
 0x0000000c (INIT) 0x354
 0x0000000d (FINI) 0x4e8
 0x00000004 (HASH) 0x118
 0x6ffffef5 (GNU_HASH) 0x158
 0x00000005 (STRTAB) 0x244
 0x00000006 (SYMTAB) 0x194
 0x0000000a (STRSZ) 159 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000003 (PLTGOT) 0x1ff4
 0x00000002 (PLTRELSZ) 24 (bytes)
 0x00000014 (PLTREL) REL
 0x00000017 (JMPREL) 0x33c
 0x00000011 (REL) 0x31c
 0x00000012 (RELSZ) 32 (bytes)
 0x00000013 (RELENT) 8 (bytes)
 0x6ffffffe (VERNEED) 0x2fc
 0x6fffffff (VERNEEDNUM) 1
 0x6ffffff0 (VERSYM) 0x2e4
 0x6ffffffa (RELCOUNT) 1
 0x00000000 (NULL) 0x0

#IN THE INSTALL DIRECTORY
frosch3:/home/lederhi/rpath/install $ readelf -d bin/prg liba/liba.so libb/libb.so

File: bin/prg

Dynamic section at offset 0xf08 contains 23 entries:
  Tag Type Name/Value
 0x00000001 (NEEDED) Shared library: [libb.so]
 0x00000001 (NEEDED) Shared library: [libc.so.6]
 0x0000001d (RUNPATH) Library runpath: []
 0x0000000c (INIT) 0x804852c
 0x0000000d (FINI) 0x804871c
 0x00000004 (HASH) 0x80481c4
 0x6ffffef5 (GNU_HASH) 0x8048258
 0x00000005 (STRTAB) 0x80483d8
 0x00000006 (SYMTAB) 0x80482b8
 0x0000000a (STRSZ) 238 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000015 (DEBUG) 0x0
 0x00000003 (PLTGOT) 0x8049ff4
 0x00000002 (PLTRELSZ) 24 (bytes)
 0x00000014 (PLTREL) REL
 0x00000017 (JMPREL) 0x8048514
 0x00000011 (REL) 0x804850c
 0x00000012 (RELSZ) 8 (bytes)
 0x00000013 (RELENT) 8 (bytes)
 0x6ffffffe (VERNEED) 0x80484ec
 0x6fffffff (VERNEEDNUM) 1
 0x6ffffff0 (VERSYM) 0x80484c6
 0x00000000 (NULL) 0x0

File: liba/liba.so

Dynamic section at offset 0xf18 contains 22 entries:
  Tag Type Name/Value
 0x00000001 (NEEDED) Shared library: [libc.so.6]
 0x0000000e (SONAME) Library soname: [liba.so]
 0x0000000c (INIT) 0x30c
 0x0000000d (FINI) 0x478
 0x00000004 (HASH) 0x118
 0x6ffffef5 (GNU_HASH) 0x154
 0x00000005 (STRTAB) 0x230
 0x00000006 (SYMTAB) 0x190
 0x0000000a (STRSZ) 117 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000003 (PLTGOT) 0x1ff4
 0x00000002 (PLTRELSZ) 16 (bytes)
 0x00000014 (PLTREL) REL
 0x00000017 (JMPREL) 0x2fc
 0x00000011 (REL) 0x2dc
 0x00000012 (RELSZ) 32 (bytes)
 0x00000013 (RELENT) 8 (bytes)
 0x6ffffffe (VERNEED) 0x2bc
 0x6fffffff (VERNEEDNUM) 1
 0x6ffffff0 (VERSYM) 0x2a6
 0x6ffffffa (RELCOUNT) 1
 0x00000000 (NULL) 0x0

File: libb/libb.so

Dynamic section at offset 0xf00 contains 24 entries:
  Tag Type Name/Value
 0x00000001 (NEEDED) Shared library: [liba.so]
 0x00000001 (NEEDED) Shared library: [libc.so.6]
 0x0000000e (SONAME) Library soname: [libb.so]
 0x0000001d (RUNPATH) Library runpath: []
 0x0000000c (INIT) 0x354
 0x0000000d (FINI) 0x4e8
 0x00000004 (HASH) 0x118
 0x6ffffef5 (GNU_HASH) 0x158
 0x00000005 (STRTAB) 0x244
 0x00000006 (SYMTAB) 0x194
 0x0000000a (STRSZ) 159 (bytes)
 0x0000000b (SYMENT) 16 (bytes)
 0x00000003 (PLTGOT) 0x1ff4
 0x00000002 (PLTRELSZ) 24 (bytes)
 0x00000014 (PLTREL) REL
 0x00000017 (JMPREL) 0x33c
 0x00000011 (REL) 0x31c
 0x00000012 (RELSZ) 32 (bytes)
 0x00000013 (RELENT) 8 (bytes)
 0x6ffffffe (VERNEED) 0x2fc
 0x6fffffff (VERNEEDNUM) 1
 0x6ffffff0 (VERSYM) 0x2e4
 0x6ffffffa (RELCOUNT) 1
 0x00000000 (NULL) 0x0

TagsNo tags attached.
Attached Filesgz file icon rpath.tar.gz [^] (797 bytes) 2012-08-30 10:34
gz file icon rpath_with_build_and_install_dir.tar.gz [^] (43,924 bytes) 2012-08-30 11:09

 Relationships

  Notes
(0030796)
Brad King (manager)
2012-08-30 10:54

An issue very similar to this was fixed as of CMake 2.8.0:

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

The implementation as of 2.8.9 is here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmSystemTools.cxx;hb=v2.8.9#l2694 [^]

I added these lines to your example to enable DT_RUNPATH on my system:

 set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-new-dtags")
 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags")

but I cannot reproduce the problem:

 $ cd build
 $ cmake --version
 cmake version 2.8.9
 $ cmake .. -DCMAKE_INSTALL_PREFIX="$(pwd)/../install"
 $ make
 $ readelf -d libb/libb.so |grep PATH
  0x000000000000000f (RPATH) Library rpath: [.../build/liba:]
  0x000000000000001d (RUNPATH) Library runpath: [.../build/liba:]
 $ readelf -d prg |grep PATH
  0x000000000000000f (RPATH) Library rpath: [.../build/libb:.../build/liba:]
  0x000000000000001d (RUNPATH) Library runpath: [.../build/libb:.../build/liba:]

 $ make install
 -- Installing: .../install/bin/prg
 -- Removed runtime path from ".../install/bin/prg"
 -- Installing: .../install/liba/liba.so
 -- Installing: .../install/libb/libb.so
 -- Removed runtime path from ".../install/libb/libb.so"
 $ readelf -d ../install/bin/prg |grep PATH
 $ readelf -d ../install/libb/libb.so |grep PATH

Please attach the actual "libb.so" and "prg" binaries from your build tree so I can see the difference.
(0030797)
marled (reporter)
2012-08-30 11:17

Hmm, since I do not want to use RUNPATH anyway, I could use

set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--disable-new-dtags")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags")

. But it would still be nice, if everything works;)
(0030798)
Brad King (manager)
2012-08-30 13:27

Great, thanks. Now I'm able to reproduce it but *only* with the pre-compiled binary from the download page. The problem is here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmELF.cxx;hb=v2.8.9#l126 [^]
 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmELF.cxx;hb=v2.8.9#l333 [^]

in combination with the version of Linux on which the binary is built being so old that it does not define DT_RUNPATH.

I think a workaround like this might work:

#if !defined(DT_RUNPATH) && defined(__linux) && DT_NUM <= 29
# define DT_RUNPATH 29
#endif


or just adding -DDT_RUNPATH=29 to the compilation on that machine.
(0030803)
marled (reporter)
2012-08-31 02:22

Thank you, I have compiled cmake from source and now it works perfectly.
(0030900)
Brad King (manager)
2012-09-03 16:35

This should correct the build on our binary release machine:

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

We'll build 2.8.10 and newer binaries like that.

We may also build new binaries for older versions and will update the download links accordingly.
(0032436)
Robert Maynard (manager)
2013-03-04 08:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-08-30 10:34 marled New Issue
2012-08-30 10:34 marled File Added: rpath.tar.gz
2012-08-30 10:54 Brad King Note Added: 0030796
2012-08-30 11:09 marled File Added: rpath_with_build_and_install_dir.tar.gz
2012-08-30 11:17 marled Note Added: 0030797
2012-08-30 13:27 Brad King Note Added: 0030798
2012-08-31 02:22 marled Note Added: 0030803
2012-09-03 16:35 Brad King Note Added: 0030900
2012-09-03 16:35 Brad King Assigned To => Brad King
2012-09-03 16:35 Brad King Status new => resolved
2012-09-03 16:35 Brad King Resolution open => fixed
2012-09-03 16:35 Brad King Fixed in Version => CMake 2.8.10
2012-09-03 16:35 Brad King Target Version => CMake 2.8.10
2013-03-04 08:38 Robert Maynard Note Added: 0032436
2013-03-04 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team