GNU bug report logs - #11537
Libtool 2.4.2 fails to handle library interdependencies

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: libtool; Reported by: Kristian Spangsege <kristian.spangsege@HIDDEN>; dated Mon, 21 May 2012 23:46:02 UTC; Maintainer for libtool is bug-libtool@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 May 2012 23:45:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 21 19:45:54 2012
Received: from localhost ([127.0.0.1]:37805 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SWcIT-0004vd-FM
	for submit <at> debbugs.gnu.org; Mon, 21 May 2012 19:45:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48191)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <kristian.spangsege@HIDDEN>) id 1SWc7H-0004fd-0M
	for submit <at> debbugs.gnu.org; Mon, 21 May 2012 19:34:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <kristian.spangsege@HIDDEN>) id 1SWc6V-0000o0-MZ
	for submit <at> debbugs.gnu.org; Mon, 21 May 2012 19:33:33 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:49137)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kristian.spangsege@HIDDEN>) id 1SWc6V-0000nr-HH
	for submit <at> debbugs.gnu.org; Mon, 21 May 2012 19:33:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60007)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kristian.spangsege@HIDDEN>) id 1SWc6T-0005DJ-Hn
	for bug-libtool@HIDDEN; Mon, 21 May 2012 19:33:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <kristian.spangsege@HIDDEN>) id 1SWc6R-0000mx-6k
	for bug-libtool@HIDDEN; Mon, 21 May 2012 19:33:28 -0400
Received: from mail-yw0-f41.google.com ([209.85.213.41]:37232)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kristian.spangsege@HIDDEN>) id 1SWc6R-0000mO-06
	for bug-libtool@HIDDEN; Mon, 21 May 2012 19:33:27 -0400
Received: by yhr47 with SMTP id 47so6005618yhr.0
	for <bug-libtool@HIDDEN>; Mon, 21 May 2012 16:33:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=kZF7/I+3qfWkXyVJ3e5PPnKzkxyieqPicF6pDJIEt50=;
	b=R2ZNZoaxM1EzfVM8z6CbsVOJqyyPm5V1rMHYRMaDfdjL4RFRthKynQDAGFguNjPBrK
	3GfLQxuLdH3oit8LXyZU5ChqqKOYVbqYLMswgUuUW3OztvThxUfxL9Bs5pfU8R8a0Nff
	BE5U/Xv1v9JmwYnnsxT469oLU9TkPa2js+egZ2y8q/XBvlj51ad4S4W82EgGfmxsYwhv
	RCGMfwzw+bO5lilJ0Ny2bsJjS1vKAN6SG/e1wdyCT0y+sK2oAQwdcdp22FSImCpJyvA+
	7RGre8iDmDFvW8oc9DQTKGT6jTPizTR5mmt1EwQNT7pKo/Eog6cUIwGszn8M6OvwQ9S9
	ugRA==
MIME-Version: 1.0
Received: by 10.236.177.1 with SMTP id c1mr24531145yhm.41.1337643204520; Mon,
	21 May 2012 16:33:24 -0700 (PDT)
Received: by 10.147.114.14 with HTTP; Mon, 21 May 2012 16:33:24 -0700 (PDT)
Date: Tue, 22 May 2012 01:33:24 +0200
Message-ID: <CANspNZkg3Uie7_4XfJA=gyEeMfYeC6NYTdnn57z0b-GjuA89qg@HIDDEN>
Subject: Libtool 2.4.2 fails to handle library interdependencies
From: Kristian Spangsege <kristian.spangsege@HIDDEN>
To: bug-libtool@HIDDEN
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.1 (------)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 21 May 2012 19:45:52 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

Libtool 2.4.2 (Ubuntu 12.04) fails to handle library interdependencies
- in particular C++ library interdependencies.

The interdependency is specified on the command line, and is recorded
correctly by libtool, however, since there is no dependency from the
point of view of the binary library files, and since libtool no longer
adds all dependency libraries on the command line, compiling of the
final application fails.

I suppose the problem is that libtool has been changed to set
link_all_deplibs=no on my platform, but I'm not sure.

Here is an example that illustrates the problem:

### create test files:
cat >alpha.hpp <<EOI
void alpha();
EOI
cat >alpha.cpp <<EOI
#include "alpha.hpp"
void alpha() {}
EOI
cat >beta.hpp <<EOI
#include "alpha.hpp"
void beta1();
inline void beta2() { alpha(); }
EOI
cat >beta.cpp <<EOI
#include "beta.hpp"
void beta1() {}
EOI
cat >app.cpp <<EOI
#include "beta.hpp"
int main()
{
  beta2();
  return 0;
}
EOI

### build 'libalpha':
libtool --tag=CXX --mode=compile g++ -c alpha.cpp
libtool --tag=CXX --mode=link g++ alpha.lo -o libalpha.la -rpath /tmp

### build 'libbeta':
libtool --tag=CXX --mode=compile g++ -c beta.cpp
libtool --tag=CXX --mode=link g++ beta.lo libalpha.la -o libbeta.la
-rpath /tmp # Depends on 'libalpha'

### build app:
libtool --tag=CXX --mode=link g++ app.cpp libbeta.la -o app

### error:
# In function `beta2()':
# app.cpp: undefined reference to `alpha()'


Of couse, if you forget about C++, then this change is probably ok,
since all dependencies would be reflected in the binary library files.
This is certainly not the case for C++.

I belive that the Libtool manual says unambiguously that this is
supposed to work:

"In any event, libtool provides a simple mechanism for you to declare
inter-library dependencies: for every library libname that your own
library depends on, simply add a corresponding -lname option to the
link line when you create your library."

http://www.gnu.org/software/libtool/manual/libtool.html#Inter_002dlibrary-dependencies


Note also that this actually worked in Libtool 2.2.6b (Ubuntu 10.04).

Also see this diff excerpt on libtool.m4 between 2.2.6b and 2.4.2:

@@ -4249,10 +4655,39 @@
   openbsd*)
     with_gnu_ld=no
     ;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
   esac



ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: libtool 2.4.2-1ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-24.38-generic 3.2.16
Uname: Linux 3.2.0-24-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
Date: Tue May 22 00:37:22 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64
(20120425)
ProcEnviron:
 LANGUAGE=en_US:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: libtool
UpgradeStatus: No upgrade log present (probably fresh install)




Acknowledgement sent to Kristian Spangsege <kristian.spangsege@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to bug-libtool@HIDDEN:
bug#11537; Package libtool. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.