GNU bug report logs - #34219
libtool cannot statically link dependencies into shared C++ library

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: Ulya Trofimovich <skvadrik@HIDDEN>; dated Sun, 27 Jan 2019 13:30:02 UTC; Maintainer for libtool is bug-libtool@HIDDEN.

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


Received: (at 34219) by debbugs.gnu.org; 29 Jan 2019 22:32:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 29 17:32:34 2019
Received: from localhost ([127.0.0.1]:50922 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gobvm-0000nP-27
	for submit <at> debbugs.gnu.org; Tue, 29 Jan 2019 17:32:34 -0500
Received: from mail-wr1-f53.google.com ([209.85.221.53]:39323)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <skvadrik@HIDDEN>) id 1gobvk-0000nA-QQ
 for 34219 <at> debbugs.gnu.org; Tue, 29 Jan 2019 17:32:33 -0500
Received: by mail-wr1-f53.google.com with SMTP id t27so23905921wra.6
 for <34219 <at> debbugs.gnu.org>; Tue, 29 Jan 2019 14:32:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=PJYFec+i4hUiUxOB+iaYA9673V27VFa7TchOFsfnYYc=;
 b=cGOTqyLsm8BReCvjWsocS1iDJLTyZ7M6x1YYGMbDy/CrWt1WZ8NEPVb0XKAJLNUXCI
 NbLQymjPA8aRufVFajhSP+pb5Ufeakmoqms1MmRwQnqJn+vtcIA5bvkgc7YF+s0yh2re
 pKFS0+QH53VUKKg2iT+orTG7bj4/SM1LlKGoEzHwRTRvVO0G8Ca6lu4j2mT81rMJlxWr
 eMf62PK2FCX9uc4ZiYrKwqqnv6iEy2RXibZoqKxN4D4R6c6AVZu3cxvUsYZgMyRP3YlZ
 J8Ko5CNzkUJyx/Uy3Up/KXhnk7Sz1ndf+y+YlGiCeE6MIBDp1gFdYPnHp+DifcHRHSzT
 cjLA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=PJYFec+i4hUiUxOB+iaYA9673V27VFa7TchOFsfnYYc=;
 b=rVW2jw0fTew9xXbucIhRHObiABzvDS833GEZdzRn9N2kSTUylQ1FZBJjkkMGHLbKtw
 cmOIYTlLTlTwp+AsqN1E7ot3iyc/bY0FvYmsb7afpgERws/QyvfBw4e5yH/v+vnsQ1+6
 UrtHybMfi7tgywfAfkFdkqqQssB3EZuh0aNnh+K+jcUNQX1t/b2ryThsJIbFDosLnsgg
 8Lh+SCfM0cNu05e0lazeL0h1sMGkdTFjYtoomV5DqEr4inCqv+KMFItCxIK9wu+MmtGn
 E5MALjCsAsBEimj0PgtKMXVJESL/lz/vYkh8A25GRwwg/NkXtaK/K53wRmpvKuIRioh2
 nB6g==
X-Gm-Message-State: AJcUukfCSAka0GiZSuLJEW2lFfhznkIxIHI7m85mxNtbVBlLlHFVdQfX
 DxduBnOiWn3VJpGvLDTZ8ms=
X-Google-Smtp-Source: ALg8bN5Z5UnigKGL1rehYAkqK/PEZYut/Nb8sx9qJShBd8n9uy8emnMpqqDY1Nyb5vPK+H8dkbqk7A==
X-Received: by 2002:a5d:46cd:: with SMTP id g13mr28663018wrs.49.1548801146930; 
 Tue, 29 Jan 2019 14:32:26 -0800 (PST)
Received: from [192.168.1.250]
 (host86-155-197-32.range86-155.btcentralplus.com. [86.155.197.32])
 by smtp.googlemail.com with ESMTPSA id
 x10sm141666098wrn.29.2019.01.29.14.32.25
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 29 Jan 2019 14:32:26 -0800 (PST)
Subject: Re: bug#34219: libtool cannot statically link dependencies into
 shared C++ library
To: Bob Friesenhahn <bfriesen@HIDDEN>
References: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
 <alpine.GSO.2.20.1901271938500.14882@HIDDEN>
