FROM alpine:3.19
RUN apk update
RUN apk add gcc g++ build-base cmake git wget make nano sed linux-headers perl
WORKDIR /opt
RUN git clone https://github.com/microsoft/mimalloc.git
RUN mkdir -p /opt/mimalloc/build
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["cd /opt/mimalloc/build && cmake -DMI_BUILD_STATIC=1 -DMI_BUILD_SHARED=0 -DMI_BUILD_OBJECT=0 .."]
The output is
$ docker run -it ichor-temp
-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
-- No build type selected, default to: Release
-- Override standard malloc (MI_OVERRIDE=ON)
--
-- Library base name: mimalloc
-- Version : 2.1
-- Build type : release
-- C Compiler : /usr/bin/cc
-- Compiler flags : -Wall;-Wextra;-Wno-unknown-pragmas;-fvisibility=hidden;-Wstrict-prototypes;-ftls-model=initial-exec;-fno-builtin-malloc
-- Compiler defines :
-- Link libraries : /usr/lib/libpthread.a;/usr/lib/librt.a;/usr/lib/libatomic.so
-- Build targets : static;tests
--
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /opt/mimalloc/build
libatomic.a should be detected, as linking and executable with mimalloc-static and the -static compiler flag results in the following:
Changing find_library(MI_LIBATOMIC atomic) to find_library(MI_LIBATOMIC NAMES libatomic.a) "fixes" it for this specific use case, but will create issues for non-static builds.
When running the following Dockerfile:
The output is
libatomic.a
should be detected, as linking and executable withmimalloc-static
and the-static
compiler flag results in the following:Changing
find_library(MI_LIBATOMIC atomic)
tofind_library(MI_LIBATOMIC NAMES libatomic.a)
"fixes" it for this specific use case, but will create issues for non-static builds.