Bug 19798 - GDB server 7.11 doesn't build with uClibc-ng or musl based toolchains
Summary: GDB server 7.11 doesn't build with uClibc-ng or musl based toolchains
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.11
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-09 16:15 UTC by romain.naour
Modified: 2016-09-04 13:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description romain.naour 2016-03-09 16:15:36 UTC
Hi,

Since the recent gnulib update in gdb [1], gdbserver fail to build with a musl or uClibc-ng libc based toolchains with:

x86_64-linux-musl-gcc -shared -fPIC -Wl,--no-undefined -D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os     -I. -I. -I./../common \
-I./../regformats -I./.. -I./../../include -I./../gnulib/import \
-Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused \
-Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body \
-Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement \
-Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition \
-Wformat-nonliteral -Wno-missing-prototypes  -DGDBSERVER -static-libstdc++ \
-static-libgcc  -Wl,--dynamic-list=./proc-service.list -o libinproctrace.so \
ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o regcache-ipa.o \
remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o print-utils-ipa.o \
rsp-low-ipa.o errors-ipa.o amd64-linux-ipa.o amd64-avx-linux-ipa.o \
amd64-avx512-linux-ipa.o amd64-mpx-linux-ipa.o linux-amd64-ipa.o -ldl -pthread
tracepoint-ipa.o: In function `get_timestamp':
tracepoint.c:(.text+0x147): undefined reference to `rpl_gettimeofday'

This is during libinproctrace.so build.

The issue seems related to gnulib gl_cv_func_gettimeofday_clobber check which was fixed for glibc toolchain [2]. The default assumption while cross-compiling seems wrong since it set REPLACE_GETTIMEOFDAY and replace gettimeofday by rpl_gettimeofday when *-gnu* suffix is missing.

Best regards,
Romain Naour

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=4a626d0a0f451c3288a461f64a9f8a49790d422b

[2] http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=b2234a55a9065eeb2aba8d26706c63facd34f3ef
Comment 1 Pedro Alves 2016-08-08 16:41:07 UTC
Is this still an issue?  If you know whether/when this was fixed in gnulib upstream, please update this bug so we can consider updating our gnulib copy to a newer revision.
Comment 2 romain.naour 2016-09-04 13:56:26 UTC
Hi,

This issue is not fixed in gnulib itself, but was fixed in Buildroot by using gl_cv_func_gettimeofday_clobber=no to not use rpl_gettimeofday, assuming musl and uClibc have a properly working gettimeofday implementation (see [1]).
This fix was suggested by the musl FAQ [2].

Best regards,
Romain Naour

[1] https://git.busybox.net/buildroot/commit/?id=560334bb2a46a77081a3944d092df7732dfca432
[2] http://wiki.musl-libc.org/wiki/FAQ#Q:_I.27m_getting_this_gnulib_error