From: Ulya Trofimovich <skvadrik@HIDDEN>
Message-ID: <aff41981-a44f-bf46-22b7-6691ec6b6afa@HIDDEN>
Date: Tue, 29 Jan 2019 22:31:46 +0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <alpine.GSO.2.20.1901271938500.14882@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34219
Cc: 34219 <at> debbugs.gnu.org, Libtool Bugs List <bug-libtool@HIDDEN>,
 Sergei Trofimovich <slyfox@HIDDEN>
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: -1.0 (-)


> Usually people are using MinGW64 GCC to build DLLs for Windows.  What
> GCC are you using?  Is this a native Windows build or are you
> cross-compiling?

I am cross-compiling with Mingw:

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (Gentoo 7.3.0-r4 p1.6) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Original example in my email was built natively with this GCC:

$ gcc --version
gcc (Gentoo 8.2.0-r2 p1.2) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


-- 
Ulya




Information forwarded to bug-libtool@HIDDEN:
bug#34219; Package libtool. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 29 Jan 2019 22:32:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 29 17:32:56 2019
Received: from localhost ([127.0.0.1]:50925 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gobw8-0000o0-D4
	for submit <at> debbugs.gnu.org; Tue, 29 Jan 2019 17:32:56 -0500
Received: from eggs.gnu.org ([209.51.188.92]:56001)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <skvadrik@HIDDEN>) id 1gobw6-0000nl-HQ
 for submit <at> debbugs.gnu.org; Tue, 29 Jan 2019 17:32:55 -0500
Received: from lists.gnu.org ([209.51.188.17]:56132)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <skvadrik@HIDDEN>) id 1gobw1-0007sH-3U
 for submit <at> debbugs.gnu.org; Tue, 29 Jan 2019 17:32:49 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37953)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <skvadrik@HIDDEN>) id 1gobw0-0003cY-7I
 for bug-libtool@HIDDEN; Tue, 29 Jan 2019 17:32:48 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <skvadrik@HIDDEN>) id 1gobvz-0007n3-BC
 for bug-libtool@HIDDEN; Tue, 29 Jan 2019 17:32:48 -0500
Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:44558)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <skvadrik@HIDDEN>) id 1gobvz-0007aN-4V
 for bug-libtool@HIDDEN; Tue, 29 Jan 2019 17:32:47 -0500
Received: by mail-wr1-x429.google.com with SMTP id z5so23870753wrt.11
 for <bug-libtool@HIDDEN>; Tue, 29 Jan 2019 14:32:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=PJYFec+i4hUiUxOB+iaYA9673V27VFa7TchOFsfnYYc=;
 b=cGOTqyLsm8BReCvjWsocS1iDJLTyZ7M6x1YYGMbDy/CrWt1WZ8NEPVb0XKAJLNUXCI
 NbLQymjPA8aRufVFajhSP+pb5Ufeakmoqms1MmRwQnqJn+vtcIA5bvkgc7YF+s0yh2re
 pKFS0+QH53VUKKg2iT+orTG7bj4/SM1LlKGoEzHwRTRvVO0G8Ca6lu4j2mT81rMJlxWr
 eMf62PK2FCX9uc4ZiYrKwqqnv6iEy2RXibZoqKxN4D4R6c6AVZu3cxvUsYZgMyRP3YlZ
 J8Ko5CNzkUJyx/Uy3Up/KXhnk7Sz1ndf+y+YlGiCeE6MIBDp1gFdYPnHp+DifcHRHSzT
 cjLA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=PJYFec+i4hUiUxOB+iaYA9673V27VFa7TchOFsfnYYc=;
 b=S7nhVHdx5KSwdavJxiM55BhcCUXRmX3c88f7ErhpQ9lWGHaTqODB1gcP4Or6hYMqiS
 scw833aNFgRwE8y6hMM2DCXepCp3YA6ooGFR6nSJAm1c1FSyj/oVH1+q5llItL8dDqVI
 zaPrMvhI0CnPkKtLEQyWgExpa/7ChbserynkCHwA1AiPYDGe5+ys/1etr/iUBlrhmWaL
 A17MpIskhE6/5099TmE5wzIa2OzmEiShrMmbujQwJ9XUL6w4ciEB85dAuwnxmNeRkgVK
 buESXYdESmUKnQlE1mRrYaDTUiPs8tBkAvbUdbXRJ+zdVEh7EsWnYHIywcOhUflNwvxl
 VDgQ==
