From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: problems solved by AC_LIB_HAVE_LINKFLAGS [was: cross building 1.9.14 for mingw] Date: Fri, 04 Mar 2011 12:11:20 +0100 Message-ID: References: <1296330082.8111.371.camel@vuurvlieg> <874o8r8kdn.fsf@gnu.org> <1297765259.2325.283.camel@vuurvlieg> <1298540378.4306.71.camel@vuurvlieg> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1299238117 23334 80.91.229.12 (4 Mar 2011 11:28:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2011 11:28:37 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , Bruno Haible , guile-devel@gnu.org To: Jan Nieuwenhuizen Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Mar 04 12:28:32 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PvTBN-0001RX-Nt for guile-devel@m.gmane.org; Fri, 04 Mar 2011 12:28:30 +0100 Original-Received: from localhost ([127.0.0.1]:42238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvTBN-0002AY-5B for guile-devel@m.gmane.org; Fri, 04 Mar 2011 06:28:29 -0500 Original-Received: from [140.186.70.92] (port=40152 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvTBH-00029H-GM for guile-devel@gnu.org; Fri, 04 Mar 2011 06:28:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvTBF-0000zl-IQ for guile-devel@gnu.org; Fri, 04 Mar 2011 06:28:23 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:48229 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvTBF-0000zb-GL; Fri, 04 Mar 2011 06:28:21 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id BC3513682; Fri, 4 Mar 2011 06:29:42 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=i+fbz2JPbH6dH2j14d8niqQKXh8=; b=fEvQ0S j9MWHQSBUZicTreDJo4JDOG0jc4acWJG0de2qr75HCSKiNMwYwpIEs/QTaRGFr4m ckMSKhB4ECKxbD0M355qJdZ4I49Mizab3L43V+DNc0AgNGNyAF1BDyHddnqaaszW /KyCkOcHYWYTkDFNk65+LV6mOdMMvru7mvYU4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=LwjfWEGC9jPPgmkx8rhRAJlAdIWkKH1+ biUE/rxF4LdVZxW7E+2VdQP2NWGdAgpEh2ffjaksievqoj1e5NuwIckXem5z0d9e /bFtA4oo0y928AvaCg6C5uDuneiFcoBKWDYS4W1MFxlIUmPd+bv9s1UPqhXrYF4O gQ4BA7zv00k= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 8AEE3367E; Fri, 4 Mar 2011 06:29:39 -0500 (EST) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 5486D367D; Fri, 4 Mar 2011 06:29:35 -0500 (EST) In-Reply-To: <1298540378.4306.71.camel@vuurvlieg> (Jan Nieuwenhuizen's message of "Thu, 24 Feb 2011 10:39:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: B13318EC-4652-11E0-9E88-AF401E47CF6F-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11767 Archived-At: Hi Jan, Apologies for the delay in the reply. On Thu 24 Feb 2011 10:39, Jan Nieuwenhuizen writes: > Andy Wingo schreef op di 22-02-2011 om 09:34 [+0100]: > >> To be honest I don't find it too onerous to have to set these flags when >> compiling with DESTDIR. Sure, it would be nicer if it were just one >> flag, and perhaps we can fix that; but as you have perhaps seen in the >> numerous discussions on bug-guile recently, it seems that >> AC_LIB_HAVE_LINKFLAGS solves real problems. > > I'm glad to hear that, at least it means that my cross build troubles > were for a good cause... So now I need to look into the problems > that AC_LIB_HAVE_LINKFLAGS actually solves and see how to keep solving > them while not breaking zero-config DESTDIR-builds. Here is my understanding of the problems and solutions. Let's say you are building and installing Guile on Fedora. You download the tarball, ./configure && make && make install, and voila. You run Guile and it works. Sweet! So now you follow the manual, and it says that you can build your own Guile via: $ gcc -o simple-guile simple-guile.c $(pkg-config guile-2.0 --cflags --libs) which in your case expands out to $ gcc -o simple-guile simple-guile.c -I/usr/local/include/guile/2.0 -L/usr/local/include -lguile-2.0 And it compiles and links. Awesome. However when you run the simple-guile it doesn't work: $ ./simple-guile error: could not find libguile-2.0.so Why is this? It's because in Fedora, /usr/local/lib is not in the default runtime library search path. If we were compiling on Debian this would work because /usr/local/lib is in the default library search path, though we would see the issue if we installed to (e.g.) /opt/guile. If we were compiling on Mac OS X it would work fine because the linker effectively adds -rpath for libraries not in the standard locations (even the /opt/guile case). Those of us that haven't linked anything on the command line in a while probably haven't noticed, because we use libtool to do the linking, and libtool will add -rpath when linking against libraries that are not in your system run path. It used to be that libtool always added -rpath, but distros complained -- Debian for one -- and so now libtool only adds -rpath for libs that are not going to a system path. It seems that what libtool does is the right thing to do by default. The problem is, you can't add the -rpath in guile-config or pkg-config -- the right thing to do depends on the compiler you are using. So you have to check for that at configure-time. That's what AC_LIB_HAVE_LINKFLAGS does. Given some link-time flags, AC_LIB_HAVE_LINKFLAGS determines what flags will be needed such that the library will be found at runtime. It adds -rpath when linking against libraries that are not in your system path. This discussion about system paths usually includes /usr, so that's the default behavior of AC_LIB_HAVE_LINKFLAGS. But sometimes you don't want AC_LIB_HAVE_LINKFLAGS to look there -- that is, when you have $DESTDIR builds -- and so in that case there are all those --without-PACKAGE-prefix arguments. That's the problem that AC_LIB_HAVE_LINKFLAGS solves for normal "configure && make && make install" users. It can complicate $DESTDIR builds a little, in that you have to add some more configure arguments, but it's not that bad. Peace, Andy -- http://wingolog.org/