Skip to content

Commit

Permalink
Better INSTALL.md and Makefile rules
Browse files Browse the repository at this point in the history
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
  • Loading branch information
igorcanadi committed May 7, 2014
1 parent 9efbd85 commit 313b2e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 32 deletions.
40 changes: 22 additions & 18 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -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.
It depends on gcc with C++11 support.
* [recommended] `make static_lib` will compile librocksdb.a, RocksDB static library.

* 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.
- [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

Expand Down Expand Up @@ -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)
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -181,22 +179,18 @@ 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
(cd coverage; ./coverage_test.sh)
# 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
Expand Down
6 changes: 0 additions & 6 deletions build_tools/build_detect_platform
Original file line number Diff line number Diff line change
Expand Up @@ -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 <atomic>. Otherwise use port_posix.h.
$CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
#include <atomic>
Expand Down

0 comments on commit 313b2e5

Please sign in to comment.