lto-rebuild fails to find archives for GCC 12 -> 13 update
zeule opened this issue · comments
Eugene Shalygin commented
Because a GCC 12 version contains"p13".
Eugene Shalygin commented
A simple fix:
--- /usr/bin/lto-rebuild.orig 2023-05-02 23:20:59.064006276 +0200
+++ /usr/bin/lto-rebuild 2023-05-05 21:10:58.499995951 +0200
@@ -27,6 +27,7 @@
{
local prefix="${EROOT%/}/usr/lib"
local suffix="\.a"
+local all_archives=()
local archives=()
local packages=()
local GCC_VER=""
@@ -41,16 +42,18 @@
# Exclude /usr/lib/gcc/<arch> because these are internal
# to the [cross-]compilers on the system
-mapfile -t archives < <(
+mapfile -t all_archives < <(
find "${prefix}"{,64,32} -type f -name "*${suffix}" \
- -exec readelf -p .comment {} + \
-o -path "${prefix}64/gcc" -prune \
-o -path "${prefix}32/gcc" -prune \
- -o -path "${prefix}/gcc" -prune 2> /dev/null | \
- grep -v "${GCC_VER}" | grep -B3 "GCC:" | \
- grep -o "${prefix}.*${suffix}" | uniq
+ -o -path "${prefix}/gcc" -prune 2> /dev/null
)
+for a in ${all_archives[@]}; do
+ gcc_ver=$(readelf -p .comment "$a" 2>/dev/null | grep "GCC:" | sed -E 's/^.+\(.+\) ([0-9]+).*$/\1/' | sort -u | head -1 )
+ [[ ! -z $gcc_ver && $gcc_ver != $GCC_VER ]] && archives+=( "$a" )
+done
+
if [[ ${#archives[@]} -eq 0 ]]
then
echo "No problems found!" >&2