X-Gm-Message-State: AJcUukdtSk3R92Ay+f8ENrzHXE2lKmJtOnmpzSr7MLoezFMeALEjdbzt
 TlYCa8m3B50EEZtVZfialH+sZB5/
X-Google-Smtp-Source: ALg8bN5Z5UnigKGL1rehYAkqK/PEZYut/Nb8sx9qJShBd8n9uy8emnMpqqDY1Nyb5vPK+H8dkbqk7A==
X-Received: by 2002:a5d:46cd:: with SMTP id g13mr28663018wrs.49.1548801146930; 
 Tue, 29 Jan 2019 14:32:26 -0800 (PST)
Received: from [192.168.1.250]
 (host86-155-197-32.range86-155.btcentralplus.com. [86.155.197.32])
 by smtp.googlemail.com with ESMTPSA id
 x10sm141666098wrn.29.2019.01.29.14.32.25
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 29 Jan 2019 14:32:26 -0800 (PST)
Subject: Re: bug#34219: libtool cannot statically link dependencies into
 shared C++ library
To: Bob Friesenhahn <bfriesen@HIDDEN>
References: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
 <alpine.GSO.2.20.1901271938500.14882@HIDDEN>
From: Ulya Trofimovich <skvadrik@HIDDEN>
Message-ID: <aff41981-a44f-bf46-22b7-6691ec6b6afa@HIDDEN>
Date: Tue, 29 Jan 2019 22:31:46 +0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <alpine.GSO.2.20.1901271938500.14882@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::429
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: 34219 <at> debbugs.gnu.org, Libtool Bugs List <bug-libtool@HIDDEN>,
 Sergei Trofimovich <slyfox@HIDDEN>
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.0 (/)


> Usually people are using MinGW64 GCC to build DLLs for Windows.  What
> GCC are you using?  Is this a native Windows build or are you
> cross-compiling?

I am cross-compiling with Mingw:

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (Gentoo 7.3.0-r4 p1.6) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Original example in my email was built natively with this GCC:

$ gcc --version
gcc (Gentoo 8.2.0-r2 p1.2) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


-- 
Ulya




Information forwarded to bug-libtool@HIDDEN:
bug#34219; Package libtool. Full text available.

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


Received: (at 34219) by debbugs.gnu.org; 28 Jan 2019 01:43:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 27 20:43:34 2019
Received: from localhost ([127.0.0.1]:48105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gnvxW-0001de-0F
	for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 20:43:34 -0500
Received: from smtp.simplesystems.org ([65.66.246.90]:52254)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bfriesen@HIDDEN>) id 1gnvxT-0001dQ-L1
 for 34219 <at> debbugs.gnu.org; Sun, 27 Jan 2019 20:43:32 -0500
Received: from freddy.simplesystems.org (freddy.simplesystems.org
 [65.66.246.65])
 by smtp.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id x0S1hOLa007045;
 Sun, 27 Jan 2019 19:43:24 -0600 (CST)
Date: Sun, 27 Jan 2019 19:43:24 -0600 (CST)
From: Bob Friesenhahn <bfriesen@HIDDEN>
X-X-Sender: bfriesen@HIDDEN
To: Ulya Trofimovich <skvadrik@HIDDEN>
Subject: Re: bug#34219: libtool cannot statically link dependencies into
 shared C++ library
In-Reply-To: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
Message-ID: <alpine.GSO.2.20.1901271938500.14882@HIDDEN>
References: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
User-Agent: Alpine 2.20 (GSO 67 2015-01-07)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII; format=flowed
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (smtp.simplesystems.org [65.66.246.90]); Sun, 27 Jan 2019 19:43:25 -0600 (CST)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34219
Cc: 34219 <at> debbugs.gnu.org, Libtool Bugs List <bug-libtool@HIDDEN>,
 Sergei Trofimovich <slyfox@HIDDEN>
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: -1.0 (-)

On Sun, 27 Jan 2019, Ulya Trofimovich wrote:

> Hello!
>
>
> I'm trying to build a portable DLL for windows with libtool. To do that,
> I need to eliminate dynamic dependencies on libstdc++ and libgcc. With
> GCC it is normally done by passing -static-libstdc++ -statlic-libgcc to
> the linker.

Usually people are using MinGW64 GCC to build DLLs for Windows.  What 
GCC are you using?  Is this a native Windows build or are you 
cross-compiling?

> Even though options -static-libstdc++ -static-libgcc are passed to the
> linker, hard-coded -nostdlib
> /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/crti.o
> /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/crtbeginS.o pulls in dynamic
> dependencies.

