Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Edit New issue Fix build for libsnappy and libbz2 #11

Open
mdcallag opened this issue Oct 15, 2014 · 4 comments
Open

Edit New issue Fix build for libsnappy and libbz2 #11

mdcallag opened this issue Oct 15, 2014 · 4 comments
Assignees

Comments

@mdcallag
Copy link

I get this link error:
...a39a3e/bin/ld: cannot find -lsnappy

From the command line I see that librocksdb.a has a full path, but not so for snappy and bz2:
... /home/mcallaghan/rocksdb/librocksdb.a -lsnappy -lbz2

And there is magic in storage/rocksdb/CMakeLists.txt to do that for librocksdb.a, but not the others
FIND_LIBRARY(Rocksdb_LIBS NAMES rocksdb
PATHS ${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})
IF(EXISTS ${Rocksdb_LIBS})
GET_FILENAME_COMPONENT(LINK_DIR ${Rocksdb_LIBS} ABSOLUTE)
ELSE()
MESSAGE(SEND_ERROR "No rocksdb library directory found! Consider using environment variable ROCKSDB_LIBRARIES=...")
RETURN()
ENDIF()

...

MYSQL_ADD_PLUGIN(rocksdb_se ${ROCKSDB_SOURCES} STORAGE_ENGINE STATIC_ONLY MANDATORY LINK_LIBRARIES ${LINK_DIR} snappy bz2)

I think the workaround is to remove "snappy bz2" from the line above and build RocksDB without support for bz2 and snappy.

@spetrunia spetrunia self-assigned this Dec 4, 2014
@spetrunia
Copy link
Member

Trying to understand where snappy and bz2 are, so that rocksdb build sees them while CMake in MySQL doesn't.

Makefile in rocksdb has a libsnappy.a target but it's only used for building rocksdbjavastatic target.

There is also build_tools/fbcode_config.sh which has:

SNAPPY_INCLUDE=" -I /mnt/gvfs/third-party2/snappy/aef17f6c0b44b4fe408bd06f67c93701ab0a6ceb/1.0.3/gcc-4.8.1-glibc-2.17/43d84e2/include"
SNAPPY_LIBS=" /mnt/gvfs/third-party2/snappy/aef17f6c0b44b4fe408bd06f67c93701ab0a6ceb/1.0.3/gcc-4.8.1-glibc-2.17/43d84e2/lib/libsnappy.a"
...
DEPS_INCLUDE="$SNAPPY_INCLUDE $ZLIB_INCLUDE $BZIP_INCLUDE $LZ4_INCLUDE $GFLAGS_INCLUDE $NUMA_INCLUDE"

CFLAGS+=" -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DLZ4 -DNUMA"
EXEC_LDFLAGS=" $SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $GFLAGS_LIBS $NUMA_LIB"
EXEC_LDFLAGS_SHARED="$SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $GFLAGS_LIBS"

and then EXEC_LDFLAGS is used in the Makefile like so:

db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
        $(CXX) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) $(EXEC_LDFLAGS) -o $@  $(LDFLAGS) $(COVERAGEFLAGS)

@spetrunia
Copy link
Member

And there is magic in storage/rocksdb/CMakeLists.txt to do that for librocksdb.a, but not the others
FIND_LIBRARY(Rocksdb_LIBS NAMES rocksdb
PATHS ${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})

So, in conventional terms, it is

 Rocksdb_LIBS =  find_library(${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})

and

LINK_DIR= GET_FILENAME_COMPONENT( ${Rocksdb_LIBS} ABSOLUTE))

I have it to work by setting environment variable ROCKSDB_LIBRARIES before invoking cmake.

@mdcallag , would it be ok if I make this to work by having CMakeLists.txt require that the user sets
SNAPPY_INCLUDE and SNAPPY_LIBS before they invoke cmake ?

@mdcallag
Copy link
Author

mdcallag commented Dec 5, 2014

yes

On Fri, Dec 5, 2014 at 5:20 AM, Sergei Petrunia [email protected]
wrote:

And there is magic in storage/rocksdb/CMakeLists.txt to do that for
librocksdb.a, but not the others
FIND_LIBRARY(Rocksdb_LIBS NAMES rocksdb
PATHS ${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})

So, in conventional terms, it is

Rocksdb_LIBS = find_library(${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})

and

LINK_DIR= GET_FILENAME_COMPONENT( ${Rocksdb_LIBS} ABSOLUTE))

I have it to work by setting environment variable ROCKSDB_LIBRARIES before
invoking cmake.

@mdcallag https://github.com/mdcallag , would it be ok if I make this
to work by having CMakeLists.txt require that the user sets
SNAPPY_INCLUDE and SNAPPY_LIBS before they invoke cmake ?


Reply to this email directly or view it on GitHub
#11 (comment)
.

Mark Callaghan
[email protected]

@mdcallag
Copy link
Author

mdcallag commented Dec 5, 2014

But are you only solving this for snappy? Or will this allow multiple
compression libraries to be found?

On Fri, Dec 5, 2014 at 8:31 AM, MARK CALLAGHAN [email protected] wrote:

yes

On Fri, Dec 5, 2014 at 5:20 AM, Sergei Petrunia [email protected]
wrote:

And there is magic in storage/rocksdb/CMakeLists.txt to do that for
librocksdb.a, but not the others
FIND_LIBRARY(Rocksdb_LIBS NAMES rocksdb
PATHS ${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})

So, in conventional terms, it is

Rocksdb_LIBS = find_library(${Rocksdb_LIB_PATHS} ${Rocksdb_LIB} $ENV{ROCKSDB_LIBRARIES})

and

LINK_DIR= GET_FILENAME_COMPONENT( ${Rocksdb_LIBS} ABSOLUTE))

I have it to work by setting environment variable ROCKSDB_LIBRARIES
before invoking cmake.

@mdcallag https://github.com/mdcallag , would it be ok if I make this
to work by having CMakeLists.txt require that the user sets
SNAPPY_INCLUDE and SNAPPY_LIBS before they invoke cmake ?


Reply to this email directly or view it on GitHub
#11 (comment)
.

Mark Callaghan
[email protected]

Mark Callaghan
[email protected]

yoshinorim pushed a commit to yoshinorim/webscalesql-5.6 that referenced this issue Jan 2, 2015
- Basic support for Column Families (writes/reads go the right column
  family).
- CFs are specified per-index in the index comment:
  INDEX (col1,col2) COMMENT 'cf_name'
yoshinorim pushed a commit to yoshinorim/webscalesql-5.6 that referenced this issue Jan 2, 2015
yoshinorim pushed a commit to yoshinorim/webscalesql-5.6 that referenced this issue Jan 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants