heapwolf / ldb

A C++ REPL / CLI for LevelDB
MIT License
201 stars 23 forks source link

OSX Needs `-stdlib=libc++` #7

Closed jwerle closed 10 years ago

jwerle commented 10 years ago

Working on a patch for the Makefile now

heapwolf commented 10 years ago

Oh, that's strange, im on OSx and added -std=gnu++11 on purpose. Is that not standard on OSx?

jwerle commented 10 years ago

Here is my output for just trying to invoke make:

jwerle:~/repos/ldb ☂ (modifications) master
 × make
cd "./deps/leveldb" && make
make[1]: Nothing to be done for `default'.
g++ -o ldb ldb.cc "./deps/leveldb"/libleveldb.a -lpthread -I "./deps/leveldb"/include -std=gnu++11
ldb.cc:7:10: fatal error: 'regex' file not found
#include <regex>
         ^
1 error generated.
make: *** [ldb] Error 1

I cam across this post: http://stackoverflow.com/questions/18669712/c-cant-find-regex-even-with-std-c11-macosx

jwerle commented 10 years ago

Adding that flag actually didn't help....

jwerle:~/repos/ldb ☂ (modifications) master
 × make
cd "./deps/leveldb" && make
make[1]: Nothing to be done for `default'.
g++ -o ldb ldb.cc "./deps/leveldb"/libleveldb.a -lpthread -I "./deps/leveldb"/include -std=gnu++11 -stdlib=libc++
Undefined symbols for architecture x86_64:
  "leveldb::DB::Open(leveldb::Options const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, leveldb::DB**)", referenced from:
      _main in ldb-RQkIBJ.o
  "std::string::_M_leak_hard()", referenced from:
      leveldb::(anonymous namespace)::BytewiseComparatorImpl::FindShortestSeparator(std::string*, leveldb::Slice const&) const in libleveldb.a(comparator.o)
      leveldb::(anonymous namespace)::BytewiseComparatorImpl::FindShortSuccessor(std::string*) const in libleveldb.a(comparator.o)
  "std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
      leveldb::Status::ToString() const in libleveldb.a(status.o)
      leveldb::(anonymous namespace)::PosixEnv::GetChildren(std::string const&, std::vector<std::string, std::allocator<std::string> >*) in libleveldb.a(env_posix.o)
      leveldb::(anonymous namespace)::PosixEnv::LockFile(std::string const&, leveldb::FileLock**) in libleveldb.a(env_posix.o)
      leveldb::(anonymous namespace)::PosixEnv::UnlockFile(leveldb::FileLock*) in libleveldb.a(env_posix.o)
      leveldb::(anonymous namespace)::PosixFileLock::~PosixFileLock() in libleveldb.a(env_posix.o)
      leveldb::(anonymous namespace)::PosixFileLock::~PosixFileLock() in libleveldb.a(env_posix.o)
      leveldb::(anonymous namespace)::PosixWritableFile::~PosixWritableFile() in libleveldb.a(env_posix.o)
      ...
heapwolf commented 10 years ago

g++ --version ?

jwerle commented 10 years ago

Okay so I found out that CXXFLAGS+='-std=c++11 -stdlib=libc++' needs to be passed to leveldb. I'm issuing a patch in a moment !