!33 [sync] PR-32: Fix build on riscv64

From: @openeuler-sync-bot 
Reviewed-by: @wenwj0 
Signed-off-by: @wenwj0
This commit is contained in:
openeuler-ci-bot 2024-06-06 14:07:26 +00:00 committed by Gitee
commit bb7f4568fd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,20 @@
--- hadoop-3.1.4-src/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h.ori 2020-07-21 01:17:58.000000000 +0800
+++ hadoop-3.1.4-src/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h 2022-09-03 12:43:35.309454600 +0800
@@ -99,6 +99,8 @@
inline uint32_t bswap(uint32_t val) {
#ifdef __aarch64__
__asm__("rev %w[dst], %w[src]" : [dst]"=r"(val) : [src]"r"(val));
+#elif defined(__ppc64__)||(__PPC64__)||(__powerpc64__)||(__riscv)
+ return __builtin_bswap32(val);
#else
__asm__("bswap %0" : "=r" (val) : "0" (val));
#endif
@@ -108,6 +110,8 @@
inline uint64_t bswap64(uint64_t val) {
#ifdef __aarch64__
__asm__("rev %[dst], %[src]" : [dst]"=r"(val) : [src]"r"(val));
+#elif defined(__ppc64__)||(__PPC64__)||(__powerpc64__)||(__riscv)
+ return __builtin_bswap64(val);
#else
#ifdef __X64
__asm__("bswapq %0" : "=r" (val) : "0" (val));

View File

@ -0,0 +1,11 @@
--- hadoop-3.1.4-src/hadoop-project/pom.xml.ori 2020-07-21 14:34:40.000000000 +0800
+++ hadoop-3.1.4-src/hadoop-project/pom.xml 2022-08-26 13:33:06.382209900 +0800
@@ -85,7 +85,7 @@
<!-- Maven protoc compiler -->
<protobuf-maven-plugin.version>0.5.1</protobuf-maven-plugin.version>
- <os-maven-plugin.version>1.5.0.Final</os-maven-plugin.version>
+ <os-maven-plugin.version>1.7.1</os-maven-plugin.version>
<zookeeper.version>3.4.13</zookeeper.version>
<curator.version>2.13.0</curator.version>

View File

@ -12,7 +12,7 @@
%define _binaries_in_noarch_packages_terminate_build 0 %define _binaries_in_noarch_packages_terminate_build 0
Name: hadoop-3.1 Name: hadoop-3.1
Version: 3.1.4 Version: 3.1.4
Release: 7 Release: 8
Summary: A software platform for processing vast amounts of data Summary: A software platform for processing vast amounts of data
# The BSD license file is missing # The BSD license file is missing
# https://issues.apache.org/jira/browse/HADOOP-9849 # https://issues.apache.org/jira/browse/HADOOP-9849
@ -36,6 +36,8 @@ Source13: %{real_name}-yarn-site.xml
Patch1: 0001-sys_errlist-undeclared.patch Patch1: 0001-sys_errlist-undeclared.patch
Patch2: 0002-bugfix-invalid-variable-name.patch Patch2: 0002-bugfix-invalid-variable-name.patch
Patch3: 0003-compatible-with-gcc12.patch Patch3: 0003-compatible-with-gcc12.patch
Patch4: 0004-fix_build_issue_on_riscv.patch
Patch5: 0005-upgrade_os-maven_plugin_to_1.7.1.patch
BuildRoot: %{_tmppath}/%{real_name}-%{version}-%{release}-root BuildRoot: %{_tmppath}/%{real_name}-%{version}-%{release}-root
@ -244,6 +246,9 @@ This package contains files needed to run Apache Hadoop YARN in secure mode.
%prep %prep
%autosetup -p1 -n %{real_name}-%{version}-src %autosetup -p1 -n %{real_name}-%{version}-src
mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-aarch_64 -Dpackaging=exe -Dfile=/usr/bin/protoc mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-aarch_64 -Dpackaging=exe -Dfile=/usr/bin/protoc
%ifarch riscv64
mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-riscv64 -Dpackaging=exe -Dfile=/usr/bin/protoc
%endif
mvn install:install-file -DgroupId=org.fusesource.leveldbjni -DartifactId=leveldbjni-all -Dversion=1.8 -Dpackaging=jar -Dfile=/usr/lib/java/leveldbjni-all.jar mvn install:install-file -DgroupId=org.fusesource.leveldbjni -DartifactId=leveldbjni-all -Dversion=1.8 -Dpackaging=jar -Dfile=/usr/lib/java/leveldbjni-all.jar
mvn install:install-file -DgroupId=org.fusesource.leveldbjni -DartifactId=leveldbjni -Dversion=1.8 -Dpackaging=jar -Dfile=/usr/lib/java/leveldbjni/leveldbjni.jar mvn install:install-file -DgroupId=org.fusesource.leveldbjni -DartifactId=leveldbjni -Dversion=1.8 -Dpackaging=jar -Dfile=/usr/lib/java/leveldbjni/leveldbjni.jar
mvn install:install-file -DgroupId=org.iq80.leveldb -DartifactId=leveldb-api -Dversion=0.7 -Dpackaging=jar -Dfile=/usr/share/java/leveldb-java/leveldb-api.jar mvn install:install-file -DgroupId=org.iq80.leveldb -DartifactId=leveldb-api -Dversion=0.7 -Dpackaging=jar -Dfile=/usr/share/java/leveldb-java/leveldb-api.jar
@ -305,6 +310,11 @@ then
export CFLAGS="$CFLAGS -mcpu=generic+Crc -Wno-reserved-user-defined-literal" export CFLAGS="$CFLAGS -mcpu=generic+Crc -Wno-reserved-user-defined-literal"
fi fi
%ifarch riscv64
export MAVEN_OPTS="-Xms2048M -Xmx8000M"
function keepalive() { while true; do date; sleep 3600; done }
keepalive &
%endif
mvn -Dsnappy.lib=/usr/lib64 -Dbundle.snappy -Dcontainer-executor.conf.dir=%{_sysconfdir}/%{real_name} -Pdist,native -DskipTests -DskipIT -Dmaven.javadoc.skip=true package mvn -Dsnappy.lib=/usr/lib64 -Dbundle.snappy -Dcontainer-executor.conf.dir=%{_sysconfdir}/%{real_name} -Pdist,native -DskipTests -DskipIT -Dmaven.javadoc.skip=true package
%install %install
@ -1120,6 +1130,10 @@ fi
%config(noreplace) %{_sysconfdir}/%{real_name}/container-executor.cfg %config(noreplace) %{_sysconfdir}/%{real_name}/container-executor.cfg
%changelog %changelog
* Sun May 12 2024 Dingli Zhang <dingli@iscas.ac.cn> - 3.1.4-8
- Fix build on riscv64
- Upgrade os-maven-plugin to 1.7.1
* Wed Oct 11 2023 luofeng <luofeng13@huawei.com> - 3.1.4-7 * Wed Oct 11 2023 luofeng <luofeng13@huawei.com> - 3.1.4-7
- support clang build - support clang build