!32 [sync] PR-30: riscv64: 回合上游补丁修复构建错误
From: @openeuler-sync-bot Reviewed-by: @caodongxia, @wang--ge Signed-off-by: @caodongxia, @wang--ge
This commit is contained in:
commit
83d05fca08
114
0001-Add-support-for-linux-riscv64-12139.patch
Normal file
114
0001-Add-support-for-linux-riscv64-12139.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
From 5502f0672908ce2c5891a3290bdfb57182435adb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ludovic Henry <git@ludovic.dev>
|
||||||
|
Date: Thu, 14 Dec 2023 11:27:17 -0800
|
||||||
|
Subject: [PATCH] Add support for linux-riscv64 (#12139)
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
Following https://github.com/evolvedbinary/docker-rocksjava/pull/2, we can now build rocksdb on riscv64.
|
||||||
|
|
||||||
|
I've verified this works as expected with `make rocksdbjavastaticdockerriscv64`.
|
||||||
|
|
||||||
|
Also fixes https://github.com/facebook/rocksdb/issues/10500 https://github.com/facebook/rocksdb/issues/11994
|
||||||
|
|
||||||
|
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12139
|
||||||
|
|
||||||
|
Reviewed By: jaykorean
|
||||||
|
|
||||||
|
Differential Revision: D52128098
|
||||||
|
|
||||||
|
Pulled By: akankshamahajan15
|
||||||
|
|
||||||
|
fbshipit-source-id: 706d36a3f8a9e990b76f426bc450937a0cd1a537
|
||||||
|
---
|
||||||
|
Makefile | 8 ++++++--
|
||||||
|
build_tools/build_detect_platform | 9 +++++----
|
||||||
|
java/src/main/java/org/rocksdb/util/Environment.java | 6 +++++-
|
||||||
|
3 files changed, 16 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index d9ebbb72b..8829be9d8 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -2060,7 +2060,7 @@ JAVA_INCLUDE = -I$(JAVA_HOME)/include/ -I$(JAVA_HOME)/include/linux
|
||||||
|
ifeq ($(PLATFORM), OS_SOLARIS)
|
||||||
|
ARCH := $(shell isainfo -b)
|
||||||
|
else ifeq ($(PLATFORM), OS_OPENBSD)
|
||||||
|
- ifneq (,$(filter amd64 ppc64 ppc64le s390x arm64 aarch64 sparc64 loongarch64, $(MACHINE)))
|
||||||
|
+ ifneq (,$(filter amd64 ppc64 ppc64le s390x arm64 aarch64 riscv64 sparc64 loongarch64, $(MACHINE)))
|
||||||
|
ARCH := 64
|
||||||
|
else
|
||||||
|
ARCH := 32
|
||||||
|
@@ -2081,7 +2081,7 @@ ifneq ($(origin JNI_LIBC), undefined)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (,$(ROCKSDBJNILIB))
|
||||||
|
-ifneq (,$(filter ppc% s390x arm64 aarch64 sparc64 loongarch64, $(MACHINE)))
|
||||||
|
+ifneq (,$(filter ppc% s390x arm64 aarch64 riscv64 sparc64 loongarch64, $(MACHINE)))
|
||||||
|
ROCKSDBJNILIB = librocksdbjni-linux-$(MACHINE)$(JNI_LIBC_POSTFIX).so
|
||||||
|
else
|
||||||
|
ROCKSDBJNILIB = librocksdbjni-linux$(ARCH)$(JNI_LIBC_POSTFIX).so
|
||||||
|
@@ -2346,6 +2346,10 @@ rocksdbjavastaticdockers390x:
|
||||||
|
mkdir -p java/target
|
||||||
|
docker run --rm --name rocksdb_linux_s390x-be --attach stdin --attach stdout --attach stderr --volume $(HOME)/.m2:/root/.m2:ro --volume `pwd`:/rocksdb-host:ro --volume /rocksdb-local-build --volume `pwd`/java/target:/rocksdb-java-target --env DEBUG_LEVEL=$(DEBUG_LEVEL) evolvedbinary/rocksjava:ubuntu18_s390x-be /rocksdb-host/java/crossbuild/docker-build-linux-centos.sh
|
||||||
|
|
||||||
|
+rocksdbjavastaticdockerriscv64:
|
||||||
|
+ mkdir -p java/target
|
||||||
|
+ docker run --rm --name rocksdb_linux_riscv64-be --attach stdin --attach stdout --attach stderr --volume $(HOME)/.m2:/root/.m2:ro --volume `pwd`:/rocksdb-host:ro --volume /rocksdb-local-build --volume `pwd`/java/target:/rocksdb-java-target --env DEBUG_LEVEL=$(DEBUG_LEVEL) evolvedbinary/rocksjava:ubuntu20_riscv64-be /rocksdb-host/java/crossbuild/docker-build-linux-centos.sh
|
||||||
|
+
|
||||||
|
rocksdbjavastaticdockerx86musl:
|
||||||
|
mkdir -p java/target
|
||||||
|
docker run --rm --name rocksdb_linux_x86-musl-be --platform linux/386 --attach stdin --attach stdout --attach stderr --volume $(HOME)/.m2:/root/.m2:ro --volume `pwd`:/rocksdb-host:ro --volume /rocksdb-local-build --volume `pwd`/java/target:/rocksdb-java-target --env DEBUG_LEVEL=$(DEBUG_LEVEL) evolvedbinary/rocksjava:alpine3_x86-be /rocksdb-host/java/crossbuild/docker-build-linux-alpine.sh
|
||||||
|
diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform
|
||||||
|
index fd70a9835..a5e2b5aa2 100755
|
||||||
|
--- a/build_tools/build_detect_platform
|
||||||
|
+++ b/build_tools/build_detect_platform
|
||||||
|
@@ -647,8 +647,10 @@ if [ "$PORTABLE" == "" ] || [ "$PORTABLE" == 0 ]; then
|
||||||
|
fi
|
||||||
|
COMMON_FLAGS="$COMMON_FLAGS"
|
||||||
|
elif test -n "`echo $TARGET_ARCHITECTURE | grep ^riscv64`"; then
|
||||||
|
- RISC_ISA=$(cat /proc/cpuinfo | grep isa | head -1 | cut --delimiter=: -f 2 | cut -b 2-)
|
||||||
|
- COMMON_FLAGS="$COMMON_FLAGS -march=${RISC_ISA}"
|
||||||
|
+ RISC_ISA=$(cat /proc/cpuinfo | grep -E '^isa\s*:' | head -1 | cut --delimiter=: -f 2 | cut -b 2-)
|
||||||
|
+ if [ -n "${RISCV_ISA}" ]; then
|
||||||
|
+ COMMON_FLAGS="$COMMON_FLAGS -march=${RISC_ISA}"
|
||||||
|
+ fi
|
||||||
|
elif [ "$TARGET_OS" == "IOS" ]; then
|
||||||
|
COMMON_FLAGS="$COMMON_FLAGS"
|
||||||
|
else
|
||||||
|
@@ -660,8 +662,7 @@ else
|
||||||
|
if test -n "`echo $TARGET_ARCHITECTURE | grep ^s390x`"; then
|
||||||
|
COMMON_FLAGS="$COMMON_FLAGS -march=z196 "
|
||||||
|
elif test -n "`echo $TARGET_ARCHITECTURE | grep ^riscv64`"; then
|
||||||
|
- RISC_ISA=$(cat /proc/cpuinfo | grep isa | head -1 | cut --delimiter=: -f 2 | cut -b 2-)
|
||||||
|
- COMMON_FLAGS="$COMMON_FLAGS -march=${RISC_ISA}"
|
||||||
|
+ COMMON_FLAGS="$COMMON_FLAGS -march=rv64gc"
|
||||||
|
elif test "$USE_SSE"; then
|
||||||
|
# USE_SSE is DEPRECATED
|
||||||
|
# This is a rough approximation of the old USE_SSE behavior
|
||||||
|
diff --git a/java/src/main/java/org/rocksdb/util/Environment.java b/java/src/main/java/org/rocksdb/util/Environment.java
|
||||||
|
index 53ff65d26..78b73dc5d 100644
|
||||||
|
--- a/java/src/main/java/org/rocksdb/util/Environment.java
|
||||||
|
+++ b/java/src/main/java/org/rocksdb/util/Environment.java
|
||||||
|
@@ -36,6 +36,10 @@ public class Environment {
|
||||||
|
return ARCH.contains("s390x");
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static boolean isRiscv64() {
|
||||||
|
+ return ARCH.contains("riscv64");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public static boolean isWindows() {
|
||||||
|
return (OS.contains("win"));
|
||||||
|
}
|
||||||
|
@@ -180,7 +184,7 @@ public class Environment {
|
||||||
|
public static String getJniLibraryName(final String name) {
|
||||||
|
if (isUnix()) {
|
||||||
|
final String arch = is64Bit() ? "64" : "32";
|
||||||
|
- if (isPowerPC() || isAarch64()) {
|
||||||
|
+ if (isPowerPC() || isAarch64() || isRiscv64()) {
|
||||||
|
return String.format("%sjni-linux-%s%s", name, ARCH, getLibcPostfix());
|
||||||
|
} else if (isS390x()) {
|
||||||
|
return String.format("%sjni-linux-%s", name, ARCH);
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
10
rocksdb.spec
10
rocksdb.spec
@ -1,6 +1,6 @@
|
|||||||
Name: rocksdb
|
Name: rocksdb
|
||||||
Version: 8.5.4
|
Version: 8.5.4
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: A Persistent Key-Value Store for Flash and RAM Storage
|
Summary: A Persistent Key-Value Store for Flash and RAM Storage
|
||||||
|
|
||||||
License: GPLv2 and Apache 2.0 License
|
License: GPLv2 and Apache 2.0 License
|
||||||
@ -23,6 +23,7 @@ Source3: https://repo1.maven.org/maven2/org/mockito/mockito-all/1.10.19/mo
|
|||||||
Source4: https://repo1.maven.org/maven2/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar
|
Source4: https://repo1.maven.org/maven2/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar
|
||||||
Source5: https://repo1.maven.org/maven2/junit/junit/4.13.1/junit-4.13.1.jar
|
Source5: https://repo1.maven.org/maven2/junit/junit/4.13.1/junit-4.13.1.jar
|
||||||
Patch0: some-jar-packs-should-provides-local.patch
|
Patch0: some-jar-packs-should-provides-local.patch
|
||||||
|
Patch1: 0001-Add-support-for-linux-riscv64-12139.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Rocksdb is a library that forms the core building block for a fast key value
|
Rocksdb is a library that forms the core building block for a fast key value
|
||||||
@ -61,11 +62,7 @@ export CFLAGS="%{optflags}"
|
|||||||
# librocksdb*.so* has undefined symbols dlopen and so on, “-ldl” needs to be added here
|
# librocksdb*.so* has undefined symbols dlopen and so on, “-ldl” needs to be added here
|
||||||
export EXTRA_CXXFLAGS=" -std=c++17 %{optflags} -ldl"
|
export EXTRA_CXXFLAGS=" -std=c++17 %{optflags} -ldl"
|
||||||
export DISABLE_WARNING_AS_ERROR=1
|
export DISABLE_WARNING_AS_ERROR=1
|
||||||
%ifnarch riscv64
|
|
||||||
%make_build shared_lib
|
%make_build shared_lib
|
||||||
%else
|
|
||||||
PORTABLE=1 %make_build shared_lib
|
|
||||||
%endif
|
|
||||||
# build rocksdbjni
|
# build rocksdbjni
|
||||||
export JAVA_HOME=%{_jvmdir}/java-1.8.0-openjdk
|
export JAVA_HOME=%{_jvmdir}/java-1.8.0-openjdk
|
||||||
export EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS} -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/linux"
|
export EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS} -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/linux"
|
||||||
@ -105,6 +102,9 @@ install -D -m 0644 java/target/%{name}jni-%{version}-linux$(getconf LONG_BIT).ja
|
|||||||
%{_javadir}/%{name}jni/%{name}jni.jar
|
%{_javadir}/%{name}jni/%{name}jni.jar
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Mar 21 2024 laokz <zhangkai@iscas.ac.cn> - 8.5.4-3
|
||||||
|
- Backport v8.10.0 patch to fix riscv64 build
|
||||||
|
|
||||||
* Mon Mar 04 2024 wuzhaomin <wuzhaomin@kylinos.cn> - 8.5.4-2
|
* Mon Mar 04 2024 wuzhaomin <wuzhaomin@kylinos.cn> - 8.5.4-2
|
||||||
- Modify error date
|
- Modify error date
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user