Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gcc --sysroot in rap stage3 post glibc install #22

Closed

Conversation

bartoldeman
Copy link
Contributor

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.

Copy link
Member

@chewi chewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! Just one minor thing, gcc documents the --sysroot option as being --sysroot=dir so please add the =. That's how I've always used it.

Now I understand why I didn't see this issue when testing. I was bootstrapping on top of Gentoo, and my host libc matched the prefix libc, so it didn't break. When I tested cross-compiling, I didn't use bootstrap-prefix.sh, but used cross-boss, which already adds --sysroot to the flags.

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.

Signed-off-by: Bart Oldeman <bart.oldeman@calculquebec.ca>
@bartoldeman
Copy link
Contributor Author

Thanks for the feedback, I added the =. Funnily enough GCC docs have --sysroot= but --isysroot without the =.

There's another issue in the bootstrap much later with dev-libs/libgcrypt when bootstrapping on a CentOS7 kernel, which can be fixed by setting the -getentropy USE flag. I'm waiting for my bootstrap to finish, and will then submit a PR about that too.

@zigford
Copy link

zigford commented Mar 3, 2023

With this patch, I was finally able to run gentoo-prefix on RedHat 8. Thanks

@bartoldeman
Copy link
Contributor Author

I submitted the getentropy fix as
gentoo/gentoo#29906

@APN-Pucky
Copy link

Debian 11 works with this too.

@gentoo-bot gentoo-bot closed this in 97f76fa Mar 4, 2023
@thesamesam
Copy link
Member

Many thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants