From d78c6b28c452acad0666561c4daeac689042f7b3 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 19 Jan 2016 04:45:21 +0000 Subject: [PATCH] Changes for build on solaris Makefile adjust paths for solaris build Makefile enable _GLIBCXX_USE_C99 so that std::to_string is available db_compaction_test.cc Initialise a variable to avoid a compilation error db_impl.cc Include db_test.cc Include Environment.java recognise solaris envrionment options_bulder.cc Make log unambiguous geodb_impl.cc Make log and floor unambiguous --- Makefile | 18 +++++++++++++++--- db/db_compaction_test.cc | 2 +- db/db_impl.cc | 1 + db/db_test.cc | 1 + .../java/org/rocksdb/util/Environment.java | 10 ++++++++-- util/options_builder.cc | 2 ++ utilities/geodb/geodb_impl.cc | 3 +++ 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 396b8e201..507f0948f 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,9 @@ else OPT += -DNDEBUG endif +ifeq ($(PLATFORM), OS_SOLARIS) + PLATFORM_CXXFLAGS += -D _GLIBCXX_USE_C99 +endif ifneq ($(filter -DROCKSDB_LITE,$(OPT)),) # found CFLAGS += -fno-exceptions @@ -1036,7 +1039,11 @@ install: install-static # --------------------------------------------------------------------------- JAVA_INCLUDE = -I$(JAVA_HOME)/include/ -I$(JAVA_HOME)/include/linux -ARCH := $(shell getconf LONG_BIT) +ifeq ($(PLATFORM), OS_SOLARIS) + ARCH := $(shell isainfo -b) +else + ARCH := $(shell getconf LONG_BIT) +endif ROCKSDBJNILIB = librocksdbjni-linux$(ARCH).so ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-linux$(ARCH).jar ROCKSDB_JAR_ALL = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH).jar @@ -1044,14 +1051,19 @@ ROCKSDB_JAVADOCS_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PA ROCKSDB_SOURCES_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-sources.jar ifeq ($(PLATFORM), OS_MACOSX) -ROCKSDBJNILIB = librocksdbjni-osx.jnilib -ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-osx.jar + ROCKSDBJNILIB = librocksdbjni-osx.jnilib + ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-osx.jar ifneq ("$(wildcard $(JAVA_HOME)/include/darwin)","") JAVA_INCLUDE = -I$(JAVA_HOME)/include -I $(JAVA_HOME)/include/darwin else JAVA_INCLUDE = -I/System/Library/Frameworks/JavaVM.framework/Headers/ endif endif +ifeq ($(PLATFORM), OS_SOLARIS) + ROCKSDBJNILIB = librocksdbjni-solaris$(ARCH).so + ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-solaris$(ARCH).jar + JAVA_INCLUDE = -I$(JAVA_HOME)/include/ -I$(JAVA_HOME)/include/solaris +endif libz.a: -rm -rf zlib-1.2.8 diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index e2925ba07..d29b50e7f 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -1898,7 +1898,7 @@ TEST_P(DBCompactionTestWithParam, DISABLED_CompactFilesOnLevelCompaction) { std::set overlapping_file_names; std::vector compaction_input_file_names; for (int f = 0; f < file_picked; ++f) { - int level; + int level = 0; auto file_meta = PickFileRandomly(cf_meta, &rnd, &level); compaction_input_file_names.push_back(file_meta->name); GetOverlappingFileNumbersForLevelCompaction( diff --git a/db/db_impl.cc b/db/db_impl.cc index 77dc9457d..fd667aa04 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/db/db_test.cc b/db/db_test.cc index 34b94cfdf..442658b44 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -20,6 +20,7 @@ #ifndef OS_WIN #include #endif +#include #include "db/filename.h" #include "db/dbformat.h" diff --git a/java/src/main/java/org/rocksdb/util/Environment.java b/java/src/main/java/org/rocksdb/util/Environment.java index f65b92a0e..306eae093 100644 --- a/java/src/main/java/org/rocksdb/util/Environment.java +++ b/java/src/main/java/org/rocksdb/util/Environment.java @@ -18,6 +18,10 @@ public class Environment { OS.contains("aix")); } + public static boolean isSolaris() { + return OS.contains("sunos"); + } + public static boolean is64Bit() { return (ARCH.indexOf("64") > 0); } @@ -36,7 +40,9 @@ public class Environment { return String.format("%sjni-linux%s", name, arch); } else if (isMac()) { return String.format("%sjni-osx", name); - } + } else if (isSolaris()) { + return String.format("%sjni-solaris%d", name, is64Bit() ? 64 : 32); + } throw new UnsupportedOperationException(); } @@ -45,7 +51,7 @@ public class Environment { } private static String appendLibOsSuffix(final String libraryFileName, final boolean shared) { - if (isUnix()) { + if (isUnix() || isSolaris()) { return libraryFileName + ".so"; } else if (isMac()) { return libraryFileName + (shared ? ".dylib" : ".jnilib"); diff --git a/util/options_builder.cc b/util/options_builder.cc index 67fd268a9..72ea7a46d 100644 --- a/util/options_builder.cc +++ b/util/options_builder.cc @@ -7,6 +7,8 @@ #include #include "rocksdb/options.h" +using std::log; + namespace rocksdb { namespace { diff --git a/utilities/geodb/geodb_impl.cc b/utilities/geodb/geodb_impl.cc index b30dd6333..e134dd62c 100644 --- a/utilities/geodb/geodb_impl.cc +++ b/utilities/geodb/geodb_impl.cc @@ -19,6 +19,9 @@ #include "util/coding.h" #include "util/string_util.h" +using std::log; +using std::floor; + // // There are two types of keys. The first type of key-values // maps a geo location to the set of object ids and their values.