-
Notifications
You must be signed in to change notification settings - Fork 222
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
build: Don't assume that libc.so is always in /usr/lib or /usr/lib64 #923
build: Don't assume that libc.so is always in /usr/lib or /usr/lib64 #923
Conversation
The location for public shared libraries can change from one operating system distribution to another. eg., while Fedora uses /usr/lib and /usr/lib64, depending on the hardware architecture, Debian uses paths like /usr/lib/x86_64-linux-gnu. Therefore, it's best not to assume anything and ask the toolchain. containers#923
1ee6e27
to
c8aaed5
Compare
Build succeeded.
|
@@ -27,7 +27,22 @@ if ! cd "$1"; then | |||
exit 1 | |||
fi | |||
|
|||
go build -trimpath -ldflags "-extldflags '-Wl,-rpath,/run/host/usr/lib -Wl,-rpath,/run/host/usr/lib64' -linkmode external -X github.com/containers/toolbox/pkg/version.currentVersion=$3" -o "$2/toolbox" | |||
if ! libc_dir=$("$4" --print-file-name=libc.so); then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish there was a way to do this with Meson's compiler.find_library.
Thanks for this! Testing on Debian would be helpful in this case. One solution is to add support to SoftwareFactory or just use GitHub Actions since we mainly want to test the build and that can be done in a container, too. Further testing would require support in SoftwareFactory since we require a VM for testing purpose and not a container. |
Building Toolbx requires a C compiler [1], which defaults to GCC on Fedora and CentOS Stream. It's good to explicitly require it, so that it doesn't go missing from the build. Showing the version of the C compiler is a big help when debugging weird build problems involving the toolchain. A following commit will use CGO to link to libsubid.so, which will only increase the relevance of the C compiler. [1] Commit c8aaed5 containers#923
Building Toolbx requires a C compiler [1], which defaults to GCC on Fedora and CentOS Stream. It's good to explicitly require it, so that it doesn't go missing from the build. Showing the version of the C compiler is a big help when debugging weird build problems involving the toolchain. A following commit will use CGO to link to libsubid.so, which will only increase the relevance of the C compiler. [1] Commit c8aaed5 containers#923 containers#1218
The location for public shared libraries can change from one operating
system distribution to another. eg., while Fedora uses /usr/lib and
/usr/lib64, depending on the hardware architecture, Debian uses paths
like /usr/lib/x86_64-linux-gnu. Therefore, it's best not to assume
anything and ask the toolchain.