Bug 14816 - Build fails on latest master with a systemd build failure, implicit func declaration gettid() error
Summary: Build fails on latest master with a systemd build failure, implicit func decl...
Status: RESOLVED MOVED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 blocker
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-20 05:24 UTC by Amol Dhamale
Modified: 2024-06-15 15:03 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
The .config file after making custom configurations using menuconfig to raspberrypi2_defconfig (89 bytes, application/octet-stream)
2022-05-20 07:22 UTC, Amol Dhamale
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amol Dhamale 2022-05-20 05:24:51 UTC
I building a root filesystem for Raspberry Pi 2 on my Ubuntu 20.04 machine and my local Linaro precompiled cross-compilation toolchain. Not attempting to build the kernel or bootloader since I've compiled that separately from source.

Following is the console error log. I have configured lot of packages and libs for this build so attaching a .config file instead of listing them out here.

>>> systemd 250.4 Building
PATH="/home/amol/Projects/EmbeddedLinuxTools/buildroot/output/host/bin:/home/amol/Projects/EmbeddedLinuxTools/buildroot/output/host/sbin:/home/amol/anaconda3/condabin:/home/amol/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/amol/Projects/BBB/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin:/usr/local/bin/gm" LC_ALL=C.UTF-8 PYTHONNOUSERSITE=y /home/amol/Projects/EmbeddedLinuxTools/buildroot/output/host/bin/ninja   -C /home/amol/Projects/EmbeddedLinuxTools/buildroot/output/build/systemd-250.4//build
ninja: Entering directory `/home/amol/Projects/EmbeddedLinuxTools/buildroot/output/build/systemd-250.4//build'
[3/748] Compiling C object src/libsystemd/libsystemd_static.a.p/sd-journal_journal-send.c.o
FAILED: src/libsystemd/libsystemd_static.a.p/sd-journal_journal-send.c.o 
/home/amol/Projects/EmbeddedLinuxTools/buildroot/output/host/bin/arm-linux-gnueabihf-gcc -Isrc/libsystemd/libsystemd_static.a.p -Isrc/libsystemd -I../src/libsystemd -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I. -I.. -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -std=gnu99 -O3 -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-maybe-uninitialized -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -ffunction-sections -fdata-sections -Werror=shadow -include config.h -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -fPIC -pthread -fvisibility=default -MD -MQ src/libsystemd/libsystemd_static.a.p/sd-journal_journal-send.c.o -MF src/libsystemd/libsystemd_static.a.p/sd-journal_journal-send.c.o.d -o src/libsystemd/libsystemd_static.a.p/sd-journal_journal-send.c.o -c ../src/libsystemd/sd-journal/journal-send.c
../src/libsystemd/sd-journal/journal-send.c: In function ‘close_journal_fd’:
../src/libsystemd/sd-journal/journal-send.c:76:25: error: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
         if (getpid() != gettid())
                         ^~~~~~
                         getgid
../src/libsystemd/sd-journal/journal-send.c:76:25: warning: nested extern declaration of ‘gettid’ [-Wnested-externs]
cc1: some warnings being treated as errors
[10/743] Compiling C object src/libsystemd/libsystemd_static.a.p/sd-event_sd-event.c.o
ninja: build stopped: subcommand failed.
make[1]: *** [package/pkg-generic.mk:293: /home/amol/Projects/EmbeddedLinuxTools/buildroot/output/build/systemd-250.4/.stamp_built] Error 1
make: *** [Makefile:84: _all] Error 2
Comment 1 Amol Dhamale 2022-05-20 07:22:41 UTC
Created attachment 9311 [details]
The .config file after making custom configurations using menuconfig to raspberrypi2_defconfig

https://github.com/amoldhamale1105/EmbeddedLinux/blob/master/boards/raspberrypi2/.config
Comment 2 Yann E. MORIN 2022-05-20 07:37:48 UTC
Amol, All,

The failure is because systemd calls gettid(), and you are using a toolchain
that is tool old to provide it.

Indeed, gettid() was only introduced in glibc 2.30, but the Linaro toolchain
still uses glibc 2.25.

Use another toolchain.

It is not really trivial to prevent such a configuration, because we dpo not
have kconfig symbols that repreesents the glibc version (like we have for the
kernel headers or gcc), so maybe we should just add an ad-hoc excluion of that
toolchain (and other old ones?) in systemd/Config.in

Regards,
Yann E. MRON.
Comment 3 Yann E. MORIN 2024-06-15 15:03:06 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!