Comment 4 for bug 319048

Jan (jan-ellenbeck) wrote :

OK, I found a fix for this and also an old SUSE bug report (from 2004) that seems to (re)appear on our openSUSE 11.0 system. Here is the old bug report:

It seems that if *both* RPATH and RUNPATH are set in the "Dynamic Section" of the openwns binary, the dlopen() call from library/module/Base.cpp ignores them completely and then fails to load the libraries. However, if only RPATH is set, it honors the setting and correctly loads the libraries.

To prevent the RUNPATH to be set, you can compile the main openwns application with (note the -Wl,-disable-new-dtags):

g++ -o .build/dbg/openwns-application/application--main--1.0/openwns '-Wl,-disable-new-dtags,-rpath=/data/jan/clean/openwns-sdk/sandbox/dbg/lib' .build/dbg/openwns-application/application--main--1.0/src/Main.o -Lsandbox/dbg/lib -lboost_signals -lpython2.5 -lwns -lboost_program_options -lboost_date_time -lcppunit

The resulting openws only has RPATH set:

jan@nepomuk:/data/jan/clean/openwns-sdk/tests/unit/unitTests$ objdump -p openwns-no-dtags
openwns-no-dtags: file format elf64-x86-64

Program Header:
    PHDR off 0x0000000000000040 vaddr 0x0000000000400040 paddr 0x0000000000400040 align 2**3
         filesz 0x00000000000001f8 memsz 0x00000000000001f8 flags r-x
  INTERP off 0x0000000000000238 vaddr 0x0000000000400238 paddr 0x0000000000400238 align 2**0
         filesz 0x000000000000001c memsz 0x000000000000001c flags r--
    LOAD off 0x0000000000000000 vaddr 0x0000000000400000 paddr 0x0000000000400000 align 2**21
         filesz 0x0000000000003fb9 memsz 0x0000000000003fb9 flags r-x
    LOAD off 0x0000000000004d70 vaddr 0x0000000000604d70 paddr 0x0000000000604d70 align 2**21
         filesz 0x00000000000003a8 memsz 0x00000000000006f8 flags rw-
 DYNAMIC off 0x0000000000004da0 vaddr 0x0000000000604da0 paddr 0x0000000000604da0 align 2**3
         filesz 0x0000000000000240 memsz 0x0000000000000240 flags rw-
    NOTE off 0x0000000000000254 vaddr 0x0000000000400254 paddr 0x0000000000400254 align 2**2
         filesz 0x0000000000000038 memsz 0x0000000000000038 flags r--
EH_FRAME off 0x0000000000003804 vaddr 0x0000000000403804 paddr 0x0000000000403804 align 2**2
         filesz 0x0000000000000114 memsz 0x0000000000000114 flags r--
   STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off 0x0000000000004d70 vaddr 0x0000000000604d70 paddr 0x0000000000604d70 align 2**0
         filesz 0x0000000000000290 memsz 0x0000000000000290 flags r--

Dynamic Section:
  RPATH /data/jan/clean/openwns-sdk/sandbox/dbg/lib
  INIT 0x0000000000402188
  FINI 0x0000000000403558
  HASH 0x0000000000400290
  GNU_HASH 0x0000000000400518
  STRTAB 0x0000000000400fa8
  SYMTAB 0x00000000004006f0
  STRSZ 0x0000000000000cc1
  SYMENT 0x0000000000000018
  DEBUG 0x0000000000000000
  PLTGOT 0x0000000000604fe8
  PLTRELSZ 0x0000000000000318
  PLTREL 0x0000000000000007
  JMPREL 0x0000000000401e70
  RELA 0x0000000000401d98
  RELASZ 0x00000000000000d8
  RELAENT 0x0000000000000018
  VERNEED 0x0000000000401d28
  VERNEEDNUM 0x0000000000000003
  VERSYM 0x0000000000401c6a

Version References:
  required from
    0x09691a75 0x00 05 GLIBC_2.2.5
  required from
    0x0b792650 0x00 04 GCC_3.0
  required from
    0x08922974 0x00 03 GLIBCXX_3.4
    0x056bafd3 0x00 02 CXXABI_1.3