Skip to content
Snippets Groups Projects

Platform/Linux: fix -latomic on RISCV64 port

Closed Dimitri John Ledkov requested to merge xnox/cmake:riscv64 into master
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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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.
Please register or sign in to reply
Loading