X-Loop: help-debbugs@HIDDEN Subject: bug#36184: Re-ordering of shared libraries causing a crash Resent-From: Mohammad Akhlaghi <mohammad@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-libtool@HIDDEN Resent-Date: Wed, 12 Jun 2019 20:01:02 +0000 Resent-Message-ID: <handler.36184.B.156036965123641 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 36184 X-GNU-PR-Package: libtool X-GNU-PR-Keywords: To: 36184 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-libtool@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.156036965123641 (code B ref -1); Wed, 12 Jun 2019 20:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Jun 2019 20:00:51 +0000 Received: from localhost ([127.0.0.1]:34111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1hb9QH-000692-Aj for submit <at> debbugs.gnu.org; Wed, 12 Jun 2019 16:00:50 -0400 Received: from lists.gnu.org ([209.51.188.17]:39427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mohammad@HIDDEN>) id 1hb9QE-00068u-TE for submit <at> debbugs.gnu.org; Wed, 12 Jun 2019 16:00:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44649) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <mohammad@HIDDEN>) id 1hb9QD-0001F0-9M for bug-libtool@HIDDEN; Wed, 12 Jun 2019 16:00:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_40,RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <mohammad@HIDDEN>) id 1hb9ML-0005lY-Ls for bug-libtool@HIDDEN; Wed, 12 Jun 2019 15:56:39 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:52005) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <mohammad@HIDDEN>) id 1hb9MK-0005hY-6f for bug-libtool@HIDDEN; Wed, 12 Jun 2019 15:56:36 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 9DA1D21AF1 for <bug-libtool@HIDDEN>; Wed, 12 Jun 2019 15:56:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 12 Jun 2019 15:56:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akhlaghi.org; h= from:subject:to:message-id:date:mime-version:content-type :content-transfer-encoding; s=fm3; bh=tlJV8inz8zUkvGreLum+4QUgC7 1dPSWT2/vvmyjzQuc=; b=D1CLGB0Jm8XZxTKXczOt+d+WYjLDtKBaOnyjvpTSCf UUFz729tXbms9KJBsFkh9u1NukvUky96pcX9Qy0DkCtYpoYAM5tFa6xdICbLVzZ4 dR1gYzYnkB2mGqyjMjIOyVNjQZFZgIZUAH2Tawu7SU2dd02LvxLiQq0Iv43W3/II ETdmTFYRSYVwO1xb5SUHZW6723FssjnFvr9yYits9uuSAlihFzJ2vxOsBWjKqrsW SNSNXAPBkVgJmOJHPrdEn/d9eXuwLLevF2nE+vkNPK0ZjQRrCiV4f4mXCtNlNdL4 ZKaGCCDetPdUM2YGMenOxbsLEhenqPEBiHstgPIKq19Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=tlJV8i nz8zUkvGreLum+4QUgC71dPSWT2/vvmyjzQuc=; b=gc7R0KZcRCqxzy6Qw2n0+9 lQfEZBNesgZbUbcVo6zcEXqSyuezMv+hNp4WE14566yBYAZ4elajUGq5K/YSRzWt cEkDc7nHcX3bFbp0yKs72UmxAT5PvVbYVLSXefFysd7YQrASPthb6x+ovupK1iYI C1wp1PCg8aoOWhqbZSdfV46YhLYtPAtBfrD9Pyn25eydlep0OvBLfoLV6ANC/BVj QD5/d0Hkt3Z14kMn0aVE91Q7oTlALOjD71X4ppElHRlDPGffAA8jJm2C0NP2Vmze vcmFdMW8sw2c8zCs1KttHJu64NDPll4iFCYhos7ITZ4hM0MW9oLbes0uGc9ZJH1g == X-ME-Sender: <xms:7lgBXY1kkdvQ4LGpwXruJ9uCXQdnWe5xfj8ou8Xr2GtXKY_FJAzD7w> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrudehjedgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffuvffkffgfgggtgfesthejre dttdefjeenucfhrhhomhepofhohhgrmhhmrgguucetkhhhlhgrghhhihcuoehmohhhrghm mhgrugesrghkhhhlrghghhhirdhorhhgqeenucffohhmrghinheplhhisghgshhlrdhsoh dpghhnuhdrohhrghenucfkphepudeiuddrjedvrddvudegrddukeeinecurfgrrhgrmhep mhgrihhlfhhrohhmpehmohhhrghmmhgrugesrghkhhhlrghghhhirdhorhhgnecuvehluh hsthgvrhfuihiivgeptd X-ME-Proxy: <xmx:7lgBXU9bj_1C7qhJjvG4j5_VjS0GmHRh-Yic_OrI5YJ7cWFcPIAgLg> <xmx:7lgBXaTgC9CuU-WB_BZASfxJ1BeBO3-Y1gup1JzjsER48sKcF2Z8qg> <xmx:7lgBXbXVrlhuV69U9L8VUJKNSfIXQ0pHfxqLUMpX23-Gnnx9rQxUdQ> <xmx:71gBXTw6S-bOT7rZ1qDijyoXEbLlUn5cr6oOkmaMkHYTF7y7VAdAew> Received: from [161.72.214.186] (unknown [161.72.214.186]) by mail.messagingengine.com (Postfix) with ESMTPA id 25EA7380085 for <bug-libtool@HIDDEN>; Wed, 12 Jun 2019 15:56:30 -0400 (EDT) From: Mohammad Akhlaghi <mohammad@HIDDEN> Message-ID: <4f8169a1-5f2d-f690-9273-d4666d103399@HIDDEN> Date: Wed, 12 Jun 2019 20:56:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.29 X-Spam-Score: -1.1 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://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: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.2 (/) Dear Libtool maintainers, A new user of Gnuastro recently reported a problem in building Gnuastro and after digging into the problem, I think its source lies with Libtool, so I thought of consulting you here. Gnuastro first builds its library (libgnuastro), then goes onto building its separate programs (astarithmetic is the first one). The library needs to link with several dependency libraries. So when building the programs, `-lgnuastro' has to be linked first, then all the dependency libraries. Recently we started using Gnulib's `AC_LIB_HAVE_LINKFLAGS' to check for the presence of libraries during the configure step. We append the results for all the dependency libraries into one variable (`CONFIG_LDADD') and use that when linking the individual programs. For example here you can see the Makefile.am for `astarithmetic': https://git.savannah.gnu.org/cgit/gnuastro.git/tree/bin/arithmetic/Makefile.am However, when there are multiple versions of a library in the search path, apparently `AC_LIB_HAVE_LINKFLAGS' doesn't actually add a `-l' option, but it returns the full path of the shared library. As a result, on my system, `CONFIG_LDADD' looks like this (notice them several `.so' files): CONFIG_LDADD='-lgit2 -ltiff -llzma -ljpeg -lwcs -lcfitsio -lcurl -lz /usr/local/lib/libgsl.so /usr/local/lib/libgslcblas.so -lm -Wl,-rpath -Wl,/usr/local/lib -lm ' However, when we run `make' to build Gnuastro, Libtool apparently re-orders the libraries such that those without a `-l' come before those with it, you can see the relevant commands during `make' below (note how the order is preserved at first, but in the second command, the GSL `.so' files are all placed before those starting with `-l', in particular, before `libgnuastro.so'): /bin/bash ../../libtool --tag=CC --mode=link gcc -Wall -O3 -pthread -L\../../lib -o astarithmetic main.o ui.o arithmetic.o operands.o ../../bootstrapped/lib/libgnu.la -lgnuastro -lgit2 -ltiff -llzma -ljpeg -lwcs -lcfitsio -lcurl -lz /usr/local/lib/libgsl.so /usr/local/lib/libgslcblas.so -lm -Wl,-rpath -Wl,/usr/local/lib -lm libtool: link: gcc -Wall -O3 -pthread -o .libs/astarithmetic main.o ui.o arithmetic.o operands.o /usr/local/lib/libgsl.so /usr/local/lib/libgslcblas.so -Wl,-rpath -Wl,/usr/local/lib -L../../lib ../../bootstrapped/lib/.libs/libgnu.a /home/id/gnuastro-0.9.55-9d7d/lib/.libs/libgnuastro.so -lgit2 -ltiff -llzma -ljpeg -lwcs -lcfitsio /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so -lz -lm -pthread On my system (Arch Linux, GCC 8.3.0) I also get a re-ordering, but it doesn't cause a problem. However, on the user's system (Ubuntu 18.04, GCC 7.4.0), it causes a linking error, complaining that there are undefined GSL symbols in `libgnuastro.so'. To me it looks like the problem is in the re-ordering of the libraries. But I am a little confused why it complains on one system and doesn't complain on another. Could you please guide me on the best way to solve this problem? Thank you very much, Mohammad
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Mohammad Akhlaghi <mohammad@HIDDEN> Subject: bug#36184: Acknowledgement (Re-ordering of shared libraries causing a crash) Message-ID: <handler.36184.B.156036965123641.ack <at> debbugs.gnu.org> References: <4f8169a1-5f2d-f690-9273-d4666d103399@HIDDEN> X-Gnu-PR-Message: ack 36184 X-Gnu-PR-Package: libtool Reply-To: 36184 <at> debbugs.gnu.org Date: Wed, 12 Jun 2019 20:01:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-libtool@HIDDEN If you wish to submit further information on this problem, please send it to 36184 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 36184: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36184 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.