mimalloc_rust icon indicating copy to clipboard operation
mimalloc_rust copied to clipboard

libmimalloc-sys v0.1.39->v0.1.41 introduced build failure on some platforms

Open hombit opened this issue 10 months ago • 5 comments

I use mimalloc in one of my projects to build Rust-powered Python packages. I noticed that after the recent update from 0.1.39 to 0.1.41, the libmimalloc-sys build has failed with the following error:

cargo:warning=In file included from c_src/mimalloc/src/alloc.c:14,
  cargo:warning=                 from c_src/mimalloc/src/static.c:23:
  cargo:warning=c_src/mimalloc/include/mimalloc/prim.h: In function ‘_mi_prim_thread_id’:
  cargo:warning=c_src/mimalloc/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  cargo:warning=  240 |   return (uintptr_t)__builtin_thread_pointer();
  cargo:warning=      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~

  --- stderr


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "c_src/mimalloc/include" "-I" "c_src/mimalloc/src" "-Wall" "-Wextra" "-ftls-model=initial-exec" "-DMI_DEBUG=0" "-o" "/project/target/debug/build/libmimalloc-sys-c0ac1fb27ae015bf/out/98cfcaec7182b1d8-static.o" "-c" "c_src/mimalloc/src/static.c" with args cc did not execute successfully (status code exit status: 1).

This can be reproduced with Docker, create Dockerfile and run

docker build -t build_libmimalloc-sys .
docker run --rm build_libmimalloc-sys
FROM quay.io/pypa/manylinux2014_x86_64

# Update Certificates
RUN yum install -y openssl-devel

# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
ENV PATH="${PATH}:/root/.cargo/bin"

# Create a project
RUN cargo init /project
WORKDIR /project
RUN cargo add libmimalloc-sys

# Build the project
CMD ["cargo", "build"]

It’s even more confusing that my CI builds pass for all MUSL-based and all ARM64 images, but not for GLIBC PPC64LE: https://github.com/light-curve/light-curve-python/actions/runs/8793140128

hombit avatar Apr 23 '24 11:04 hombit

Same issue here, I do not know what caused it

cfvescovo avatar Apr 23 '24 18:04 cfvescovo

Seems to be an upstream issue. This check seems to pass in your case but __builtin_thread_pointer is not available on that target.

@daanx

octavonce avatar Apr 23 '24 19:04 octavonce

Should I file an issue for the original C library?

hombit avatar Apr 23 '24 21:04 hombit

Yes

octavonce avatar Apr 24 '24 06:04 octavonce

I got it to work by changing the distro I am using for my containers. I switched from debian bullseye to ubuntu latest (LTS). However, I did not investigate further.

cfvescovo avatar Apr 24 '24 15:04 cfvescovo

Hitting the same issue here on a centos7 based container (quay.io/pypa/manylinux2014_x86_64). Unfortunately we're stuck with this container because we need to support a glibc 2.17 compatible binary.

ldemidov avatar May 07 '24 17:05 ldemidov

Please check the latest release

octavonce avatar May 20 '24 15:05 octavonce

Thank you, it is fixed now!

hombit avatar May 21 '24 12:05 hombit