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

copy_gcc_libs() with multilib #255

Open
berney opened this issue Jan 17, 2025 · 0 comments
Open

copy_gcc_libs() with multilib #255

berney opened this issue Jan 17, 2025 · 0 comments

Comments

@berney
Copy link
Contributor

berney commented Jan 17, 2025

The current implementation of the copy_gcc_libs() helper function doesn't work for multilib systems.

# Copy libgcc/libstdc++ libs
function copy_gcc_libs() {
local lib_gcc lib_gomp lib_stdc lib
mkdir -p "${_EMERGE_ROOT}/${_LIB}"
lib_gcc="$(find /usr/lib/ -name libgcc_s.so.1)"
lib_gomp="$(find /usr/lib/ -name libgomp.so.1)"
lib_stdc="$(find /usr/lib/ -name libstdc++.so.6)"
for lib in "${lib_gcc}" "${lib_gomp}" "${lib_stdc}"; do
cp "${lib}" "${_EMERGE_ROOT}/${_LIB}/"
done
}

The find commands will return multiple lines for the amd64 and x86 libraries, and the cp command will fail due to embedded newlines causing the file to not be found.

cp: cannot stat '/usr/lib/gcc/x86_64-pc-linux-gnu/14/libgcc_s.so.1'$'\n''/usr/lib/gcc/x86_64-pc-linux-gnu/14/32/libgcc_s.so.1': No such file or directory

I'm working on a PR to fix this.
However, one thing confusing me is the code use ${_EMERGE_ROOT}${_LIB}, and for amd64 this will be /emerge-root/lib64. So, the source will be /usr/lib/ and the destination will end up being /lib64/ (in the resulting container) - e.g no /usr/ and changes from just lib to lib64.

With merged-usr, /lib{,64} are symlinks to /usr/lib,{64}. But in the resulting container it won't be doing merged-usr symlinks.
The /etc/ld.so.conf doesn't contained the /lib{,64} directory. In my experiments it contains:

# contents of /etc/env.d directory.
include ld.so.conf.d/*.conf
# ld.so.conf autogenerated by env-update; make all changes to
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64

Should copy_gcc_libs() be reproducing the /usr/lib{,64} directory structure?
Should the resulting containers be following the merged-usr layout with symlinks?
Or is it ok (safe) to change this to /lib{,64) (drop /usr/)?
If the /usr/ bit is dropped, should /etc/ld.so.conf be updated to include /lib{,64} (no /usr/) and /etc/ld.so.cache in /emerge_root be regenerated?

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

No branches or pull requests

1 participant