Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Oct 2004 14:40:53 -0700 (PDT)
From:      "Jeremy C. Reed" <reed@reedmedia.net>
To:        freebsd-chat@freebsd.org
Subject:   change RPATH in existing executable
Message-ID:  <Pine.LNX.4.43.0410211439260.299-100000@pilchuck.reedmedia.net>

next in thread | raw e-mail | index | archive | help
Any ideas on how to add another path to the RPATH in an existing
executable?

Examples of the files are:

reed@puget:~$ file /usr/lib/libkdeinit_kcookiejar.so
/usr/lib/libkdeinit_kcookiejar.so: ELF 32-bit LSB shared object, Intel
80386, version 1 (SYSV), not stripped

reed@puget:~$ objdump -x /usr/lib/libkdeinit_kcookiejar.so | grep -i rpath
  RPATH       /usr/gcc3/lib:/usr/qt3/lib

reed@puget:~$ file kde-config
kde-config: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped

reed@puget:~$ objdump -x kde-config | grep RPATH
  RPATH       /usr/gcc3/lib:/usr/qt3/lib

I found a program at
 http://www.mail-archive.com/linux-gcc@vger.rutgers.edu/msg00317.htm
which compiled fine for me (under Linux and NetBSD), but it failed:

reed@puget:~$ ./change-rpath kde-config
kde-config:existing RPATH: /usr/gcc3/lib:/usr/qt3/lib

reed@puget:~$ ./change-rpath kde-config /usr/gcc3/lib:/usr/qt3/lib:/usr/X11R6/lib
kde-config:existing RPATH: /usr/gcc3/lib:/usr/qt3/lib
new rpath '/usr/gcc3/lib:/usr/qt3/lib:/usr/X11R6/lib' too large; maximum
length 26

I see that the tool wants to replace (for the same amount of
characters) and not append.

I also found elfsh (http://elfsh.segfault.net/) but I am not sure if it
can handle this too. (I asked on that list a few hours ago, but the email
never appeared to get to their list yet.)

I would rather adjust the RPATH in the binary than adjust my environment.
I guess I could use shorter library path names and symlinks, etc. I also
know I can rebuild, but I wanted to try this first.

Any ideas?

 Jeremy C. Reed

 	  	 	 open source, Unix, *BSD, Linux training
	  	 	 http://www.pugetsoundtechnology.com/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.43.0410211439260.299-100000>