EmbarkStudios / EmbarkStudios/tracing-logfmt

Fails to compile with GLIBC < 2.30 due to missing symbol

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
47
Forks
9
PR merge metrics
No merged PRs in 30d

Description

PR #18 introduced a call to the `gettid` GLIBC symbol, but this symbol wasn't added until [GLIBC version 2.30](https://lists.gnu.org/archive/html/info-gnu/2019-08/msg00000.html).

As such, this crate can't be used on targets without that minimal version.

For example RHEL/rockylinux 8 gets this stack trace:
```
[root@50bf99ac4c58 tracing-logfmt]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.10 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.10 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2029-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.10"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
[root@50bf99ac4c58 tracing-logfmt]# ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
[root@50bf99ac4c58 tracing-logfmt]# cargo test
Compiling tracing-logfmt v0.3.7 (/root/tracing-logfmt)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/root/tracing-logfmt/target/debug/deps/rustcWVeaBt/symbols.o" "<130 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "-lc" "-Wl,-Bstatic" "/root/tracing-logfmt/target/debug/deps/{libtime-ca2c4dcffcb3d4ad,libitoa-05a2635fb0d33563,libtime_core-4a631e7cf240eac1,libnum_conv-c59c529f3423afab,libderanged-99b2e410de329ca9,libpowerfmt-3b35732a43a0df8d}.rlib" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libtest-*,libgetopts-*,librustc_std_workspace_std-*}.rlib" "/root/tracing-logfmt/target/debug/deps/{libtracing_subscriber-0f838e1623865706,libthread_local-4f74afb359780654,libcfg_if-8335d015069e4c91,libsharded_slab-4becbf0d69dbb99b,liblazy_static-a7d68303b6e86ca1,libtracing-cca14a1bca8db480,libpin_project_lite-be32f9bf9aeb8a5f,libtracing_core-7f304aeadcdcf402,libonce_cell-fa123a13331426db}.rlib" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/root/tracing-logfmt/target/debug/deps/rustcWVeaBt/raw-dylibs" "-B/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/root/tracing-logfmt/target/debug/deps/tracing_logfmt-f513085ef08312f8" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: undefined symbol: gettid
>>> referenced by formatter.rs:94 (src/formatter.rs:94)
>>> /root/tracing-logfmt/target/debug/deps/tracing_logfmt-f513085ef08312f8.6sedb1tb7ec63ood5g3uukvir.0l296fe.rcgu.o:(tracing_logfmt::formatter::current_thread_id::h6a296c41574ef302)
>>> referenced by syscall.rs:12 (library/std/src/sys/pal/unix/weak/syscall.rs:12)
>>> std-d1237ef7159db0a2.std.e28293b1aa0f68bd-cgu.0.rcgu.o:(std::thread::current::with_current_name::::{closure#0}) in archive /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d1237ef7159db0a2.rlib
>>> referenced by syscall.rs:13 (library/std/src/sys/pal/unix/weak/syscall.rs:13)
>>> std-d1237ef7159db0a2.std.e28293b1aa0f68bd-cgu.0.rcgu.o:(std::thread::current::with_current_name::::{closure#0}) in archive /root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d1237ef7159db0a2.rlib
>>> referenced 2 more times
>>> did you mean: getutid
>>> defined in: /lib64/libc.so.6
collect2: error: ld returned 1 exit status

error: could not compile `tracing-logfmt` (lib test) due to 1 previous error
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.