Skip to content

Fix build on OS X and Linux #21

@cmumford

Description

@cmumford

Original issue 15 created by ashoemaker on 2011-06-29T10:48:39.000Z:

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions