microsoft / mimalloc

mimalloc is a compact general purpose allocator with excellent performance.
MIT License
9.74k stars 791 forks source link

remove MI_USE_LIBATOMIC and properly find libatomic #898

Closed mojyack closed 1 month ago

mojyack commented 1 month ago

In some systems, libatomic.so is at gcc specific dir(e.g. /lib/gcc/powerpc-unknown-linux-gnu/13), rather than the system library path. In this case, find_library cannot find libatomic. Use check_linker_flag to fix this, and remove unused MI_USE_LIBATOMIC option. May fix #798

Tested in: x86_64-pc-linux-musl aarch64-unknown-linux-musl armv6j-unknown-linux-musleabihf powerpc-unknown-linux-gnu

daanx commented 1 month ago

Thanks so much! I refactored the cmake code to use the library flag check always first and fall back to find_library after that.