Bug 29116 - gprofng fails to build on i686-linux-gnu, aarch64-linux-gnu
Summary: gprofng fails to build on i686-linux-gnu, aarch64-linux-gnu
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gprofng (show other bugs)
Version: 2.39
: P2 normal
Target Milestone: ---
Assignee: Vladimir Mezentsev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-03 21:05 UTC by Matthias Klose
Modified: 2022-07-08 05:05 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-inux-gnu aarch64-linux-gnu
Build:
Last reconfirmed: 2022-06-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2022-05-03 21:05:08 UTC
gprofng fails to build on i686-linux-gnu, trunk 20220503:

libtool: link: x86_64-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/synctrace.o    -Wl,--version-script -W
l,../../../gprofng/libcollector/mapfile.intel-Linux -Wl,--no-as-needed -Wl,-lrt -Wl,-ldl -Wl,-z -Wl,re
lro   -Wl,-soname -Wl,libgp-sync.so -o .libs/libgp-sync.so
/usr/bin/ld: .libs/libgp-sync.so: version node not found for symbol pthread_cond_wait@GLIBC_2.2.5
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make[6]: *** [Makefile:580: libgp-sync.la] Error 1
Comment 1 H.J. Lu 2022-05-03 21:19:44 UTC
Which version of glibc was used?
Comment 2 H.J. Lu 2022-05-03 21:21:37 UTC
i686 glibc should reference pthread_cond_wait@@GLIBC_2.3.2, not
pthread_cond_wait@GLIBC_2.2.5.
Comment 3 Matthias Klose 2022-05-03 21:32:41 UTC
glibc 2.35
Comment 4 H.J. Lu 2022-05-03 21:34:46 UTC
It looks like WSIZE(64) is 1 for i686-linux-gnu.  Please show the output of

# echo __x86_64 | x86_64-linux-gnu-gcc -E -
# echo __x86_64 | x86_64-linux-gnu-gcc -m32 -E -
Comment 5 Matthias Klose 2022-05-03 21:38:22 UTC
also aarch64-linux-gnu:

libtool: link: x86_64-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/synctrace.o    -Wl,--version-script -W
l,../../../gprofng/libcollector/mapfile.aarch64-Linux -Wl,--no-as-needed -Wl,-lrt -Wl,-ldl -Wl,-z -Wl,
relro   -Wl,-soname -Wl,libgp-sync.so -o .libs/libgp-sync.so
/usr/bin/ld: .libs/libgp-sync.so: version node not found for symbol pthread_cond_wait@@GLIBC_2.3.2
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make[6]: *** [Makefile:580: libgp-sync.la] Error 1
Comment 6 Matthias Klose 2022-05-03 21:39:45 UTC
sorry, this is glibc 2.33, not 2.35.

$ echo __x86_64 | x86_64-linux-gnu-gcc -E -
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "<stdin>"
1
$ echo __x86_64 | x86_64-linux-gnu-gcc -m32 -E -
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "<stdin>"
__x86_64
Comment 7 H.J. Lu 2022-05-03 21:53:43 UTC
Were you building x86-64 binutils on i686 Linux?
Comment 8 Matthias Klose 2022-05-03 22:01:42 UTC
no, everything on x86_64-linux-gnu so far, the i686 and aarch64 builds are configured for these targets.
Comment 9 H.J. Lu 2022-05-03 22:02:32 UTC
gprofng/libcollector/synctrace.c is written for target.  But synctrace.o
is linked against the host library.  It failed to link when host != target.
Comment 10 Vladimir Mezentsev 2022-05-03 23:11:26 UTC
How do you configure your build ?

It looks like there are two bugs here:
1. libgp-sync.so may not link with libc.
 In run time, libgp-sync.so has to dlopen libc and use dlsym to find pthread_cond_wait.

2. it is probably a bug 29113 - Build error for x86_64-w64-mingw32 host since CLOCK_MONOTONIC does not exist
Comment 11 Vladimir Mezentsev 2022-05-04 20:33:19 UTC
 The build was configured with --target=i686-linux-gnu.
Does this means that all binaries will be the 32-bit ?


I see that gprofng/libcollector/synctrace.c was built on x86_64 without -m32 option:
% file .libs/synctrace.o
.libs/synctrace.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), with debug_info, not stripped

 and synctrace.o is linked against the target (32-bit) library.
Comment 12 Sourceware Commits 2022-05-05 17:26:13 UTC
The master branch has been updated by Vladimir Mezentsev <vmezents@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1653ae5b8440e2182ac86974b99b603bc15aa163

commit 1653ae5b8440e2182ac86974b99b603bc15aa163
Author: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date:   Thu May 5 00:08:19 2022 -0700

    gprofng: use $host instead $target
    
    By mistake, $target was used instead of $host to configure the gprogng build.
    
    gprofng/ChangeLog
    2022-04-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
    
            PR gprofng/29113
            PR gprofng/29116
            * configure.ac: Use $host instead $target.
            * libcollector/configure.ac: Likewise.
            * configure: Rebuild.
            * libcollector/configure: Rebuild.
Comment 13 Sourceware Commits 2022-07-07 05:37:41 UTC
The master branch has been updated by Vladimir Mezentsev <vmezents@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1bb1f55d648e9c32bbead00afc95761646a6d050

commit 1bb1f55d648e9c32bbead00afc95761646a6d050
Author: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date:   Wed Jul 6 13:52:57 2022 -0700

    gprofng: adjust GPROFNG_VARIANT
    
    GPROFNG_VARIANT depends on compiler options, not on $(host).
    
    gprofng/ChangeLog
    2022-07-06  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
    
            PR gprofng/29116
            * libcollector/configure.ac: Adjust GPROFNG_VARIANT.
            * libcollector/configure: Rebuild.
Comment 14 Vladimir Mezentsev 2022-07-08 05:05:07 UTC
Update status as resolved/fixed.