Platform/Linux: fix -latomic on RISCV64 port
1 unresolved thread
1 unresolved thread
RISCV64 port on Linux requires -latomic to be linked, as some funcationality required by C/C++ may not be available in hardware, requiring a runtime implementation.
Although, some compilers try to add -latomic, it may or may not work under CMake and --as-needed linking.
This is similar to how some Android toolchain files specify -latomic as well.
Tested on Ubuntu, with this patch fixes failure to build from source of rocksdb, mariadb-10.3, opendht and probably other projects on RISCV64 without modifying their CMake configuration.
Fixes: #20895 (closed)
Merge request reports
Activity
I'd like to discuss this in #20895 (closed) further before proceeding with a change to CMake.
added workflow:external-discussion label
57 57 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) 58 58 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) 59 59 endif() 60 61 # RISCV needs -latomic 62 # https://gitlab.kitware.com/cmake/cmake/-/issues/20895 63 # 64 # Ideally I'd use CMAKE_C_COMPILER_ARCHITECTURE_ID, but that is only 65 # available on Win platforms. Not sure why though, cause every 66 # compiler on Linux has a default architecture it compiles for too, 67 # when no flags are passed to ask the compiler to behave differently. For
CMAKE_C_COMPILER_ARCHITECTURE_ID
, see #17702 (closed).
Please register or sign in to reply