Bug 15709 - Building BR2_PACKAGE_LIBOPENSSL_BIN=y broken with defconfig bootlin-armv7m-uclibc
Summary: Building BR2_PACKAGE_LIBOPENSSL_BIN=y broken with defconfig bootlin-armv7m-uc...
Status: RESOLVED MOVED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 18:41 UTC by Bernd Kuhls
Modified: 2024-06-15 15:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
defconfig (219 bytes, application/octet-stream)
2023-07-25 18:41 UTC, Bernd Kuhls
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Kuhls 2023-07-25 18:41:38 UTC
Created attachment 9628 [details]
defconfig

/home/bernd/buildroot/br4/output/per-package/libopenssl/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: ./libcrypto.a(libcrypto-lib-threads_pthread.o): in function `CRYPTO_atomic_or':
threads_pthread.c:(.text+0xf6): undefined reference to `__atomic_is_lock_free'
/home/bernd/buildroot/br4/output/per-package/libopenssl/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: threads_pthread.c:(.text+0x106): undefined reference to `__atomic_fetch_or_8'
/home/bernd/buildroot/br4/output/per-package/libopenssl/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: ./libcrypto.a(libcrypto-lib-threads_pthread.o): in function `CRYPTO_atomic_load':
threads_pthread.c:(.text+0x158): undefined reference to `__atomic_is_lock_free'
/home/bernd/buildroot/br4/output/per-package/libopenssl/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: threads_pthread.c:(.text+0x162): undefined reference to `__atomic_load_8'

The toolchain contains libatomic
$ find output/per-package/libopenssl/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/ | grep atomic
output/per-package/libopenssl/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/lib/libatomic.la
output/per-package/libopenssl/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/lib/libatomic.a

Adding -latomic to the openssl configure script fixes the build error.

BR2_TOOLCHAIN_HAS_LIBATOMIC is not enabled:

$ grep ATOMIC .config
BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS=y
BR2_TOOLCHAIN_HAS_ATOMIC=y
BR2_PACKAGE_PULSEAUDIO_HAS_ATOMIC=y
BR2_PACKAGE_LIBATOMIC_OPS_ARCH_SUPPORTS=y
# BR2_PACKAGE_LIBATOMIC_OPS is not set

The reason why buildroot does not enable BR2_TOOLCHAIN_HAS_LIBATOMIC is the binfmt used:

$ grep BINFMT .config
BR2_BINFMT_FLAT=y
BR2_BINFMT_FLAT_ONE=y
# BR2_BINFMT_FLAT_SEP_DATA is not set

which leads to BR2_TOOLCHAIN_HAS_LIBATOMIC not being enabled:
https://git.busybox.net/buildroot/tree/toolchain/Config.in#n851
Comment 1 Bernd Kuhls 2023-07-25 18:43:41 UTC
The same error occurs with the defconfig bootlin-m68k-5208-uclibc.
Comment 2 Yann E. MORIN 2024-06-15 15:11:56 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!