On Wed, 2023-02-22 at 22:34 -0800, Khem Raj wrote:
> On Wed, Feb 22, 2023 at 5:35 PM Khem Raj <raj.k...@gmail.com> wrote:
> > 
> > On Wed, Feb 22, 2023 at 3:43 PM Alexandre Belloni
> > <alexandre.bell...@bootlin.com> wrote:
> > > 
> > > Hello,
> > > 
> > > This failed on musl:
> > > 
> > > > checking minix/config.h usability... 
> > > > ../../gdb-13.1/gdbserver/linux-low.cc: In function 'int 
> > > > proc_xfer_memory(CORE_ADDR, unsigned char*, const gdb_byte*, int)':
> > > > ../../gdb-13.1/gdbserver/linux-low.cc:5393:45: error: expected ':' 
> > > > before ')' token
> > > >  5393 |                  ? write (fd, writebuf, len));
> > > >       |                                             ^
> > > >       |                                             :
> > > > ../../gdb-13.1/gdbserver/linux-low.cc:5393:45: error: expected 
> > > > primary-expression before ')' token
> > > > ../../gdb-13.1/gdbserver/linux-low.cc:5393:45: error: expected ':' 
> > > > before ')' token
> > > >  5393 |                  ? write (fd, writebuf, len));
> > > >       |                                             ^
> > > >       |                                             :
> > > > ../../gdb-13.1/gdbserver/linux-low.cc:5393:45: error: expected 
> > > > primary-expression before ')' token
> > > 
> > > https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/6703/steps/11/logs/stdio
> > > 
> > > Note that reproducible still failed:
> > > https://autobuilder.yoctoproject.org/typhoon/#/builders/117/builds/2438/steps/13/logs/stdio
> > > 
> > 
> > I looked into the configure logs on builder as I was not able to
> > reproduce here locally. Here is what I see in gdb/config.log, I think
> > this node is using buildtools stuff and seems
> > its getting libpthread.so.0 from host which needs certain symbols from
> > libc which I guess are missing because its linking libc from
> > buildtools tarball as well.
> > 
> > configure:28568: checking for ELF support in BFD
> > configure:28588: ./libtool --quiet --mode=link gcc  -o conftest
> > -I../../gdb-13.1/gdb/../include -I../bfd -I../../gdb-13.1/gdb/../bfd
> > -isystem/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/work/x86_64-linux/gdb-cross-x86_64/13.1-r0/recipe-sysroot-native/usr/include
> > -O2 -pipe     
> > -isystem/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/work/x86_64-linux/gdb-cross-x86_64/13.1-r0/recipe-sysroot-native/usr/include
> > -I/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/work/x86_64-linux/gdb-cross-x86_64/13.1-r0/recipe-sysroot-native/usr/include
> > -L../bfd -L../libiberty conftest.c -lbfd -liberty  -lncursesw -lm  >&5
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__pause_nocancel@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_dlclose@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_allocate_rtsig_private@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__nanosleep_nocancel@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_dlsym@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_siglongjmp@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_thread_freeres@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_current_sigrtmax_private@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_current_sigrtmin_private@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `_dl_make_stack_executable@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_longjmp@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_dlopen_mode@GLIBC_PRIVATE'
> > /home/pokybuild/yocto-worker/reproducible/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/12.2.0/../../../../x86_64-pokysdk-linux/bin/ld:
> > /lib64/libpthread.so.0: undefined reference to
> > `__libc_pthread_init@GLIBC_PRIVATE'
> > collect2: error: ld returned 1 exit status
> > configure:28588: $? = 1
> > 
> > 
> 
> I have put together a test case on alma8-ty-1 node under /home/pokybuild/khem
> if we try to link a .so which has libpthread.so.0 in DT_NEEDED
> sections ( libzstd.so in gdb case) that's when problem is seen.
> gcc from buildtools tarball mixes things in a somewhat confusing way.
> Where it brings libpthread from host's /lib64
> and libc from buildtools tarball install and this combo does end up in
> knots resulting in above errors. if we add -pthread to gcc call then
> it uses
> libpthread from correct path ( which is from buildtools tarball )
> 
> I can see a workaround is to add -pthread to CC/CXX/LD in gdb-cross
> but that just hides the problem IMO, I think gcc from buildtools
> tarball
> is not behaving as expected and that should be investigated further
> builds without buildtools tarballs work fine.
> 
> Unrelated to this but relevant for sure I also saw a patch to fix a
> meta-oe recipe from Joshua
> 
> https://patchwork.yoctoproject.org/project/oe/patch/20230222165122.1489645-1-jpewhac...@gmail.com/
> 
> which could be suffering from the same problem as above which he is
> trying to fix by adding -pthread to ldflags.

The test case really helped, thanks Khem.

I ran it under strace and noticed the paths were /etc/etc/ld.co.conf
within buildtools. That was meaning it was searching in the non-
relocatated paths for libpthread. If I added the file, it fixed things.

I've sent a patch to binutils to fix the nativesdk variant. I've also
rebuild buildtools with that fix, tested it with the test case and it
worked. I therefore updated the helper config to use the new buildtools
and am trying a full build with that as well as testing on alma8 with a
reproducible build.

Hopefully that gets to the bottom of things!

Cheers,

Richard


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177635): 
https://lists.openembedded.org/g/openembedded-core/message/177635
Mute This Topic: https://lists.openembedded.org/mt/97164047/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to