Libtool applies the libraries that GCC claims that it will use.

Libtool is a portability tool (supporting set of features commonly 
used and available on many platforms) and not intended to support 
all use cases.

Bob
-- 
Bob Friesenhahn
bfriesen@HIDDEN, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt




Information forwarded to bug-libtool@HIDDEN:
bug#34219; Package libtool. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 28 Jan 2019 01:43:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 27 20:43:55 2019
Received: from localhost ([127.0.0.1]:48108 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gnvxr-0001eE-B8
	for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 20:43:55 -0500
Received: from eggs.gnu.org ([209.51.188.92]:59918)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bfriesen@HIDDEN>) id 1gnvxm-0001dx-W0
 for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 20:43:51 -0500
Received: from lists.gnu.org ([209.51.188.17]:37203)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <bfriesen@HIDDEN>)
 id 1gnvxh-0006PQ-M8
 for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 20:43:45 -0500
Received: from eggs.gnu.org ([209.51.188.92]:41881)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bfriesen@HIDDEN>) id 1gnvxg-0002Cd-LY
 for bug-libtool@HIDDEN; Sun, 27 Jan 2019 20:43:45 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bfriesen@HIDDEN>) id 1gnvxf-0006Nm-LV
 for bug-libtool@HIDDEN; Sun, 27 Jan 2019 20:43:44 -0500
Received: from smtp.simplesystems.org ([65.66.246.90]:40981)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <bfriesen@HIDDEN>)
 id 1gnvxf-0006KW-6V
 for bug-libtool@HIDDEN; Sun, 27 Jan 2019 20:43:43 -0500
Received: from freddy.simplesystems.org (freddy.simplesystems.org
 [65.66.246.65])
 by smtp.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id x0S1hOLa007045;
 Sun, 27 Jan 2019 19:43:24 -0600 (CST)
Date: Sun, 27 Jan 2019 19:43:24 -0600 (CST)
From: Bob Friesenhahn <bfriesen@HIDDEN>
X-X-Sender: bfriesen@HIDDEN
To: Ulya Trofimovich <skvadrik@HIDDEN>
Subject: Re: bug#34219: libtool cannot statically link dependencies into
 shared C++ library
In-Reply-To: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
Message-ID: <alpine.GSO.2.20.1901271938500.14882@HIDDEN>
References: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
User-Agent: Alpine 2.20 (GSO 67 2015-01-07)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII; format=flowed
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (smtp.simplesystems.org [65.66.246.90]); Sun, 27 Jan 2019 19:43:25 -0600 (CST)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux (Android)
X-Received-From: 65.66.246.90
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: 34219 <at> debbugs.gnu.org, Libtool Bugs List <bug-libtool@HIDDEN>,
 Sergei Trofimovich <slyfox@HIDDEN>
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.1 (/)

On Sun, 27 Jan 2019, Ulya Trofimovich wrote:

> Hello!
>
>
> I'm trying to build a portable DLL for windows with libtool. To do that,
> I need to eliminate dynamic dependencies on libstdc++ and libgcc. With
> GCC it is normally done by passing -static-libstdc++ -statlic-libgcc to
> the linker.

Usually people are using MinGW64 GCC to build DLLs for Windows.  What 
GCC are you using?  Is this a native Windows build or are you 
cross-compiling?

> Even though options -static-libstdc++ -static-libgcc are passed to the
> linker, hard-coded -nostdlib
> /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/crti.o
> /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/crtbeginS.o pulls in dynamic
> dependencies.

Libtool applies the libraries that GCC claims that it will use.

Libtool is a portability tool (supporting set of features commonly 
used and available on many platforms) and not intended to support 
all use cases.

Bob
-- 
Bob Friesenhahn
bfriesen@HIDDEN, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt




Information forwarded to bug-libtool@HIDDEN:
bug#34219; Package libtool. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 27 Jan 2019 13:29:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 27 08:29:30 2019
Received: from localhost ([127.0.0.1]:47098 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gnkV6-0004b5-Oe
	for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 08:29:29 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58494)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <skvadrik@HIDDEN>) id 1gnkV4-0004at-QK
 for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 08:29:27 -0500
Received: from lists.gnu.org ([209.51.188.17]:46435)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <skvadrik@HIDDEN>) id 1gnkUz-0003fy-HR
 for submit <at> debbugs.gnu.org; Sun, 27 Jan 2019 08:29:21 -0500
Received: from eggs.gnu.org ([209.51.188.92]:40460)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <skvadrik@HIDDEN>) id 1gnkUy-0007VW-2G
 for bug-libtool@HIDDEN; Sun, 27 Jan 2019 08:29:21 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <skvadrik@HIDDEN>) id 1gnkUw-0003eS-UR
 for bug-libtool@HIDDEN; Sun, 27 Jan 2019 08:29:20 -0500
Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:43378)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <skvadrik@HIDDEN>) id 1gnkUw-0003bt-LP
 for bug-libtool@HIDDEN; Sun, 27 Jan 2019 08:29:18 -0500
Received: by mail-wr1-x435.google.com with SMTP id r10so14961542wrs.10
 for <bug-libtool@HIDDEN>; Sun, 27 Jan 2019 05:29:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:from:subject:cc:message-id:date:user-agent:mime-version
 :content-language:content-transfer-encoding;
 bh=Opuqb2w6ckJFiUKey2agkhGCnAz/Woz4OA8jBuGlMbQ=;
 b=IocmOHCraxd+a3XuhZLKUkWMFui3qm0H7dNxpteB/KjvciOW61szKYNBeSewf+jRck
 yZuZ/ivW2EBMDxLCzta58ryrLzI5VokrL9C15oIc02yC6aFUCk+F5LtLe/oKSsSTF2Dc
 eGNdnt5ASlCxTIVeJ3dVCikkmllhnBcrzrGUIJGU1aFVkAeioM6wHkqMkLmh8ZIwbHtP
 ZHjtCswYgrWUqLmocM/T7RP8RliALujVURwZHdPIlPyzA6DZvGZr+Xdv6CxdSZRonB91
 /1l41BAwnFYHexCmijjNp0in//TUUkXfPoSWStqRhVD8B4hUujmbK+9D024XVOPKZs5h
 wcKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:from:subject:cc:message-id:date:user-agent
 :mime-version:content-language:content-transfer-encoding;
 bh=Opuqb2w6ckJFiUKey2agkhGCnAz/Woz4OA8jBuGlMbQ=;
 b=egZlNhYMGh4evkimg3KgZ66WrUWe7l5Cpku870tvLMQP0RxjguzPJ4bdtLU2nKF6me
 04jy4RbiUT58jprM7+gLANPzHJz7o4Y/16QLKZw5IPRry4Dx3ve87yNDALd8rb2vGrYJ
 xmgHRQEnZ+l6eLuywmke7WmX/sFYCXP29ZR0HbOCP6orRTim+7MS3u7XuKRINfvOt2Iz
 fdGFdky8UhEmRQogFf/DvCl66w3KMzB6AKKNrJfFbz2v0GvCRprCShUt+6glVsf9CkJo
 xZ1xLw1Jj2y690yqPk7+IjwpPdKJv/Y9wz0NzBlbUaZmK7XHi/kPdgGh8WXXXXqtNslY
 0QnQ==
X-Gm-Message-State: AJcUukePlYhCw0GRhl9EzYf9GOmX3+kLQxD0MvIsrRhRPHzl98Bx4IBu
 uzcDk9c4hIJhkKZ46axz188=
X-Google-Smtp-Source: ALg8bN5vwRmpSQuoeUreJu0xl1xWnasAIEYoMHvAPRH2MfrbrBRBTVIR6ttlOpAspclQ/LQfSpudhA==
X-Received: by 2002:adf:91c3:: with SMTP id 61mr17672621wri.324.1548595756945; 
 Sun, 27 Jan 2019 05:29:16 -0800 (PST)
Received: from [192.168.1.250]
 (host86-128-188-168.range86-128.btcentralplus.com. [86.128.188.168])
 by smtp.googlemail.com with ESMTPSA id
 q12sm100344371wrx.31.2019.01.27.05.29.15
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 27 Jan 2019 05:29:16 -0800 (PST)
To: bug-libtool@HIDDEN
From: Ulya Trofimovich <skvadrik@HIDDEN>
Subject: libtool cannot statically link dependencies into shared C++ library
Message-ID: <3d03b4ed-11bd-05e6-1cc3-4b47cc31161a@HIDDEN>
Date: Sun, 27 Jan 2019 13:28:37 +0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::435
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Sergei Trofimovich <slyfox@HIDDEN>
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.0 (/)

Hello!


I'm trying to build a portable DLL for windows with libtool. To do that,
I need to eliminate dynamic dependencies on libstdc++ and libgcc. With
GCC it is normally done by passing -static-libstdc++ -statlic-libgcc to
the linker.

I would want these commands to result in a shared library that has no
dynamic dependencies on libstdc++ and libgcc:

$ libtool --tag=CXX --mode=compile g++ -c foo.cc
$ libtool --tag=CXX --mode=link g++ \
    -static-libstdc++ -static-libgcc \
    -o libfoo.la foo.lo -rpath /usr/lib

First problem is that libtool doesn't recognize these options, and as a
result it does not pass them to linker. This can be worked around by
wrapping them in -Wc,-static-libstdc++ -Wc,-static-libgcc.

Second problem is that libtool adds hard-coded link option -nostdlib and
some predefined startup object files. Because of that, -static-libstdc++
-statlic-libgcc have no effect and the resulting shared library still
has dynamic dependencies on libstdc++ and libgcc.

Let me show what I mean on a simple example (I will build native
library, not DLL, because it's simpler and shows the same problem).
Let's say, source code of our library is in a file foo.cc:

$ cat foo.cc
#include <iostream>
void foo(void)
{
    std::cout << "foo" << std::endl;
}

Without libtool, I can build shared library like this:

$ g++ -shared -fPIC foo.cc -o libfoo.so
$ objdump -x libfoo.so | grep NEEDED
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6

Note the dependency on libstdc++. I can get rid of it like this:

$ g++ -shared -fPIC foo.cc -o libfoo.so -static-libstdc++ -static-libgcc
$ objdump -x libfoo.so | grep NEEDED
  NEEDED               libm.so.6
  NEEDED               libc.so.6
  NEEDED               ld-linux-x86-64.so.2

With libtool, however, I'm stuck:

$ libtool --tag=CXX --mode=compile g++ -c foo.cc
libtool: compile:  g++ -c foo.cc  -fPIC -DPIC -o .libs/foo.o
libtool: compile:  g++ -c foo.cc -o foo.o >/dev/null 2>&1

$ libtool --tag=CXX --mode=link g++ \
    -Wc,-static-libstdc++ -Wc,-static-libgcc \
    -o libfoo.la foo.lo -rpath /usr/lib
libtool: link: rm -fr  .libs/libfoo.a .libs/libfoo.la .libs/libfoo.lai
.libs/libfoo.so .libs/libfoo.so.0 .libs/libfoo.so.0.0.0
libtool: link: x86_64-pc-linux-gnu-g++  -fPIC -DPIC -shared -nostdlib
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/crtbeginS.o  .libs/foo.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0
-L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../.. -lstdc++ -lm -lc
-lgcc_s /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/crtn.o
-static-libstdc++ -static-libgcc   -Wl,-soname -Wl,libfoo.so.0 -o
.libs/libfoo.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libfoo.so.0" && ln -s
"libfoo.so.0.0.0" "libfoo.so.0")
libtool: link: (cd ".libs" && rm -f "libfoo.so" && ln -s
"libfoo.so.0.0.0" "libfoo.so")
libtool: link: x86_64-pc-linux-gnu-ar cru .libs/libfoo.a  foo.o
libtool: link: x86_64-pc-linux-gnu-ranlib .libs/libfoo.a
libtool: link: ( cd ".libs" && rm -f "libfoo.la" && ln -s "../libfoo.la"
"libfoo.la" )

$ objdump -x .libs/libfoo.so | grep NEEDED
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libc.so.6
  NEEDED               libgcc_s.so.1

Even though options -static-libstdc++ -static-libgcc are passed to the
linker, hard-coded -nostdlib
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/crtbeginS.o pulls in dynamic
dependencies.

As a temporary workaround, I'm using slibtool:

    https://github.com/midipix-project/slibtool

But I think this use case is very common and needs to be fixed in
libtool as well.

When using libtool with autotools (my original setting), I would want to
just pass these flags to configure:

    ./configure LDFLAGS="-static-libstdc++ -static-libgcc"

Currently I also have to override libtool program in make:

    make LIBTOOL=slibtool


-- 
Ulya




Acknowledgement sent to Ulya Trofimovich <skvadrik@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to bug-libtool@HIDDEN:
bug#34219; 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.