Dear Maintainer,
I have checked the cause of this compilation error and it is due to low
version of rocksdb which does not support loongarch. the attached patch
has solved the problem, the PR reference link is as follows:
https://github.com/facebook/rocksdb/pull/10036/files
wuruilong
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
ceph (18.2.3+ds-3) unstable; urgency=medium
.
* mips64el: Use -mxgot on CFLAGS, not LDFLAGS, thanks to Adrian Bunk for the
tip.
Author: Thomas Goirand <z...@debian.org>
---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-06-04
--- ceph-18.2.3+ds.orig/src/rocksdb/CMakeLists.txt
+++ ceph-18.2.3+ds/src/rocksdb/CMakeLists.txt
@@ -245,6 +245,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x
endif(HAS_S390X_MARCH_NATIVE)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
+ CHECK_C_COMPILER_FLAG("-march=loongarch64" HAS_LOONGARCH64)
+ if(HAS_LOONGARCH64)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=loongarch64 -mtune=loongarch64")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=loongarch64 -mtune=loongarch64")
+ endif(HAS_LOONGARCH64)
+endif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
+
option(PORTABLE "build a portable binary" OFF)
option(FORCE_SSE42 "force building with SSE4.2, even when PORTABLE=ON" OFF)
option(FORCE_AVX "force building with AVX, even when PORTABLE=ON" OFF)
@@ -275,6 +283,9 @@ if(PORTABLE)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z196")
endif()
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^loongarch64")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=loongarch64")
+ endif()
endif()
else()
if(MSVC)
--- ceph-18.2.3+ds.orig/src/rocksdb/Makefile
+++ ceph-18.2.3+ds/src/rocksdb/Makefile
@@ -2058,7 +2058,7 @@ JAVA_INCLUDE = -I$(JAVA_HOME)/include/ -
ifeq ($(PLATFORM), OS_SOLARIS)
ARCH := $(shell isainfo -b)
else ifeq ($(PLATFORM), OS_OPENBSD)
- ifneq (,$(filter amd64 ppc64 ppc64le s390x arm64 aarch64 sparc64, $(MACHINE)))
+ ifneq (,$(filter amd64 ppc64 ppc64le s390x arm64 aarch64 sparc64 loongarch64, $(MACHINE)))
ARCH := 64
else
ARCH := 32
@@ -2079,7 +2079,7 @@ ifneq ($(origin JNI_LIBC), undefined)
endif
ifeq (,$(ROCKSDBJNILIB))
-ifneq (,$(filter ppc% s390x arm64 aarch64 sparc64, $(MACHINE)))
+ifneq (,$(filter ppc% s390x arm64 aarch64 sparc64 loongarch64, $(MACHINE)))
ROCKSDBJNILIB = librocksdbjni-linux-$(MACHINE)$(JNI_LIBC_POSTFIX).so
else
ROCKSDBJNILIB = librocksdbjni-linux$(ARCH)$(JNI_LIBC_POSTFIX).so
--- ceph-18.2.3+ds.orig/src/rocksdb/port/port_posix.h
+++ ceph-18.2.3+ds/src/rocksdb/port/port_posix.h
@@ -169,6 +169,8 @@ static inline void AsmVolatilePause() {
asm volatile("isb");
#elif defined(__powerpc64__)
asm volatile("or 27,27,27");
+#elif defined(__loongarch64)
+ asm volatile("dbar 0");
#endif
// it's okay for other platforms to be no-ops
}
--- ceph-18.2.3+ds.orig/src/rocksdb/util/xxhash.h
+++ ceph-18.2.3+ds/src/rocksdb/util/xxhash.h
@@ -1287,7 +1287,7 @@ XXH_PUBLIC_API XXH128_hash_t XXH128(cons
#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */
# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \
- || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */
+ || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) || defined(__loongarch64) /* visual */
# define XXH_FORCE_ALIGN_CHECK 0
# else
# define XXH_FORCE_ALIGN_CHECK 1
--- ceph-18.2.3+ds.orig/src/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ ceph-18.2.3+ds/src/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -160,6 +160,10 @@ static inline tokutime_t toku_time_now(v
struct timeval tv;
gettimeofday(&tv, nullptr);
return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+#elif defined(__loongarch64)
+ unsigned long result;
+ asm volatile ("rdtime.d\t%0,$r0" : "=r" (result));
+ return result;
#else
#error No timer implementation for this platform
#endif