Skip to content

CMakeLists: remove linking to librt#3

Open
tafilz wants to merge 1 commit intoEVerest:everestfrom
tafilz:everest
Open

CMakeLists: remove linking to librt#3
tafilz wants to merge 1 commit intoEVerest:everestfrom
tafilz:everest

Conversation

@tafilz
Copy link

@tafilz tafilz commented Jan 24, 2026

This is not required anymore. Quoting glibc 2.30 NEWS:

  • The functions clock_gettime, clock_getres, clock_settime,
    clock_getcpuclockid, clock_nanosleep were removed from the librt library
    for new applications (on architectures which had them). Instead, the
    definitions in libc will be used automatically, which have been available
    since glibc 2.17.

When building in a BitBake devshell as shared library and inspecting the resulting .so file with readelf reveals that librt.so is never linked to:

0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]
0x000000000000000e (SONAME)             Library soname: [liblibnfc_nci.so]

This will also fix

do_package_qa: QA Issue: File /usr/lib/cmake/libnfc-nci/libnfc-nci-targets.cmake in package libnfc-nci-dev contains reference to TMPDIR [buildpaths]

in yocto builds since it contained a full path to librt.so.

This is not required anymore. Quoting glibc 2.30 NEWS:

> * The functions clock_gettime, clock_getres, clock_settime,
>   clock_getcpuclockid, clock_nanosleep were removed from the librt library
>   for new applications (on architectures which had them).  Instead, the
>   definitions in libc will be used automatically, which have been available
>   since glibc 2.17.

When building in a BitBake devshell as shared library and inspecting
the resulting .so file with readelf reveals that librt.so is never
linked to:

    0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
    0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
    0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
    0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
    0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]
    0x000000000000000e (SONAME)             Library soname: [liblibnfc_nci.so]

This will also fix

    do_package_qa: QA Issue: File /usr/lib/cmake/libnfc-nci/libnfc-nci-targets.cmake in package libnfc-nci-dev contains reference to TMPDIR [buildpaths]

in yocto builds since it contained a full path to librt.so.

Signed-off-by: Tafil Avdyli <tafil@tafhub.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants