bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] build: Fix shared build with gcc-7.


From: Jan Nieuwenhuizen
Subject: Re: [PATCH] build: Fix shared build with gcc-7.
Date: Thu, 19 Mar 2020 12:13:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Samuel Thibault writes:

Hello,

> Jan Nieuwenhuizen, le sam. 14 mars 2020 11:35:18 +0100, a ecrit:
>> i586-pc-gnu-gcc -L. -L/tmp/guix-build-hurd-0.9-1.91a5167.drv-0/source/libbpf/
...
 -o test-fcntl \
>>               test-fcntl.o \
>>       '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libfshelp/libfshelp.so 
>> \
>>              -lpthread \
>>       '-Wl,-)'
>> i586-pc-gnu-ld: warning: libshouldbeinlibc.so.0.3, needed by 
>> ../libfshelp/libfshelp.so, not found (try using -rpath or -rpath-link)

> ? One shouldn't need to add rpaths for this to succeed, -L should be
> more than enough.

Until now, this has been my undestanding too.  (see below)

> What seems odd in your build log is
> -L/tmp/guix-build-hurd-0.9-1.91a5167.drv-0/source/libshouldbeinlibc/
> which seems to be pointing to the source instead of the build tree. I
> guess that's where something needs to be fixed.

Ah, my bad.  I pasted intermediate debugging output where I alreaded
modified Makeconf; sorry!

>  When I build the Hurd,
> I'd have something like this instead:

> gcc -L. -L../libihash/ -L../libports/ -L../libiohelp/ -L../libhurdbugaddr/ 
> -L../libshouldbeinlibc/ -L../libfshelp/ -std=gnu99 -fgnu89-inline -Wall -g 
> -O3 -fno-strict-aliasing  -g -O2    -uargp_program_bug_address -o test-fcntl \
>               test-fcntl.o \
>       '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libfshelp/libfshelp.so \
>                 -lpthread \
>       '-Wl,-)'
>
> and then gcc can find libshouldbeinlibc.so.0.3 in ../libshouldbeinlibc/
> as expected.

Yes, luckily I get that too, on the Hurd.

However, in the cross build from Guix, when I run

--8<---------------cut here---------------start------------->8---
$ i586-pc-gnu-gcc -L. -L../libihash/ -L../libports/ -L../libiohelp/ 
-L../libhurdbugaddr/ -L../libshouldbeinlibc/ -L../libfshelp/ -std=gnu99 
-fgnu89-inline -Wall -g -O3 -fno-strict-aliasing  -g -O2    
-uargp_program_bug_address -o test-fcntl \
              test-fcntl.o \
      '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libfshelp/libfshelp.so \
                -lpthread \
      '-Wl,-)'
--8<---------------cut here---------------end--------------->8---

I get

--8<---------------cut here---------------start------------->8---
i586-pc-gnu-ld: warning: libshouldbeinlibc.so.0.3, needed by 
../libfshelp/libfshelp.so, not found (try using -rpath or -rpath-link)
i586-pc-gnu-ld: warning: libiohelp.so.0.3, needed by ../libfshelp/libfshelp.so, 
not found (try using -rpath or -rpath-link)
i586-pc-gnu-ld: warning: libports.so.0.3, needed by ../libfshelp/libfshelp.so, 
not found (try using -rpath or -rpath-link)
i586-pc-gnu-ld: warning: libihash.so.0.3, needed by ../libfshelp/libfshelp.so, 
not found (try using -rpath or -rpath-link)
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_get_right'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`__assert_fail_backtrace'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_port_ref'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_locp_find'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_destroy_right'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to `exec_reauth'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to `idvec_free'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_remove'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_port_deref_weak'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_find'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_hash32'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_create_class'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_create_port'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to `idvec_setid'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_locp_remove'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_locp_add'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_port_deref'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`ports_port_ref_weak'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`idvec_merge_auth'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to `make_idvec'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`idvec_tail_contains'
i586-pc-gnu-ld: ../libfshelp/libfshelp.so: undefined reference to 
`hurd_ihash_add'
collect2: error: ld returned 1 exit status
--8<---------------cut here---------------end--------------->8---

Note how it says: (try using -rpath ...?).  While I also thought that -L
should be enough, I "simply" obeyed and tried that; when I do that:

--8<---------------cut here---------------start------------->8---
i586-pc-gnu-gcc -L. -Wl,-rpath=../libihash/ -Wl,-rpath=../libports/ 
-Wl,-rpath=../libiohelp/ -Wl,-rpath=../libhurdbugaddr/ 
-Wl,-rpath=../libshouldbeinlibc/ -L../libfshelp/ -std=gnu99 -fgnu89-inline 
-Wall -g -O3 -fno-strict-aliasing  -g -O2    -uargp_program_bug_address -o 
test-fcntl \
              test-fcntl.o \
      '-Wl,-(' ../libhurdbugaddr/libhurdbugaddr.so ../libfshelp/libfshelp.so \
                -lpthread \
      '-Wl,-)'
