RocksDB make installation

From the (slightly) outdated documentation on pyrocksdb it says:

"If you don't want to call make install

export the following environment variables:"

$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:`pwd`/include
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`pwd`
$ export LIBRARY_PATH=${LIBRARY_PATH}:`pwd`

      

But the installation instructions for RocksDB don't seem to mention the purpose install

!

Is there an accepted procedure for installing RocksDB from source?


My thoughts are to just copy the contents of the directory include

from the rockdb directory to something like /usr/local/include

and copy the files to librocksdb.so

and librocksdb.a

into /usr/local/lib

. Is this an acceptable method?

Note. The environment variable export method was less preferred for me since I built rockdb in a directory inside my home folder - I hope for a cleaner solution (interpret this as you want).

+3


source to share


3 answers


RocksDB recently made an installation . If you are using the latest version, you can do it make install

in RocksDB.



+3


source


There is no target in the current Makefile install

.

This violates long-standing conventions for writing Make files (or almost any other build system ...); this should be considered a defect.

Without spending a lot of time analyzing, I can't be sure, but the purpose of the installation should be something like this:

prefix=/usr/local
bindir=$(prefix)/bin
# Normally you'd write a macro for this; 'lib' for 32-bit, 'lib64' for 64...
libdir=$(prefix)/lib64
includedir=$(prefix)/include

# Define this to be the directory(s) the headers are installed into.
# This should not include the 'include' element:
#    include/rocksdb/stuff -> rocksdb/stuff
HEADER_DIRS=...

# Define this so all paths are relative to both the $CWD/include directory...
# so include/rocksdb/foo.h -> HEADER_FILES=rocksdb/foo.h
HEADER_FILES=...

.PHONY: install
install: $(TOOLS) $(LIBRARY) $(SHARED) $(MAKEFILES)
     mkdir -p $(DESTDIR)$(bindir)
     mkdir -p $(DESTDIR)$(libdir)
     mkdir -p $(DESTDIR)$(includedir)
     for tool in $(TOOLS); do \
         install -m 755 $$tool $(DESTDIR)$(bindir); \
     done
     # No, libraries should NOT be executable on Linux.
     install -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
     install -m 644 $(SHARED3) $(DESTDIR)$(libdir)
     ln -s $(SHARED3) $(DESTDIR)$(libdir)/$(SHARED2)
     ln -s $(SHARED2) $(DESTDIR)$(libdir)/$(SHARED1)
     for header_dir in $(HEADER_DIRS); do \
         mkdir -p $(DESTDIR)$(includedir)/$$header_dir; \
     done
     for header in $(HEADER_FILES); do \
         install -m 644 include/$$header $(DESTDIR)$(includedir)/$$header; \
     done

      

This will allow you to install files in /usr/local

by simply doing:

make install

      



However, the reason it is parameterized so heavily is because you can change the destination folder without changing the Makefile. For example, to change your destination to /usr

, you simply do:

make prefix=/usr install

      

Alternatively, if you want to test the installation process without going into the filesystem, you can do:

make DESTDIR=/tmp/rocksdb_install_test prefix=/usr install

      

This will put the files in /tmp/rocksdb_install_test/usr

you can check if you want them where you want them to be ... when you are happy you can just do rm -Rf /tmp/rocksdb_install_test

to clean up.

The variables I used are needed to package with RPM or DEB.

+3


source


I am using ubuntu 16.04

DEBUG_LEVEL=0 make shared_lib install-shared

      

Thus, the installation has already been generated in operation.

If you want to save time, you can specify the number of processors used in the process by passing -j [n], in my case, -j4

DEBUG_LEVEL=0 make -j4 shared_lib install-shared

      

In the case of ubuntu this is enough, but in the case of ubuntu for docker you need to specify where the lib was installed.

export LD_LIBRARY_PATH=/usr/local/lib

      

Hope this helps. Kemper

0


source







All Articles