From 313b2e5da1112a1fda0243efdcf29d1538038a40 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 7 May 2014 16:51:30 -0700 Subject: [PATCH] Better INSTALL.md and Makefile rules Summary: We have a lot of problems with gflags. However, when compiling rocksdb static library, we don't need gflags dependency. Reorganize INSTALL.md such that first-time customers don't need any dependency installed to actually build rocksdb static library. Test Plan: none Reviewers: dhruba, haobo Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D18501 --- INSTALL.md | 40 +++++++++++++++++-------------- Makefile | 10 ++------ build_tools/build_detect_platform | 6 ----- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 2a91be697..a4ae08f10 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,19 +1,32 @@ +## Compilation + +RocksDB's library should be able to compile without any dependency installed, +although we recommend installing some compression libraries (see below). +We do depend on newer gcc with C++11 support. + +There are few options when compiling RocksDB: + +* [recommended] `make static_lib` will compile librocksdb.a, RocksDB static library. + +* `make shared_lib` will compile librocksdb.so, RocksDB shared library. + +* `make check` will compile and run all the unit tests + +* `make all` will compile our static library, and all our tools and unit tests. Our tools +depend on gflags. You will need to have gflags installed to run `make all`. + ## Dependencies -RocksDB is developed on Linux (CentOS release 5.2), with gcc 4.8.1. -It depends on gcc with C++11 support. - -* RocksDB depends on the following libraries: +* You can link RocksDB with following compression libraries: - [zlib](http://www.zlib.net/) - a library for data compression. - [bzip2](http://www.bzip.org/) - a library for data compression. - [snappy](https://code.google.com/p/snappy/) - a library for fast data compression. - - [gflags](https://code.google.com/p/gflags/) - a library that handles - command line flags processing. -RocksDB will successfully compile without the compression libraries included, -but some things may fail. We do not support releases without the compression -libraries. You are on your own. +* All our tools depend on: + - [gflags](https://code.google.com/p/gflags/) - a library that handles + command line flags processing. You can compile rocksdb library even + if you don't have gflags installed. ## Supported platforms @@ -69,12 +82,3 @@ libraries. You are on your own. * **iOS**: * Run: `TARGET_OS=IOS make static_lib` - -## Compilation -`make clean; make` will compile librocksdb.a (RocksDB static library) and all -the unit tests. You can run all unit tests with `make check`. - -For shared library builds, exec `make shared_lib` instead. - -If you followed the above steps and your compile or unit tests fail, -please submit an issue: (https://github.com/facebook/rocksdb/issues) diff --git a/Makefile b/Makefile index 93217fc98..95a94810d 100644 --- a/Makefile +++ b/Makefile @@ -14,12 +14,10 @@ else endif ifeq ($(MAKECMDGOALS),shared_lib) -PLATFORM_SHARED_LDFLAGS=-fPIC OPT += -DNDEBUG endif ifeq ($(MAKECMDGOALS),static_lib) -PLATFORM_SHARED_LDFLAGS=-fPIC OPT += -DNDEBUG endif @@ -181,10 +179,6 @@ release: $(MAKE) clean OPT="-DNDEBUG -O2" $(MAKE) static_lib $(PROGRAMS) -j32 -release_shared_lib: - $(MAKE) clean - OPT="-DNDEBUG -O2" $(MAKE) shared_lib -j32 - coverage: $(MAKE) clean COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS+="-lgcov" $(MAKE) all check -j32 @@ -192,11 +186,11 @@ coverage: # Delete intermediate files find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; -check: $(PROGRAMS) $(TESTS) $(TOOLS) +check: $(TESTS) ldb for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done python tools/ldb_test.py -ldb_tests: all $(PROGRAMS) $(TESTS) $(TOOLS) +ldb_tests: ldb python tools/ldb_test.py crash_test: whitebox_crash_test blackbox_crash_test diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 99a212b1b..ec37a999d 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -184,12 +184,6 @@ if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then # Also don't need any compilation tests if compiling on fbcode true else - # do fPIC on 64 bit in non-fbcode environment - case "$TARGET_OS" in - x86_64) - PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS -fPIC" - esac - # If -std=c++0x works, use . Otherwise use port_posix.h. $CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <