Bug 2047389

Summary: libtool: don't do de-duplication of $postdeps
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: libtoolAssignee: Frédéric Bérat <fberat>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: codonell, fberat, fjanus, fweimer, ivazqueznet, jakub, karsten, kasal, mkulik, odubaj, panovotn, praiskup, rhbugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libtool-2.4.6-50.fc35 libtool-2.4.6-50.fc36 libtool-2.4.6-50.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-05 18:30:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2043517    

Description Dan Horák 2022-01-27 18:24:31 UTC
libtool contains a variable $postdeps that defines the libraries required for linking with some basic libs, for C++ it looks like 

postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"

As shown in https://bugzilla.redhat.com/show_bug.cgi?id=2043517#c10 they can't be de-duplicated, because it might cause "missing symbols" issue for libgcc_s, see Florian's comment.

The following snippet disables the de-duplication for Linux, similar to other OSes already listed there.

--- libtool.orig	2022-01-27 18:02:50.421704711 +0000
+++ libtool	2022-01-27 18:02:56.221776202 +0000
@@ -2930,7 +2930,7 @@
     case $host in
       # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
       # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
-      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2* | *linux*)
+      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
         # don't eliminate duplications in $postdeps and $predeps
         opt_duplicate_compiler_generated_deps=:
         ;;



Version-Release number of selected component (if applicable):
libtool-2.4.6-47.fc36

Comment 1 Frédéric Bérat 2022-02-03 13:21:22 UTC
(In reply to Dan Horák from comment #0)
> Version-Release number of selected component (if applicable):
> libtool-2.4.6-47.fc36

Hello, please confirm the version you are referring to. libtool-2.4.6-47.fc36 contains the following code:

usr/bin/libtool-2932-
usr/bin/libtool-2933-    case $host in
usr/bin/libtool:2934:      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
usr/bin/libtool-2935-      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
usr/bin/libtool-2936-      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
usr/bin/libtool-2937-        # don't eliminate duplications in $postdeps and $predeps
usr/bin/libtool-2938-        opt_duplicate_compiler_generated_deps=:
usr/bin/libtool-2939-        ;;


usr/share/libtool/build-aux/ltmain.sh-2417-
usr/share/libtool/build-aux/ltmain.sh-2418-    case $host in
usr/share/libtool/build-aux/ltmain.sh:2419:      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
usr/share/libtool/build-aux/ltmain.sh-2420-      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
usr/share/libtool/build-aux/ltmain.sh-2421-      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
usr/share/libtool/build-aux/ltmain.sh-2422-        # don't eliminate duplications in $postdeps and $predeps
usr/share/libtool/build-aux/ltmain.sh-2423-        opt_duplicate_compiler_generated_deps=:

Extracted from libtool-2.4.6-47.fc36 (all arch are the same, but checked on x86_64 and ppc64le): https://koji.fedoraproject.org/koji/buildinfo?buildID=1888312

Comment 2 Frédéric Bérat 2022-02-03 13:30:21 UTC
Unless I got it wrong and you patch is actually inverted ?

Comment 3 Dan Horák 2022-02-03 13:45:40 UTC
(In reply to Frédéric Bérat from comment #2)
> Unless I got it wrong and you patch is actually inverted ?

ah, yes, you are right, the path is inverted, we need to add linux into the exceptions

Comment 4 Frédéric Bérat 2022-02-03 15:50:23 UTC
Considering the change, it looks like the more the time passes, the more the "opt_duplicate_compiler_generated_deps" option is enabled by default.

I had a look at the libtool history, in order to trace back how and why this option exists at all and is set that way. After all, keeping a compiler generated list as-is would be sensible, and I wondered why this switch case is there at all.

It turns out that it looks like the deduplication almost went away in 2001, but got re-introduced in favor of a merge conflict resolution between multiple development branches. After multiple refactoring, this option was introduced specifically for cygwin, then the case continued to grow year after year.

Considering that linkage duplication isn't harmful in principle, and that keeping the compiler generated list makes sense, I started a discussion with upstream in order to consider making it the default behavior for all hosts (instead of simply adding another case).

Comment 5 Ben Cotton 2022-02-08 20:05:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 6 Fedora Update System 2022-02-22 18:23:05 UTC
FEDORA-2022-e91417cb43 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-e91417cb43

Comment 7 Fedora Update System 2022-02-23 16:08:10 UTC
FEDORA-2022-e91417cb43 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-e91417cb43`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-e91417cb43

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-02-24 01:44:30 UTC
FEDORA-2022-08c0abe851 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-08c0abe851`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-08c0abe851

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2022-03-05 18:30:20 UTC
FEDORA-2022-e91417cb43 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2022-03-26 14:59:24 UTC
FEDORA-2022-08c0abe851 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.