Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 567442 - sys-devel/gcc: minispecs duplicate LDPATHs which induces gcc-config to generate duplicate ld.so.conf.d entries
Summary: sys-devel/gcc: minispecs duplicate LDPATHs which induces gcc-config to genera...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal trivial
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-03 10:03 UTC by calimeroteknik
Modified: 2018-06-22 21:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description calimeroteknik 2015-12-03 10:03:33 UTC
gcc-config generates duplicate entries in /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf when there are several gcc profiles which point to the same compiler.

Fix idea: add `sort -u` to the gcc-config script (if it doesn't break the desired effect of `tac`?)

Reproducible: Always

Steps to Reproduce:
1.
Switch to a Gentoo profile that provides several gcc profiles, such as hardened.

2.
Switch to whichever profile using gcc-config.

~ # gcc-config -l
 [1] x86_64-pc-linux-gnu-4.9.3 *
 [2] x86_64-pc-linux-gnu-4.9.3-hardenednopie
 [3] x86_64-pc-linux-gnu-4.9.3-hardenednopiessp
 [4] x86_64-pc-linux-gnu-4.9.3-hardenednossp
 [5] x86_64-pc-linux-gnu-4.9.3-vanilla
~ # gcc-config 1
 * Switching native-compiler to x86_64-pc-linux-gnu-4.9.3 ... [ ok ]

Actual Results:  
~ # cat /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3

Expected Results:  
~ # cat /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3


I traced this behaviour down to /usr/bin/gcc-config line 427, here is the excerpt:

# Regardless of the profile selected, keep the runtime lookup
# paths stable.  Otherwise, all the apps that were built with
# a new compiler will start trying to use older versions of
# the libs, and life gets sad.  We work off the assumption
# that every shared library gcc ships is ABI compatible (as
# is the point of SONAMEs).  We don't have to worry about
# static libraries here as gcc itself will take care of
# linking against its own internal paths first. #297685
local MY_LDPATH
MY_LDPATH=$(${SED} -n \
        -e '/^LDPATH=/{s|LDPATH=||;s|"||g;s|:|\n|g;p}' \
        "${GCC_ENV_D}"/${CHOST}-* | tac
)

I am not sure whether the above results are intended, but this code seems to explicitly generate them.
Comment 1 SpanKY gentoo-dev 2015-12-03 21:08:25 UTC
pretty sure it's always been this way as long as minispecs have been around

gcc-config has to be careful of sorting as the quoted comment covers (bug 297685)
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2018-06-22 21:19:21 UTC
We should be able to close this now that gcc-4 and earlier is masked.
AFAIK the mechanism is completely different in current stable gcc-6 and gcc-7.