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

build: Don't assume that libc.so is always in /usr/lib or /usr/lib64 #923

Merged

Conversation

debarshiray
Copy link
Member

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.

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
@debarshiray debarshiray force-pushed the wip/rishi/rpath-query-toolchain branch from 1ee6e27 to c8aaed5 Compare November 13, 2021 02:18
@softwarefactory-project-zuul
Copy link

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
Copy link
Member Author

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.

@debarshiray debarshiray merged commit c8aaed5 into containers:main Nov 13, 2021
@debarshiray debarshiray deleted the wip/rishi/rpath-query-toolchain branch November 13, 2021 11:48
@HarryMichal HarryMichal added 2. Build System Issue is related to the build system 3. Enhancement Improvement to an existing feature 7. Needs tests The work needs new test cases added labels Nov 13, 2021
@HarryMichal
Copy link
Member

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.

debarshiray added a commit to containers/containertoolbx.org that referenced this pull request Dec 9, 2021
@HarryMichal HarryMichal added this to the Release 0.1.0 milestone Dec 10, 2021
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jan 27, 2023
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
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jan 27, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. Build System Issue is related to the build system 3. Enhancement Improvement to an existing feature 7. Needs tests The work needs new test cases added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants