My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
  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, 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.


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

A more permanent link:
May 25, 2011
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/ -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
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
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?

May 25, 2011
Project Member #8
There is no library code yet on the Makefile. :(

Patches welcome.
May 25, 2011
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
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
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting