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
main
Igor Canadi 11 years ago
parent 9efbd85ac9
commit 313b2e5da1
  1. 40
      INSTALL.md
  2. 10
      Makefile
  3. 6
      build_tools/build_detect_platform

@ -1,19 +1,32 @@
## Dependencies ## 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:
RocksDB is developed on Linux (CentOS release 5.2), with gcc 4.8.1. * [recommended] `make static_lib` will compile librocksdb.a, RocksDB static library.
It depends on gcc with C++11 support.
* RocksDB depends on the following libraries: * `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
* You can link RocksDB with following compression libraries:
- [zlib](http://www.zlib.net/) - a library for data compression. - [zlib](http://www.zlib.net/) - a library for data compression.
- [bzip2](http://www.bzip.org/) - 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 - [snappy](https://code.google.com/p/snappy/) - a library for fast
data compression. 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, * All our tools depend on:
but some things may fail. We do not support releases without the compression - [gflags](https://code.google.com/p/gflags/) - a library that handles
libraries. You are on your own. command line flags processing. You can compile rocksdb library even
if you don't have gflags installed.
## Supported platforms ## Supported platforms
@ -69,12 +82,3 @@ libraries. You are on your own.
* **iOS**: * **iOS**:
* Run: `TARGET_OS=IOS make static_lib` * 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)

@ -14,12 +14,10 @@ else
endif endif
ifeq ($(MAKECMDGOALS),shared_lib) ifeq ($(MAKECMDGOALS),shared_lib)
PLATFORM_SHARED_LDFLAGS=-fPIC
OPT += -DNDEBUG OPT += -DNDEBUG
endif endif
ifeq ($(MAKECMDGOALS),static_lib) ifeq ($(MAKECMDGOALS),static_lib)
PLATFORM_SHARED_LDFLAGS=-fPIC
OPT += -DNDEBUG OPT += -DNDEBUG
endif endif
@ -181,10 +179,6 @@ release:
$(MAKE) clean $(MAKE) clean
OPT="-DNDEBUG -O2" $(MAKE) static_lib $(PROGRAMS) -j32 OPT="-DNDEBUG -O2" $(MAKE) static_lib $(PROGRAMS) -j32
release_shared_lib:
$(MAKE) clean
OPT="-DNDEBUG -O2" $(MAKE) shared_lib -j32
coverage: coverage:
$(MAKE) clean $(MAKE) clean
COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS+="-lgcov" $(MAKE) all check -j32 COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS+="-lgcov" $(MAKE) all check -j32
@ -192,11 +186,11 @@ coverage:
# Delete intermediate files # Delete intermediate files
find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" -exec rm {} \; 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 for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
python tools/ldb_test.py python tools/ldb_test.py
ldb_tests: all $(PROGRAMS) $(TESTS) $(TOOLS) ldb_tests: ldb
python tools/ldb_test.py python tools/ldb_test.py
crash_test: whitebox_crash_test blackbox_crash_test crash_test: whitebox_crash_test blackbox_crash_test

@ -184,12 +184,6 @@ if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then
# Also don't need any compilation tests if compiling on fbcode # Also don't need any compilation tests if compiling on fbcode
true true
else 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 <atomic>. Otherwise use port_posix.h. # If -std=c++0x works, use <atomic>. Otherwise use port_posix.h.
$CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF $CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
#include <atomic> #include <atomic>

Loading…
Cancel
Save