From owner-freebsd-chat@FreeBSD.ORG Thu Oct 21 21:40:58 2004 Return-Path: Delivered-To: freebsd-chat@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 65A8E16A4CE for ; Thu, 21 Oct 2004 21:40:58 +0000 (GMT) Received: from pilchuck.reedmedia.net (pilchuck.reedmedia.net [209.166.74.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id E662743D3F for ; Thu, 21 Oct 2004 21:40:55 +0000 (GMT) (envelope-from reed@reedmedia.net) Received: from reed by pilchuck.reedmedia.net with local-esmtp (Exim 3.12 #1 (Debian)) id 1CKkg2-0001i0-00; Thu, 21 Oct 2004 14:40:54 -0700 Date: Thu, 21 Oct 2004 14:40:53 -0700 (PDT) From: "Jeremy C. Reed" To: freebsd-chat@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: change RPATH in existing executable X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2004 21:40:58 -0000 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/