purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to build on ARM64 (c6g AWS instance)

mcseemk opened this issue · comments

Here is the output:

error: failed to run custom build command for `libmimalloc-sys v0.1.19`

Caused by:
process didn't exit successfully: `/home/mcs/src/multi/target/release/build/libmimalloc-sys-0cd8c55f2aa36adb/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/home/mcs/.cargo/registry/src/github.com-1ecc6299db9ec823/libmimalloc-sys-0.1.19/c_src/mimalloc" "-DMI_OVERRIDE=OFF" "-DMI_BUILD_TESTS=OFF" "-DMI_SECURE=OFF" "-DMI_LOCAL_DYNAMIC_TLS=OFF" "-Dmi_defines=MI_DEBUG=0" "-DCMAKE_SH=CMAKE_SH-NOTFOUND" "-DCMAKE_INSTALL_PREFIX=/home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out" "-DCMAKE_C_FLAGS= -static -ffunction-sections -fdata-sections -m64 -O3 -fpic -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
-- Configuring incomplete, errors occurred!
See also "/home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out/build/CMakeFiles/CMakeOutput.log".
See also "/home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out/build/CMakeFiles/CMakeError.log".

--- stderr
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

  "/usr/bin/cc"

is not able to compile a simple test program.

It fails with the following output:

  Change Dir: /home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out/build/CMakeFiles/CMakeTmp
  
  Run Build Command(s):/usr/bin/make cmTC_031fe/fast && /usr/bin/make -f CMakeFiles/cmTC_031fe.dir/build.make CMakeFiles/cmTC_031fe.dir/build
  make[1]: Entering directory '/home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out/build/CMakeFiles/CMakeTmp'
  Building C object CMakeFiles/cmTC_031fe.dir/testCCompiler.c.o
  /usr/bin/cc   -static -ffunction-sections -fdata-sections -m64 -O3 -fpic -ffunction-sections -fdata-sections -fPIC    -o CMakeFiles/cmTC_031fe.dir/testCCompiler.c.o   -c /home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
  cc: error: unrecognized command line option ‘-m64’
  make[1]: *** [CMakeFiles/cmTC_031fe.dir/build.make:66: CMakeFiles/cmTC_031fe.dir/testCCompiler.c.o] Error 1
  make[1]: Leaving directory '/home/mcs/src/multi/target/release/build/libmimalloc-sys-a04f8b08af99321d/out/build/CMakeFiles/CMakeTmp'
  make: *** [Makefile:121: cmTC_031fe/fast] Error 2
  
  



CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)


thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

I run into this same issue yesterday. I don't know the "right" solution. As it is describe in the error message, the compiler on AWS aarch64 instance does not support "-m64". I forked the code and removed the "-m64" from the build.rs and I pointed the line in my Cargo.toml to my forked repo to build. That worked. Maybe the correct way to do this is to detect the system architecture properly and set the complier options accordingly.

It's likely that #58 will fix this.

Think so too, we are actively using #58 on aarch64-apple-darwin and aarch64-linux-android

I will test #58 on AWS arrch64 later to confirm.

#58 works on AWS Graviton aarch64. Thanks.