On Thu, Feb 1, 2024 at 4:10 PM David Abdurachmanov david.abdurachmanov@gmail.com wrote:
On Thu, Feb 1, 2024 at 3:44 PM Richard W.M. Jones rjones@redhat.com wrote:
On Thu, Feb 01, 2024 at 02:24:10PM +0100, Florian Weimer wrote:
- David Abdurachmanov:
Hi Florian,
I was trying to build the latest glibc [0] in Fedora 40 for riscv64, but it failed. It seems to be related to your last commit.
[..]
- ln -s libBrokenLocale.so.1 usr/lib64/libBrokenLocale.so
- for sl in `find $RPM_BUILD_ROOT/$pfx$lib -maxdepth 1 -type l`
- set +x
- ln -s . usr/lib64/lp64d
ln: failed to create symbolic link 'usr/lib64/lp64d/.': File exists error: Bad exit status from /var/tmp/rpm-tmp.7qPZkS (%install) [..]
Full log: http://fedora.riscv.rocks/kojifiles/work/tasks/9391/1599391/build.log Build info: http://fedora.riscv.rocks/koji/taskinfo?taskID=1599391
This is probably related to this: https://src.fedoraproject.org/rpms/glibc/blob/rawhide/f/glibc.spec#_1279
Cheers, david
[0] https://src.fedoraproject.org/rpms/glibc/c/0bd93c5697bc60e4f4a84f5b55c98f351...
That refers to:
%ifarch riscv64 # RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d. # Make these be symlinks to /lib64 or /usr/lib64 respectively. See: # https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/... for d in %{glibc_sysroot}%{_libdir} %{glibc_sysroot}/%{_lib}; do mkdir -p $d (cd $d && ln -sf . lp64d) done %endif
Although it was me who added this in 2018, I think it looks like a mess now. Why do we need this .../lp64d subdir for Fedora?
That's because RISCV uses ../lib64/<ABI> as the default library path.
[davidlt@fedora-riscv ~]$ ld --verbose | grep SEARCH_DIR | tr -s ' ;' '\n' SEARCH_DIR("=/usr/riscv64-redhat-linux/lib64/lp64d") SEARCH_DIR("=/usr/riscv64-redhat-linux/lib64") SEARCH_DIR("=/usr/riscv64-redhat-linux/lib6464/lp64d") SEARCH_DIR("=/usr/lib6464/lp64d") SEARCH_DIR("=/usr/lib64") SEARCH_DIR("=/usr/local/lib64/lp64d") SEARCH_DIR("=/usr/local/lib64") SEARCH_DIR("=/lib64/lp64d") SEARCH_DIR("=/lib64") SEARCH_DIR("=/usr/lib64/lp64d") SEARCH_DIR("=/usr/riscv64-redhat-linux/lib") SEARCH_DIR("=/usr/local/lib") SEARCH_DIR("=/lib") SEARCH_DIR("=/usr/lib")
I forgot to attach the default search paths for ld-linux-riscv6-lp64d.so.1:
[..] Shared library search path: (libraries located via /etc/ld.so.cache) /lib64/lp64d (system search path) /usr/lib64/lp64d (system search path) [..]
There are some (probably now old) binutils versions that didn't even look at the lib64 directory at all.
Thus by default RISCV looks like multilib, and looks into the proper ABI directories.
We actually compile GCC as multilib with just one ABI listed.
[..] --with-arch=rv64gc --with-abi=lp64d --with-multilib-list=lp64d [..]
Please try this:
diff --git a/glibc.spec b/glibc.spec index 6116752..e4d5e44 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1571,6 +1571,10 @@ for lib in lib lib64; do set +x slbase=$(basename $sl) sltarget=$(basename $(readlink $sl))
if test "$sltarget" = . ; then
# This is the lp64d symbolic link on riscv64, see above.
continue
fi if ! test -r usr/$lib/$sltarget; then echo "$sl: inferred $sltarget ($(readlink $sl)) missing" exit 1
We will have to fix this again (and wrap-find-debuginfo.sh and as well) once Fedora adopts the standard RISC-V paths.
Shouldn't we adopt the normal Fedora paths instead?
That's definitely a discussion object, but we need to check if this actually works.
Basically RISCV doesn't comply with FHS, unless something changed.
david
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org