Closed zonyitoo closed 3 years ago
can you also try --features build_cc as well so we can see if there are other errors than -mcx16
Build with build_cc
produces hundreds of lines of warnings, here are some of them
cargo:warning=snmalloc/src/override/../mem/alloc.h:1067:41: required from 'snmalloc::CapPtr<void, (snmalloc::capptr_bounds)5u> snmalloc::Allocator<NeedsInitialisation, InitThreadAllocator, MemoryProvider, ChunkMap, IsQueueInline>::small_alloc(size_t) [with snmalloc::ZeroMem zero_mem = (snmalloc::ZeroMem)0u; bool (* NeedsInitialisation)(void*) = snmalloc::needs_initialisation; void* (* InitThreadAllocator)(snmalloc::function_ref<void*(void*)>) = snmalloc::init_thread_allocator; MemoryProvider = snmalloc::MemoryProviderStateMixin<snmalloc::PALLinux, snmalloc::DefaultArenaMapTemplate<snmalloc::PALLinux, snmalloc::GlobalPagemapTemplate<snmalloc::default_auth_pagemap, snmalloc::ForAuthmap> > >; ChunkMap = snmalloc::DefaultChunkMap<>; bool IsQueueInline = true; size_t = long unsigned int]'
cargo:warning=snmalloc/src/override/../mem/alloc.h:180:51: required from 'void* snmalloc::Allocator<NeedsInitialisation, InitThreadAllocator, MemoryProvider, ChunkMap, IsQueueInline>::alloc(size_t) [with snmalloc::ZeroMem zero_mem = (snmalloc::ZeroMem)0u; bool (* NeedsInitialisation)(void*) = snmalloc::needs_initialisation; void* (* InitThreadAllocator)(snmalloc::function_ref<void*(void*)>) = snmalloc::init_thread_allocator; MemoryProvider = snmalloc::MemoryProviderStateMixin<snmalloc::PALLinux, snmalloc::DefaultArenaMapTemplate<snmalloc::PALLinux, snmalloc::GlobalPagemapTemplate<snmalloc::default_auth_pagemap, snmalloc::ForAuthmap> > >; ChunkMap = snmalloc::DefaultChunkMap<>; bool IsQueueInline = true; size_t = long unsigned int]'
cargo:warning=snmalloc/src/override/malloc.cc:46:54: required from here
cargo:warning=snmalloc/src/override/../mem/alloc.h:986:7: error: invalid use of void expression
cargo:warning= super->init(public_state());
cargo:warning= ^~~~~
cargo:warning=snmalloc/src/override/../mem/alloc.h: In member function 'void* snmalloc::Allocator<NeedsInitialisation, InitThreadAllocator, MemoryProvider, ChunkMap, IsQueueInline>::external_pointer(void*) [with snmalloc::Boundary location = (snmalloc::Boundary)0u; bool (* NeedsInitialisation)(void*) = snmalloc::needs_initialisation; void* (* InitThreadAllocator)(snmalloc::function_ref<void*(void*)>) = snmalloc::init_thread_allocator; MemoryProvider = snmalloc::MemoryProviderStateMixin<snmalloc::PALLinux, snmalloc::DefaultArenaMapTemplate<snmalloc::PALLinux, snmalloc::GlobalPagemapTemplate<snmalloc::default_auth_pagemap, snmalloc::ForAuthmap> > >; ChunkMap = snmalloc::DefaultChunkMap<>; bool IsQueueInline = true]':
cargo:warning=snmalloc/src/override/../mem/alloc.h:418:7: warning: control reaches end of non-void function [-Wreturn-type]
cargo:warning= }
cargo:warning= ^
cargo:warning=snmalloc/src/override/../mem/alloc.h: In member function 'void* snmalloc::Allocator<NeedsInitialisation, InitThreadAllocator, MemoryProvider, ChunkMap, IsQueueInline>::external_pointer(void*) [with snmalloc::Boundary location = (snmalloc::Boundary)2u; bool (* NeedsInitialisation)(void*) = snmalloc::needs_initialisation; void* (* InitThreadAllocator)(snmalloc::function_ref<void*(void*)>) = snmalloc::init_thread_allocator; MemoryProvider = snmalloc::MemoryProviderStateMixin<snmalloc::PALLinux, snmalloc::DefaultArenaMapTemplate<snmalloc::PALLinux, snmalloc::GlobalPagemapTemplate<snmalloc::default_auth_pagemap, snmalloc::ForAuthmap> > >; ChunkMap = snmalloc::DefaultChunkMap<>; bool IsQueueInline = true]':
cargo:warning=snmalloc/src/override/../mem/alloc.h:418:7: warning: control reaches end of non-void function [-Wreturn-type]
cargo:warning= }
cargo:warning= ^
cargo:warning=In file included from snmalloc/src/override/../mem/../ds/helpers.h:3:0,
cargo:warning= from snmalloc/src/override/../mem/globalalloc.h:3,
cargo:warning= from snmalloc/src/override/../mem/slowalloc.h:3,
cargo:warning= from snmalloc/src/override/malloc.cc:1,
cargo:warning= from snmalloc/src/override/rust.cc:2:
cargo:warning=snmalloc/src/override/../mem/../ds/bits.h: In function 'size_t snmalloc::bits::clz(size_t)':
cargo:warning=snmalloc/src/override/../mem/../ds/bits.h:91:5: warning: control reaches end of non-void function [-Wreturn-type]
cargo:warning= }
cargo:warning= ^
cargo:warning=In file included from snmalloc/src/override/../mem/../mem/sizeclass.h:3:0,
cargo:warning= from snmalloc/src/override/../mem/allocstats.h:4,
cargo:warning= from snmalloc/src/override/../mem/alloc.h:10,
cargo:warning= from snmalloc/src/override/../mem/globalalloc.h:4,
cargo:warning= from snmalloc/src/override/../mem/slowalloc.h:3,
cargo:warning= from snmalloc/src/override/malloc.cc:1,
cargo:warning= from snmalloc/src/override/rust.cc:2:
cargo:warning=snmalloc/src/override/../mem/../mem/../pal/pal.h: At global scope:
cargo:warning=snmalloc/src/override/../mem/../mem/../pal/pal.h:83:3: warning: 'std::enable_if_t<(! aal_supports<StrictProvenance, AAL>), snmalloc::CapPtr<T, capptr_export_type<B>()> > snmalloc::capptr_export(snmalloc::CapPtr<T, B>) [with PAL = snmalloc::PALLinux; AAL = snmalloc::AAL_Generic<snmalloc::AAL_NoStrictProvenance<snmalloc::AAL_arm> >; T = snmalloc::Mediumslab; snmalloc::capptr_bounds B = (snmalloc::capptr_bounds)2u]' used but never defined
cargo:warning= capptr_export(CapPtr<T, B> p)
cargo:warning= ^~~~~~~~~~~~~
exit status: 1
--- stderr
error occurred: Command "aarch64-linux-musl-g++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "snmalloc/src" "-Wall" "-Wextra" "-O3" "-fno-exceptions" "-fno-rtti" "-g" "-fomit-frame-pointer" "-fpermissive" "-std=c++17" "-ftls-model=initial-exec" "-o" "/target/aarch64-unknown-linux-musl/release/build/snmalloc-sys-58af90f0d695a805/out/snmalloc/src/override/rust.o" "-c" "snmalloc/src/override/rust.cc" with args "aarch64-linux-musl-g++" did not execute successfully (status code exit status: 1).
Compiliation failed because of
snmalloc/src/override/../mem/alloc.h:986:7: error: invalid use of void expression
super->init(public_state());
^~~~~
Thanks, I've seen the majority of warnings go away using clang, g++ tends to be a little aggressive, you can change by or musl equivalent export CC=/usr/bin/clang export CXX=/usr/bin/clang++
Ok thanks. Let me build a docker image and try again.
BTW, it seems that snmalloc doesn't work well on MUSL: https://github.com/SchrodingerZhu/snmalloc-rs/issues/102 .
Let me try to make a docker image with a clang wrapper of MUSL.
yeah but your original error and architecture were a little different so I was getting curious to why there was a different error lol
Well, after searching on Google, there is no existed well maintained project that help to build a MUSL toolchain with clang.
I would give up right here, since even if I have succeeded make it built, it won't work well with MUSL.
I wouldn't close yet, I know upstream was thinking on trying to implement a workaround for the previous musl issue so they may want to know someone is still interested
Yeah. It is possible to write a work around to the issue mentioned. It isn't on my path at the moment, but I would be happy to review, and help someone if they want to take on #102.
https://github.com/SchrodingerZhu/snmalloc-rs/issues/102#issuecomment-773215075
The -mcx16
should not be set on ARM.
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
# XXX elseif ARM?
endif()
This code should support cross compiling. Perhaps, this is a Rust CMake issue? Though, our CI does not check the cross compiling case.
The warning:
cargo:warning=In file included from snmalloc/src/override/../mem/../ds/helpers.h:3:0,
cargo:warning= from snmalloc/src/override/../mem/globalalloc.h:3,
cargo:warning= from snmalloc/src/override/../mem/slowalloc.h:3,
cargo:warning= from snmalloc/src/override/malloc.cc:1,
cargo:warning= from snmalloc/src/override/rust.cc:2:
cargo:warning=snmalloc/src/override/../mem/../ds/bits.h: In function 'size_t snmalloc::bits::clz(size_t)':
cargo:warning=snmalloc/src/override/../mem/../ds/bits.h:91:5: warning: control reaches end of non-void function [-Wreturn-type]
cargo:warning= }
Looks like the constexpr
is not resolving to a definition on the platform, which seems strange to me.
@nwf @davidchisnall
OK I was able to build with clang available so Ill attach the dockerfile to help anyone interested,
The simplified clang error is cstddef not found on aarch64 musl:
running: "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=aarch64-unknown-linux-musl" "-I" "snmalloc/src" "-Wall" "-Wextra" "-o" "/snmalloc-rs/target/aarch64-unknown-linux-musl/debug/build/snmalloc-sys-83e4008035e1f873/out/snmalloc/src/override/rust.o" "-c" "snmalloc/src/override/rust.cc"
cargo:warning=In file included from snmalloc/src/override/rust.cc:2:
cargo:warning=In file included from snmalloc/src/override/malloc.cc:1:
cargo:warning=In file included from snmalloc/src/override/../mem/slowalloc.h:3:
cargo:warning=In file included from snmalloc/src/override/../mem/globalalloc.h:3:
cargo:warning=In file included from snmalloc/src/override/../mem/../ds/helpers.h:3:
cargo:warning=snmalloc/src/override/../mem/../ds/bits.h:3:10: fatal error: 'cstddef' file not found
cargo:warning=#include ~~~~
cargo:warning=1 error generated.
exit code: 1
--- stderr
error occurred: Command "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=aarch64-unknown-linux-musl" "-I" "snmalloc/src" "-Wall" "-Wextra" "-o" "/snmalloc-rs/target/aarch64-unknown-linux-musl/debug/build/snmalloc-sys-83e4008035e1f873/out/snmalloc/src/override/rust.o" "-c" "snmalloc/src/override/rust.cc" with args "clang++" did not execute successfully (status code exit code: 1). Dockerfile.txt
I built it with
cross
.