Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build for OS X. #2

Closed
GoogleCodeExporter opened this issue Mar 26, 2015 · 11 comments
Closed

Fix build for OS X. #2

GoogleCodeExporter opened this issue Mar 26, 2015 · 11 comments

Comments

@GoogleCodeExporter
Copy link

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/50e280c9b1cfde0e255d124f38e1aa436d36ba5
2

Original issue reported on code.google.com by paul.jos...@gmail.com on 8 May 2011 at 10:17

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by tfar...@chromium.org on 22 May 2011 at 6:07

  • Added labels: OpSys-OSX
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Would this patch not be better? 
https://github.com/davisp/leveldb/commit/50e280c9b1cfde0e255d124f38e1aa436d36ba5
2

Original comment by tim%crea...@gtempaccount.com on 23 May 2011 at 9:23

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

That's the same patch. I attached it as a diff to prevent link rot.

Original comment by paul.jos...@gmail.com on 23 May 2011 at 9:39

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Also, link rot rears its ugly head.

A more permanent link:

https://github.com/davisp/leveldb/compare/master...osx

Original comment by paul.jos...@gmail.com on 23 May 2011 at 11:06

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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)

Original comment by s...@little--eyes.com on 25 May 2011 at 8:01

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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.

Original comment by paul.jos...@gmail.com on 25 May 2011 at 8:25

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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] http://code.google.com/p/leveldb/issues/detail?id=6

Original comment by ste...@gmail.com on 25 May 2011 at 8:47

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

There is no library code yet on the Makefile. :(

Patches welcome.

Original comment by tfar...@chromium.org on 25 May 2011 at 8:53

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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.

Original comment by ste...@gmail.com on 25 May 2011 at 11:54

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

It seems this is fixed as of r29 - make runs without warnings or errors on 
XCode 3 and 4.

Original comment by ashoema...@gmail.com on 6 Jun 2011 at 8:55

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Original comment by dgrogan@chromium.org on 16 Jun 2011 at 9:44

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant