My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2: Fix build for OS X.
10 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jun 2011


Sign in to add a comment
 
Reported by paul.jos...@gmail.com, May 8, 2011
LevelDB fails to build on OS X with standard GCC from XCode and so on and such forth.

This patch mixes up the Posix and Chromium port implementations as well as pulls in a couple Chromium headers so that building on OS X is possible without requiring that users build GCC 4.5.

Patch commit is at [1] and attached as a diff.

[1] https://github.com/davisp/leveldb/commit/50e280c9b1cfde0e255d124f38e1aa436d36ba52

leveldb_osx.patch
21.2 KB   View   Download
May 22, 2011
Project Member #1 tfar...@chromium.org
(No comment was entered for this change.)
Labels: OpSys-OSX
May 23, 2011
#3 paul.jos...@gmail.com
That's the same patch. I attached it as a diff to prevent link rot.
May 23, 2011
#4 paul.jos...@gmail.com
Also, link rot rears its ugly head.

A more permanent link:

https://github.com/davisp/leveldb/compare/master...osx
May 25, 2011
#5 s...@little--eyes.com
Thanks for sharing this. It seems like I successfully applied the patch using from the leveldb root:
    patch -p1 -i leveldb_osx.patch

But I'm getting this error when I call 'make'.

    g++ -c -DLEVELDB_PLATFORM_POSIX -I. -I./include -std=c++0x -g2 db/db_bench.cc -o db/db_bench.o
    cc1plus: error: unrecognized command line option "-std=c++0x"
    make: *** [db/db_bench.o] Error 1

This is with gcc version 4.2.1 (Apple Inc. build 5664)

May 25, 2011
#6 paul.jos...@gmail.com
There are a couple lines in the Makefile that you need to change for OS X. The CFLAGS variable needs to change as well as a change to the list of sources. There's comments in the Makefile that are specific to what needs to happen.
May 25, 2011
#7 ste...@gmail.com
Thank you, that worked (I also had to apply your log_test patch [1]).

What is the step following 'make' to actually build the library?

[1] https://code.google.com/p/leveldb/issues/detail?id=6
May 25, 2011
Project Member #8 tfar...@chromium.org
There is no library code yet on the Makefile. :(

Patches welcome.
May 25, 2011
#9 ste...@gmail.com
Adding this to the Makefile:

    library: $(LIBOBJECTS) 
	    ar rcs lib-leveldb.a $(LIBOBJECTS)

and calling 'make library' seemed to do the trick.

As a side note, adding -fvisibility=hidden to the CFLAGS seemed to get rid of 33 visibility warnings I was getting.
Jun 6, 2011
#10 ashoema...@gmail.com
It seems this is fixed as of r29 - make runs without warnings or errors on XCode 3 and 4.
Jun 16, 2011
Project Member #11 dgrogan@chromium.org
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting