Closed dch closed 9 years ago
OSX: Yosemite 10.10.4 (14E46)
uname:
Darwin akai.skunkwerks.at 14.4.0 Darwin Kernel Version 14.4.0
Thu May 28 11:35:04 PDT 2015
root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Thank you for your report. I've briefly check that as follows:
It was working fine on my environment. You could check your environment, again.
@dch missing symbol _LZ4_compressBound
is only referenced
if you have installed lz4 in your system and visible at compile time.
The below code block is where deciding whether lz4 is linked or not. https://github.com/facebook/rocksdb/blob/rocksdb-3.11.2/build_tools/build_detect_platform#L259-L269
So there are two solutions.
I've reproduced this issue as below. I'll check and fix that on my environment then share the report.
$ brew install lz4
==> Downloading https://homebrew.bintray.com/bottles/lz4-r131.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring lz4-r131.yosemite.bottle.tar.gz
🍺 /usr/local/Cellar/lz4/r131: 12 files, 436K
$ which lz4
/usr/local/bin/lz4
$ ls -l /usr/local/lib/ | grep liblz4*
lrwxr-xr-x 1 yosuke.hara admin 41 Jul 22 09:46 liblz4.1.7.1.dylib -> ../Cellar/lz4/r131/lib/liblz4.1.7.1.dylib
lrwxr-xr-x 1 yosuke.hara admin 37 Jul 22 09:46 liblz4.1.dylib -> ../Cellar/lz4/r131/lib/liblz4.1.dylib
lrwxr-xr-x 1 yosuke.hara admin 31 Jul 22 09:46 liblz4.a -> ../Cellar/lz4/r131/lib/liblz4.a
lrwxr-xr-x 1 yosuke.hara admin 35 Jul 22 09:46 liblz4.dylib -> ../Cellar/lz4/r131/lib/liblz4.dylib
lrwxr-xr-x 1 yosuke.hara admin 38 Jun 16 15:18 liblzma.5.dylib -> ../Cellar/xz/5.2.1/lib/liblzma.5.dylib
lrwxr-xr-x 1 yosuke.hara admin 32 Jun 16 15:18 liblzma.a -> ../Cellar/xz/5.2.1/lib/liblzma.a
lrwxr-xr-x 1 yosuke.hara admin 36 Jun 16 15:18 liblzma.dylib -> ../Cellar/xz/5.2.1/lib/liblzma.dylib
$ make test
.
.
.
==> erocksdb (eunit)
======================== EUnit ========================
module 'rand_gen_1'
iterators: prev_test (module 'iterators')...
=ERROR REPORT==== 22-Jul-2015::10:05:54 ===
The on_load function for module erocksdb returned {error,
{load_failed,
"Failed to load NIF library: 'dlopen(/Users/yosuke.hara/dev/leo-project/test/erocksdb/priv/erocksdb.so, 2): Symbol not found: _LZ4_compressBound\n Referenced from: /Users/yosuke.hara/dev/leo-project/test/erocksdb/priv/erocksdb.so\n Expected in: flat namespace\n in /Users/yosuke.hara/dev/leo-project/test/erocksdb/priv/erocksdb.so'"}}
@dch if you have installed lz4 by package, you might get an old one which version is less than expected by rocksdb. In that case && you want to use lz4, you need to get the new one at https://github.com/Cyan4973/lz4, install and make it visible prior to the old one.
thanks all for help @mocchira & @yosukehara t
brew rm lz4
: erocksdb works finebrew install lz4
: erocksdb does not work against lz4 r131head "https://github.com/Cyan4973/lz4.git"
to lz4.rb recipe, then brew install -v --HEAD lz4
to build from git master: erocksdb does not work.lz4 r131
installed via brew: erocksdb does work.commit a05183d4e300b9d348624e8ac2785430ccdf795a
Author: Dave Cottlehuber <dch@skunkwerks.at>
Date: Wed Jul 22 16:24:19 2015 +0200
hack osx
diff --git a/rebar.config b/rebar.config
index b83ff9f..c14b7fc 100644
--- a/rebar.config
+++ b/rebar.config
@@ -6,8 +6,8 @@
%% Make sure to set -fPIC when compiling rocksdb
{"CFLAGS", "$CFLAGS -Wall -O3 -fPIC"},
{"CXXFLAGS", "$CXXFLAGS -std=c++11 -Wall -O3 -fPIC"},
- {"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -I c_src/rocksdb -I c_src/rocksdb/include"},
- {"DRV_LDFLAGS", "$DRV_LDFLAGS c_src/rocksdb/librocksdb.a c_src/system/lib/libsnappy.a -lstdc++ -lbz2"}
+ {"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -I c_src/rocksdb -I c_src/rocksdb/include -I /usr/local/include"},
+ {"DRV_LDFLAGS", "$DRV_LDFLAGS c_src/rocksdb/librocksdb.a c_src/system/lib/libsnappy.a -lstdc++ -lbz2 -llz4"}
]}.
{pre_hooks, [{'get-deps', "c_src/build_deps.sh get-deps"},
There may well be a better way to propagate the changes from rocksdb's mk_config.mk
which is detected as follows:
CC=cc
CXX=c++
PLATFORM=OS_MACOSX
PLATFORM_LDFLAGS= -lsnappy -lgflags -lz -lbz2 -llz4
JAVA_LDFLAGS= -lsnappy -lz -lbz2 -llz4
VALGRIND_VER=
PLATFORM_CCFLAGS= -DROCKSDB_PLATFORM_POSIX -Wall -O3 -fPIC -I /ramdisk/erocksdb/c_src/system/include -DOS_MACOSX -DSNAPPY -DGFLAGS=gflags -DZLIB -DBZIP2 -DLZ4 -Wshorten-64-to-32 -march=native
PLATFORM_CXXFLAGS=-std=c++11 -fPIC -DROCKSDB_PLATFORM_POSIX -Wall -O3 -fPIC -I /ramdisk/erocksdb/c_src/system/include -DOS_MACOSX -DSNAPPY -DGFLAGS=gflags -DZLIB -DBZIP2 -DLZ4 -Wshorten-64-to-32 -march=native
PLATFORM_SHARED_CFLAGS=-fPIC
PLATFORM_SHARED_EXT=dylib
PLATFORM_SHARED_LDFLAGS=-dynamiclib -install_name
PLATFORM_SHARED_VERSIONED=true
EXEC_LDFLAGS=
JEMALLOC_INCLUDE=
JEMALLOC_LIB=
ROCKSDB_MAJOR=3
ROCKSDB_MINOR=11
ROCKSDB_PATCH=2
CLANG_SCAN_BUILD=scan-build
CLANG_ANALYZER=/usr/bin/clang++
cc @licenser maybe you can try something similar on SmartOS?
@dch Thank you for sharing the log and your patch is informative. Yesterday, I faced the same situation:
- brew install lz4: erocksdb does not work against lz4 r131
- I added head "https://github.com/Cyan4973/lz4.git" to lz4.rb recipe, then brew install -v --HEAD lz4 to build from git master: erocksdb does not work.
We'll consider how to fix this issue.
I've tried to find a way to detect conditionally if lz4 is available, but as this is OSX we can't guarantee that e.g. pkg-config is installed, & .pc files are available (as they are via homebrew installed lz4). Hopefully somebody else finds a better way!
@dch Now I'm implementing a conditional build process based on your info build_config.mk
which seems pretty reliable and portable.
Many thanks!
@dch Done. https://github.com/leo-project/erocksdb/commit/b7dede0f02a9e1f53658995393517bff5444ad71
Please try it out in your spare time.
@mocchira It was working fine w/the latest version on my environment.
$ ls -l /usr/local/lib/ | grep liblz4
-rwxr-xr-x 1 root admin 84480 Jul 24 13:17 liblz4.1.7.1.dylib
lrwxr-xr-x 1 root INTRA\Domain Users 18 Jul 24 13:17 liblz4.1.dylib -> liblz4.1.7.1.dylib
-rw-r--r-- 1 root admin 93856 Jul 24 13:17 liblz4.a
lrwxr-xr-x 1 root INTRA\Domain Users 18 Jul 24 13:17 liblz4.dylib -> liblz4.1.7.1.dylib
$ make test
./c_src/build_deps.sh
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
make[2]: Nothing to be done for `all-am'.
test -z "/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib" || ./install-sh -c -d "/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib"
/bin/sh ./libtool --mode=install /usr/bin/install -c libsnappy.la '/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib'
libtool: install: /usr/bin/install -c .libs/libsnappy.1.dylib /Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib/libsnappy.1.dylib
libtool: install: (cd /Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib && { ln -s -f libsnappy.1.dylib libsnappy.dylib || { rm -f libsnappy.dylib && ln -s libsnappy.1.dylib libsnappy.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libsnappy.lai /Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib/libsnappy.la
libtool: install: /usr/bin/install -c .libs/libsnappy.a /Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib/libsnappy.a
libtool: install: chmod 644 /Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib/libsnappy.a
libtool: install: ranlib /Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/lib/libsnappy.a
test -z "/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/share/doc/snappy" || ./install-sh -c -d "/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/share/doc/snappy"
/usr/bin/install -c -m 644 ChangeLog COPYING INSTALL NEWS README format_description.txt framing_format.txt '/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/share/doc/snappy'
test -z "/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/include" || ./install-sh -c -d "/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/include"
/usr/bin/install -c -m 644 snappy.h snappy-sinksource.h snappy-stubs-public.h snappy-c.h '/Users/yosuke.hara/dev/leo-project/leofs/deps/erocksdb/c_src/system/include'
PLATFORM_LDFLAGS="`cat c_src/rocksdb/build_config.mk |grep PLATFORM_LDFLAGS| awk -F= '{print $2}'`" ./rebar compile
cat: c_src/rocksdb/build_config.mk: No such file or directory
==> erocksdb (compile)
./rebar eunit
==> erocksdb (eunit)
======================== EUnit ========================
module 'rand_gen_1'
iterators: prev_test (module 'iterators')...[0.077 s] ok
module 'erocksdb_bump'
module 'erocksdb'
erocksdb: open_test...ok
erocksdb: fold_test...ok
erocksdb: fold_keys_test...ok
erocksdb: destroy_test...ok
erocksdb: compression_test...ok
erocksdb: close_test...ok
erocksdb: close_fold_test...ok
[done in 0.021 s]
module 'cleanup'
cleanup: assumption_test...assumption_test: top
assumption_test: bottom
[0.507 s] ok
cleanup: open_close_test...[1.017 s] ok
cleanup: open_exit_test...[1.524 s] ok
cleanup: iterator_test...[1.519 s] ok
cleanup: iterator_db_close_test...[2.040 s] ok
cleanup: iterator_exit_test...[1.529 s] ok
[done in 8.153 s]
cacheleak: cacheleak_test_ (module 'cacheleak')...RSS1: 191864
RSS1: 197820
RSS1: 200372
RSS1: 200844
RSS1: 203408
RSS1: 201580
RSS1: 201464
RSS1: 201464
RSS1: 201464
RSS1: 203644
[12.254 s] ok
module 'basho_bench_driver_rocksdb'
module 'basho_bench_driver_eldb'
=======================================================
All 15 tests passed.
above path is not quite correct:
diff --git a/Makefile b/Makefile
index 9758f6e..b195c11 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-BUILD_CONFIG = build_config.mk
+BUILD_CONFIG = make_config.mk
all: compile
building with this patch & lz4 -> erocksdb works & has lz4 linked in erocksdb.a building with this patch & without lz4 -> erocksdb works & doesn't have linked in erocksdb.a
\o/
I'm guessing this is some sort of missing library reference in the build tools, but I am not clear what to look for or fix specifically, sorry.
full log: