feat(build): add arm64 support for openEuler OS (#107)

- Enable compilation on arm64 (aarch64) architecture by conditionally adjusting compiler flags.
- Ensure proper linkage with compiler-rt and libgcc on ARM to resolve missing symbol issues.
- Update README.md with installation instructions for openEuler 2403sp1.

Signed-off-by: Haomai Wang <haomai@xsky.com>
This commit is contained in:
Haomai Wang
2025-03-06 10:40:50 +08:00
committed by GitHub
parent 49e0ad50ae
commit 6f8e6e1367
2 changed files with 16 additions and 1 deletions

View File

@@ -67,7 +67,17 @@ endif()
# Remove project root from the __FILE__ macro variable
add_compile_options(-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.)
add_compile_options(-msse4.2 -mavx2)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
add_compile_options(-msse4.2 -mavx2)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
# ARM architecture detected:
# Clang on ARM uses built-in runtime library (compiler-rt) to provide symbols like '__muloti4'.
# Without explicitly specifying '-rtlib=compiler-rt', linking may fail due to missing '__muloti4'.
# '-unwindlib=libgcc' ensures proper exception unwinding compatibility.
add_compile_options(-march=armv8-a)
message(STATUS "ARM architecture detected, linking with compiler-rt and libgcc.")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rtlib=compiler-rt -unwindlib=libgcc")
endif()
add_compile_definitions(ROCKSDB_NAMESPACE=rocksdb_internal)
include(cmake/Sanitizers.cmake)
include(cmake/CompileFlags.cmake)