Skip to content

ARM Raspbian 3.x fails to build _testcapi extension: undefined symbol: __atomic_fetch_or_8 #109054

Description

@vstinner

I supposed that the build error is related to Modules/_testcapi/pyatomic.c and Include/cpython/pyatomic.h.

"Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware."

Buildbot worker says: "Raspberry Pi 4 B running Raspbian (Bullseye 11.x)."

test.pythoninfo:

  • CC.version: gcc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110
  • platform.architecture: 32bit ELF
  • platform.libc_ver: glibc 2.31
  • platform.platform: Linux-6.1.21-v8+-aarch64-with-glibc2.31
  • sysconfig[PY_CFLAGS]: -fno-strict-overflow -DNDEBUG -g -O3 -Wall -UNDEBUG
  • sysconfig[PY_CFLAGS_NODIST]: -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal
  • sysconfig[PY_STDMODULE_CFLAGS]: -fno-strict-overflow -DNDEBUG -g -O3 -Wall -UNDEBUG -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include

Logs:

gcc -pthread -shared      Modules/_testcapimodule.o Modules/_testcapi/vectorcall.o Modules/_testcapi/vectorcall_limited.o Modules/_testcapi/heaptype.o Modules/_testcapi/abstract.o Modules/_testcapi/unicode.o Modules/_testcapi/dict.o Modules/_testcapi/getargs.o Modules/_testcapi/datetime.o Modules/_testcapi/docstring.o Modules/_testcapi/mem.o Modules/_testcapi/watchers.o Modules/_testcapi/long.o Modules/_testcapi/float.o Modules/_testcapi/structmember.o Modules/_testcapi/exceptions.o Modules/_testcapi/code.o Modules/_testcapi/buffer.o Modules/_testcapi/pyatomic.o Modules/_testcapi/pyos.o Modules/_testcapi/immortal.o Modules/_testcapi/heaptype_relative.o Modules/_testcapi/gc.o   -o Modules/_testcapi.cpython-313-arm-linux-gnueabihf.so
[ERROR] _testcapi failed to import: /var/lib/buildbot/workers/3.x.gps-raspbian.nondebug/build/build/lib.linux-aarch64-3.13/_testcapi.cpython-313-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_or_8
The necessary bits to build these optional modules were not found:
_tkinter              _uuid                                    
To find the necessary bits, look in configure.ac and config.log.

Following modules built successfully but were removed because they could not be imported:
_testcapi                                                      

Checked 107 modules (31 built-in, 72 shared, 1 n/a on linux-aarch64, 0 disabled, 2 missing, 1 failed on import)

logs: https://buildbot.python.org/all/#/builders/424/builds/4849

cc @colesbury @gpshead

Linked PRs

Activity

  1. vstinner commented on Sep 7, 2023

    @vstinner
    MemberAuthor

    Maybe Python should be linked to -latomic. Old GCC discussions:

  2. vstinner commented on Sep 7, 2023

    @vstinner
    MemberAuthor

    I confirm that this regression comes from the commit 2bd960b.

  3. colesbury commented on Sep 7, 2023

    @colesbury
    Contributor

    I'm on vacation this week, but I'll have some time to look at this this evening.

  4. vstinner commented on Sep 7, 2023

    @vstinner
    MemberAuthor

    I never heard about Raspbian before. I was curious about it, so I added platform.freedesktop_os_release() to test.pythoninfo :-)

    platform.freedesktop_os_release[ID]: raspbian
    platform.freedesktop_os_release[NAME]: Raspbian GNU/Linux
    platform.freedesktop_os_release[VERSION]: 11 (bullseye)
    platform.freedesktop_os_release[VERSION_CODENAME]: bullseye
    platform.freedesktop_os_release[VERSION_ID]: 11
    
  5. added 7 commits that reference this issue on Sep 7, 2023
  6. colesbury commented on Sep 8, 2023

    @colesbury
    Contributor

    From @vstinner's comments and playing with https://gcc.godbolt.org/, it looks like the 8 byte (64-bit) use library support with the default compiler options on this platform. GCC doesn't need the library support if you target -march=armv7-a (the ARMv7-A and ARMv7-R profiles support the ldrexd "double-word" exclusive load).

    Some random other things that I learned, but are probably not important:

    • Raspbian is now called Raspberry Pi OS
    • The Raspberry Pi Model B's have used a 64-bit CPUs (armv8-a) since ~2016, but the Raspbian/Raspberry Pi OS was 32-bit only until 2022 and it seems like 32-bit OS is still the most commonly used
  7. added 2 commits that reference this issue on Sep 8, 2023
  8. 19 remaining items

  9. added 12 commits that reference this issue on Sep 10, 2023
  10. added a commit that references this issue on Sep 28, 2023
  11. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions