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

Error during bazel build: cannot find /usr/lib/libc.so.6 #97

Open
ArmaanT opened this issue Oct 10, 2022 · 4 comments
Open

Error during bazel build: cannot find /usr/lib/libc.so.6 #97

ArmaanT opened this issue Oct 10, 2022 · 4 comments
Labels
question This issue is a question. Close the loop with documentation?

Comments

@ArmaanT
Copy link

ArmaanT commented Oct 10, 2022

I've been running into an issue where I get the following error when trying to use this toolchain to build zlib:

/home/atobaccowalla/.cache/bazel/_bazel_atobaccowalla/49400f0e8b5fdbc2448f09cd587fc4d3/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-ld: cannot find /usr/lib/libc.so.6
/home/atobaccowalla/.cache/bazel/_bazel_atobaccowalla/49400f0e8b5fdbc2448f09cd587fc4d3/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-ld: cannot find /usr/lib/libc_nonshared.a
/home/atobaccowalla/.cache/bazel/_bazel_atobaccowalla/49400f0e8b5fdbc2448f09cd587fc4d3/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-ld: cannot find /usr/lib/ld-linux-x86-64.so.2

None of those files exist on my machine in /usr/lib, but they do exist in /usr/lib64 (ex /usr/lib64/libc.so.6):

➜ find /usr -name 'libc.so.6'
/usr/lib64/libc.so.6

That being said, I'm not sure if this toolchain is (or should be) checking paths on my machine rather than only looking inside the downloaded sysroot which contains those files in the expected location:

➜ find /home/atobaccowalla/.cache/bazel/_bazel_atobaccowalla/49400f0e8b5fdbc2448f09cd587fc4d3/execroot/gcc-toolchain-sample/external/sysroot_x86_64/ -name 'libc.so.6'
/home/atobaccowalla/.cache/bazel/_bazel_atobaccowalla/49400f0e8b5fdbc2448f09cd587fc4d3/execroot/gcc-toolchain-sample/external/sysroot_x86_64/usr/lib/libc.so.6

I'm including the full output I get when trying to build here and I've also created a minimal reproduction repo here.

@cgrindel cgrindel added question This issue is a question. Close the loop with documentation? bug Something isn't working and removed question This issue is a question. Close the loop with documentation? labels Oct 11, 2022
@ArmaanT
Copy link
Author

ArmaanT commented Oct 11, 2022

After experimenting around a bit more, everything works as expected if I swap the configure_make in zlib.BUILD with the following:

cc_library(
    name = "zlib",
    srcs = glob(["*.c"]),
    hdrs = glob(["*.h"]),
    copts = [
        "-Dverbose=-1",
    ],
    includes = ["."],
    visibility = ["//visibility:public"],
)

I wonder if there's some weird interaction going on between the toolchain and rules_foreign_cc

@cgrindel
Copy link

@ArmaanT I just wanted to give you a heads-up that the primary maintainer for this repo will not be available for a few weeks. They have the expertise to best help with this issue. Sorry for the delay.

@ArmaanT
Copy link
Author

ArmaanT commented Oct 18, 2022

No problem at all. Thanks for the heads up!

@f0rmiga
Copy link
Owner

f0rmiga commented Feb 1, 2023

@ArmaanT Sorry for the delay. This got lost on my list when I came back. Did you resolve this? The problem you are hitting is that your Linux distribution uses /usr/lib64 instead of the more common /usr/lib. This behaviour is controlled by the following line:

https://github.com/aspect-build/gcc-toolchain/blob/22862ac5637edc946a2d03f7fcc413b8c897b44f/sysroot/Dockerfile#L155

What distro are you using?

@f0rmiga f0rmiga added question This issue is a question. Close the loop with documentation? and removed bug Something isn't working labels Feb 1, 2023
@gregmagolan gregmagolan moved this to 📋 Backlog in Open Source Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This issue is a question. Close the loop with documentation?
Projects
None yet
Development

No branches or pull requests

3 participants