liuis / leveldb

Automatically exported from code.google.com/p/leveldb
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fix build on OS X and Linux #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The Makefile refers to PLATFORM_CCFLAGS instead of PLATFORM_CFLAGS. As a 
result, -DOS_{MACOSX,LINUX} are not defined and the build fails. The output of 
make on OS X (XCode 4):

g++ -c -I. -I./include -fno-builtin-memcmp -DLEVELDB_PLATFORM_POSIX  -O2 
-DNDEBUG        -DSNAPPY db/version_set.cc -o db/version_set.o
In file included from ./port/port.h:14,
                 from ./util/coding.h:17,
                 from ./db/dbformat.h:13,
                 from ./db/version_set.h:21,
                 from db/version_set.cc:5:
./port/port_posix.h:20:22: error: endian.h: No such file or directory
make: *** [db/version_set.o] Error 1

On Linux (at least Ubuntu 11.04), the concatenation operator on shell variables 
is only supported in Bash ≥3.1 (http://tldp.org/LDP/abs/html/bashver3.html). 
This causes the following error in addition to the above:

./build_detect_platform: 55: PORT_CFLAGS+= -DLEVELDB_PLATFORM_POSIX: not found

The attached patch corrects the CFLAGS definition to use PLATFORM_CFLAGS, and 
avoids the use of the += operator (an alternative would be to run the script 
with bash instead of sh).

The patch contains two minor changes for the OS X build:
* Removes port/port_osx.{h,cc}, which have been fully merged into 
port/port_posix.{h,cc}.
* Removes -pthread and -lpthread, which are implicit in all OS X builds.

Original issue reported on code.google.com by ashoema...@gmail.com on 29 Jun 2011 at 10:48

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch!

Original comment by ga...@google.com on 29 Jun 2011 at 10:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fixed in Revision 35

Original comment by ga...@google.com on 29 Jun 2011 at 10:59