From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: bug#25072: Missing LD_LIBRARY_PATH in (container) environment Date: Wed, 30 Nov 2016 09:14:47 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC5fA-0002ED-TK for bug-guix@gnu.org; Wed, 30 Nov 2016 09:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cC5f6-0001z2-CS for bug-guix@gnu.org; Wed, 30 Nov 2016 09:15:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:59926) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cC5f6-0001wA-8z for bug-guix@gnu.org; Wed, 30 Nov 2016 09:15:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cC5f3-0007Tb-QD for bug-guix@gnu.org; Wed, 30 Nov 2016 09:15:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Roel Janssen Cc: 25072@debbugs.gnu.org On Wed, Nov 30, 2016 at 7:58 AM, Roel Janssen wrote: > Dear Guix, > > When I create a separate environment using: > > $ guix environment --container --pure --ad-hoc --network autoconf \ > automake make libtool pkg-config postgresql valgrind sed coreutils \ > binutils gcc glibc grep sed glib gawk findutils bash > > Then compile my program: > $ make > ... > CCLD myprogram > > > Then try to run it: > $ ./myprogram > > It fails with: > ./myprogram: error while loading shared libraries: libglib-2.0.so.0: \ > cannot open shared object file: No such file or directory > > So, it cannot find glib while I had included it in the list of packages > to make available in the container. > > When I set LD_LIBRARY_PATH as: > export LD_LIBRARY_PATH=$LIBRARY_PATH > > The program runs fine. > > Therefore, I believe we should set LD_LIBRARY_PATH as well in the > container. No, this is undesirable. Using LD_LIBRARY_PATH is not good practice because it is just hacking around the real issue: The application was not compiled correctly. The solution to your problem is to use the gcc-toolchain package instead of including binutils, gcc, glibc, etc. manually. gcc-toolchain will do the right thing. Hope this helps, - Dave