Skip to content

Commit

Permalink
Use gcc --sysroot in rap stage3 post glibc install
Browse files Browse the repository at this point in the history
Since glibc now has non-prefixed filenames in
`$EPREFIX/usr/lib64/libc.so`, it picks up non-prefixed
`/lib64/libc.so.6` from stage2 gcc, unless we replace its -I, -L, and
-B options by --sysroot. Then it will look at the same places as
the future stage3 gcc.

This avoids issues building binutils, which can't find dlopen in
older `/lib64/libc.so.6`, since dlopen used to be in `libdl`
instead.

The whole logic no longer tests for compiler == gcc, since clang
is only used for non-rap on MacOS.

Closes: https://bugs.gentoo.org/895240
Signed-off-by: Bart Oldeman <[email protected]>
Closes: #22
Signed-off-by: Sam James <[email protected]>
  • Loading branch information
bartoldeman authored and thesamesam committed Mar 4, 2023
1 parent f4bae8f commit 97f76fa
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/bootstrap-prefix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2111,13 +2111,11 @@ bootstrap_stage3() {
)
# use the new dynamic linker in place of rpath from now on.
RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9] | sed s"!${ROOT}/$(get_libdir)/ld-lsb.*!!")
export LDFLAGS="-L${ROOT}/usr/$(get_libdir) -Wl,--dynamic-linker=${RAP_DLINKER}"
if [[ ${compiler_type} == gcc ]] ; then
# make sure these flags are used even in places that ignore/strip CPPFLAGS/LDFLAGS
export LDFLAGS="-B${ROOT}/usr/$(get_libdir) ${LDFLAGS}"
export CC="gcc ${CPPFLAGS} ${LDFLAGS}"
export CXX="g++ ${CPPFLAGS} ${LDFLAGS}"
fi
export CPPFLAGS="--sysroot=${ROOT}"
export LDFLAGS="-Wl,--dynamic-linker=${RAP_DLINKER}"
# make sure these flags are used even in places that ignore/strip CPPFLAGS/LDFLAGS
export CC="gcc ${CPPFLAGS} ${LDFLAGS}"
export CXX="g++ ${CPPFLAGS} ${LDFLAGS}"
BOOTSTRAP_RAP=yes \
pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1

Expand Down

0 comments on commit 97f76fa

Please sign in to comment.