From owner-freebsd-questions@FreeBSD.ORG Mon Nov 29 13:51:02 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09F551065672 for ; Mon, 29 Nov 2010 13:51:02 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from dirj.bris.ac.uk (dirj.bris.ac.uk [137.222.10.78]) by mx1.freebsd.org (Postfix) with ESMTP id B71EE8FC12 for ; Mon, 29 Nov 2010 13:51:01 +0000 (UTC) Received: from ncsd.bris.ac.uk ([137.222.10.59] helo=ncs.bris.ac.uk) by dirj.bris.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1PN48C-00022M-A6 for freebsd-questions@freebsd.org; Mon, 29 Nov 2010 13:51:00 +0000 Received: from mech-cluster241.men.bris.ac.uk ([137.222.187.241]) by ncs.bris.ac.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1PN48C-0005J2-6r for freebsd-questions@freebsd.org; Mon, 29 Nov 2010 13:51:00 +0000 Received: from mech-cluster241.men.bris.ac.uk (localhost [127.0.0.1]) by mech-cluster241.men.bris.ac.uk (8.14.4/8.14.4) with ESMTP id oATDox4S008544 for ; Mon, 29 Nov 2010 13:50:59 GMT (envelope-from mexas@bristol.ac.uk) Received: (from mexas@localhost) by mech-cluster241.men.bris.ac.uk (8.14.4/8.14.4/Submit) id oATDoxE7008541 for freebsd-questions@freebsd.org; Mon, 29 Nov 2010 13:50:59 GMT (envelope-from mexas@bristol.ac.uk) X-Authentication-Warning: mech-cluster241.men.bris.ac.uk: mexas set sender to mexas@bristol.ac.uk using -f Date: Mon, 29 Nov 2010 13:50:59 +0000 From: Anton Shterenlikht To: freebsd-questions@freebsd.org Message-ID: <20101129135058.GA6756@mech-cluster241.men.bris.ac.uk> Mail-Followup-To: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Subject: linking against shared libraries not in default path X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2010 13:51:02 -0000 I compiled some numerical libraries under my home directory, including static and shared libs. The shared lib is % ls ./src/libslatec.so.1 ./src/libslatec.so.1 % Now I'd like to test shared libraries, so I do % gfortran45 -o test01.x test01.o qc6a.o -L./src/ -lslatec % ./test01.x /libexec/ld-elf.so.1: Shared object "libslatec.so.1" not found, required by "test01.x" % How can I tell the executable to look for a shared library in a specific directory? I tried setting LIBRARY_PATH, but it didn't help. Perhaps I completely misunderstand how shared libraries work.. Please advise many thanks anton -- Anton Shterenlikht Room 2.6, Queen's Building Mech Eng Dept Bristol University University Walk, Bristol BS8 1TR, UK Tel: +44 (0)117 331 5944 Fax: +44 (0)117 929 4423