pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/58963: gcc: LINK_LIBGCC_SPEC snafu



>Number:         58963
>Category:       pkg
>Synopsis:       gcc: LINK_LIBGCC_SPEC snafu
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 06 12:45:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current, 2024Q4, ...
>Organization:
The LINK_NETBSD_SPECULATION
>Environment:
>Description:
We have long carried a gcc patch that sets appropriate rpaths in LINK_LIBGCC_SPEC:

+  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG) $(prefix)/@GCC_TARGET_MACHINE@/lib/%M $(LINKER_RPATH_FLAG) $(libdir)/%M \"" \

Later on, to address PR pkg/48740 "lang/gcc44 to gcc46 linker fails because of whitespace" <https://gnats.netbsd.org/48740>, the spaces after LINKER_RPATH_FLAG were removed:

+  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MACHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \

However, the patch has been corrupted and the corruption has been propagated into various versions of gcc.  The @GCC_TARGET_MACHINE@ part and the spaces got lost at some point along the way and the patch became:

+  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LINKER_RPATH_FLAG) $(libdir)/%M \"" \

This doesn't work, and trips a new pkg_add check for REQUIRES (https://mail-index.netbsd.org/pkgsrc-changes/2024/08/25/msg306268.html) leading to failures like:

pkg_add: Missing required library: /pkg/2024Q4/gcc10//lib/./libgcc_s.so.1
pkg_add: Missing required library: /pkg/2024Q4/gcc10//lib/./libquadmath.so.0
pkg_add: Missing required library: /pkg/2024Q4/gcc10//lib/./libstdc++.so.7
pkg_add: Can't install dependency gcc10-libs>=10.2.0
pkg_add: Expected dependency gcc10-libs>=10.2.0 still missing

(The spurious ./ path component is a separate issue which I have not investigated.)

With the patch corrupted, the SUBST_* logic to substitute a string for @GCC_TARGET_MACHINE@ tripped a warning that the substitution didn't do anything, so the SUBST_* logic was removed (https://mail-index.netbsd.org/pkgsrc-changes/2020/04/27/msg211716.html), leaving no indication that the package is broken at all.
>How-To-Repeat:
1. bootstrap pkgsrc
2. build any package that depends on gcc10-libs or gcc14-libs or whatever
>Fix:
1. restore @GCC_TARGET_MACHINE@ in the patch
2. restore the SUBST_* block for GCC_TARGET_MACHINE
3. make sure this happens for _every single gcc_ copypasta bowl in pkgsrc and wip



Home | Main Index | Thread Index | Old Index