--8<---------------cut here---------------end--------------->8---

it succeeds.  So, then I sent off the bug report with patch.

So something is different....Meanwhile, I have compared running this
command using *gcc -v -v and running collect2 by hand (see logs
attached).

The "interesting" bits differences are these, the failing cross collect2:

--8<---------------cut here---------------start------------->8---
...
attempt to open ../libfshelp/libfshelp.so succeeded
../libfshelp/libfshelp.so
attempt to open ./libpthread.so failed
attempt to open ./libpthread.a failed
attempt to open ../libihash//libpthread.so failed
attempt to open ../libihash//libpthread.a failed
...
libshouldbeinlibc.so.0.3 needed by ../libfshelp/libfshelp.so
attempt to open 
/gnu/store/wwmnc3xizcq0nxrbrihgj6w0nk89vlyi-glibc-cross-i586-pc-gnu-2.31/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/j7z6n0m18djk0pka51ffivmjc073qcj9-gcc-cross-i586-pc-gnu-7.5.0/i586-pc-gnu/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/fx77mhyfi9mx0ihg1wi76gxpfqsyi0vn-hurd-0.9-1.91a5167/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/wwmnc3xizcq0nxrbrihgj6w0nk89vlyi-glibc-cross-i586-pc-gnu-2.31/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/j7z6n0m18djk0pka51ffivmjc073qcj9-gcc-cross-i586-pc-gnu-7.5.0/i586-pc-gnu/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open /no-ld-lib-path/libshouldbeinlibc.so.0.3 failed
attempt to open 
/gnu/store/jd7iv440iw3ppcpzx2qwg0ab6y7qm9sn-binutils-cross-i586-pc-gnu-2.34/i586-pc-gnu/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/wwmnc3xizcq0nxrbrihgj6w0nk89vlyi-glibc-cross-i586-pc-gnu-2.31/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/j7z6n0m18djk0pka51ffivmjc073qcj9-gcc-cross-i586-pc-gnu-7.5.0/i586-pc-gnu/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/fx77mhyfi9mx0ihg1wi76gxpfqsyi0vn-hurd-0.9-1.91a5167/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/wwmnc3xizcq0nxrbrihgj6w0nk89vlyi-glibc-cross-i586-pc-gnu-2.31/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open 
/gnu/store/j7z6n0m18djk0pka51ffivmjc073qcj9-gcc-cross-i586-pc-gnu-7.5.0/i586-pc-gnu/lib/libshouldbeinlibc.so.0.3
 failed
attempt to open /no-ld-lib-path/libshouldbeinlibc.so.0.3 failed
attempt to open 
/gnu/store/jd7iv440iw3ppcpzx2qwg0ab6y7qm9sn-binutils-cross-i586-pc-gnu-2.34/i586-pc-gnu/lib/libshouldbeinlibc.so.0.3
 failed
...
--8<---------------cut here---------------end--------------->8---

the succeeding cross collect2, adding -rpath

--8<---------------cut here---------------start------------->8---
...
libshouldbeinlibc.so.0.3 needed by ../libfshelp/libfshelp.so
attempt to open ../libihash//libshouldbeinlibc.so.0.3 failed
attempt to open ../libports//libshouldbeinlibc.so.0.3 failed
attempt to open ../libiohelp//libshouldbeinlibc.so.0.3 failed
attempt to open ../libhurdbugaddr//libshouldbeinlibc.so.0.3 failed
found libshouldbeinlibc.so.0.3 at ../libshouldbeinlibc//libshouldbeinlibc.so.0.3
...
--8<---------------cut here---------------end--------------->8---

the succeeding native collect2, apparentlty finding some libraries in
/usr

 --8<---------------cut here---------------start------------->8---
...  attempt to open ../libfshelp/libfshelp.so succeeded
../libfshelp/libfshelp.so ...  ../libshouldbeinlibc/libshouldbeinlibc.so
/usr/lib/i386-gnu/libpthread_nonshared.a ...
/usr/lib/gcc/i686-gnu/9/libgcc.a --8<---------------cut
here---------------end--------------->8---

Now, I'm not 100% sure that I am not misrepresenting the logs, I find
them difficult to read; full logs are attached.

I also am not sure if linking to /usr/lib/* is a feature or a bug; i.e.:
Is our Guix gcc cross compiling environment not finished yet, and should
we add -rpath fixes there; or should the -rpath fix be in the Hurd?
Thoughts?

Greetings,
janneke

Attachment: collect2-cross.log
Description: Binary data

Attachment: collect2-cross-rpath.log
Description: Binary data

Attachment: collect2-native.log
Description: Binary data

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]