diff --git a/CMakeLists.txt b/CMakeLists.txt index ffcec30b3..ac15517dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,18 @@ if( ) endif() +# On aarch64, libatomic is required for atomic operations. It is not needed on x86_64. +# Linking it statically on Linux +if( + CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" + AND CMAKE_SYSTEM_NAME STREQUAL "Linux" +) + target_link_options( + clio_options + INTERFACE -Wl,--push-state -Wl,-Bstatic -latomic -Wl,--pop-state + ) +endif() + # Apply sanitizer instrumentation if requested and define SANITIZERS_ENABLED. # Must come before the modules and subdirectories below that key off it. include(Sanitizers) diff --git a/docker/clio/Dockerfile b/docker/clio/Dockerfile index f1a615b95..6a10f777a 100644 --- a/docker/clio/Dockerfile +++ b/docker/clio/Dockerfile @@ -1,11 +1,5 @@ FROM ubuntu:22.04 -RUN apt-get update \ - && apt-get install -y --no-install-recommends --no-install-suggests \ - libatomic1 \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - RUN groupadd -g 10001 clio \ && useradd -u 10000 -g 10001 -s /bin/bash clio