From 69c8d524a35d6eded518bdc51b29caa73ca43220 Mon Sep 17 00:00:00 2001 From: Ayappan Date: Mon, 27 Mar 2017 13:57:07 -0700 Subject: [PATCH] Fix jni library name for PowerPC Architecture Summary: Right now, building rocksdbjava in PowerPC is broken due to JNI library name. I figured it out that "uname -m" and java's os.arch matches in PowerPC architecture. I made use of this advantage to fix the issue. More info can found from this issue --> https://github.com/facebook/rocksdb/issues/1317 Closes https://github.com/facebook/rocksdb/pull/2040 Differential Revision: D4779967 Pulled By: siying fbshipit-source-id: 259f939 --- Makefile | 7 ++++++- java/src/main/java/org/rocksdb/util/Environment.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c798159a0..35a506f85 100644 --- a/Makefile +++ b/Makefile @@ -1380,7 +1380,12 @@ ifeq ($(PLATFORM), OS_SOLARIS) else ARCH := $(shell getconf LONG_BIT) endif -ROCKSDBJNILIB = librocksdbjni-linux$(ARCH).so + +ifeq (,$(findstring ppc,$(MACHINE))) + ROCKSDBJNILIB = librocksdbjni-linux$(ARCH).so +else + ROCKSDBJNILIB = librocksdbjni-linux-$(MACHINE).so +endif ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-linux$(ARCH).jar ROCKSDB_JAR_ALL = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH).jar ROCKSDB_JAVADOCS_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-javadoc.jar diff --git a/java/src/main/java/org/rocksdb/util/Environment.java b/java/src/main/java/org/rocksdb/util/Environment.java index 764aa964d..061d2ff91 100644 --- a/java/src/main/java/org/rocksdb/util/Environment.java +++ b/java/src/main/java/org/rocksdb/util/Environment.java @@ -42,7 +42,7 @@ public class Environment { if (isUnix()) { final String arch = is64Bit() ? "64" : "32"; if(isPowerPC()) { - return String.format("%sjni-linux-ppc%s", name, arch); + return String.format("%sjni-linux-%s", name, ARCH); } else { return String.format("%sjni-linux%s", name, arch); }