Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix LevelDB removing /dev/null at build time #2406

Closed
wants to merge 1 commit into from

5 participants

@SanderKleykens

Building bitcoin as root can cause /dev/null to be removed on some systems (e.g. FreeBSD 8.3-RELEASE-p3 and gcc version 4.2.2). This pull request fixes the issue.

A patch has also been sent upstream, see http://code.google.com/p/leveldb/issues/detail?id=153.

@BitcoinPullTester

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/966781671d44a4bcaa4a03c8c59dc280acf2c595 for binaries and test log.

@sipa
Owner

Sounds like the compiler is quite broken in this case...

I prefer not messing with the leveldb config script too much. If it's accepted upstream, no problem of course.

@SanderKleykens

Yes, ultimately it's a gcc issue. One that appears to have been resolved in newer versions.

It's also pretty easy to work around the issue by simply building the project as a user that can't remove /dev/null. I only came across the problem because FreeBSD requires, by default, root privileges when building a port in the ports directory. I'll just notify the port maintainer.

@robbak
@jgarzik
Owner

Closing. (1) Don't build with root, that's insanely dangerous. (2) Sounds like this issue is already fixed upstream, and will be pulled in via leveldb update. (3) An issue external to us.

@jgarzik jgarzik closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/leveldb/build_detect_platform
View
14 src/leveldb/build_detect_platform
@@ -25,6 +25,8 @@
# -DSNAPPY if the Snappy library is present
#
+TMPDIR="/tmp"
+
OUTPUT=$1
PREFIX=$2
if test -z "$OUTPUT" || test -z "$PREFIX"; then
@@ -164,7 +166,9 @@ if [ "$CROSS_COMPILE" = "true" ]; then
true
else
# If -std=c++0x works, use <cstdatomic>. Otherwise use port_posix.h.
- $CXX $CXXFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
+ CPP0X_TEST_TEMPFILE="${TMPDIR}/leveldb-build_detect_platform_cpp0x.$$"
+
+ $CXX $CXXFLAGS -std=c++0x -x c++ - -o ${CPP0X_TEST_TEMPFILE} 2>/dev/null <<EOF
#include <cstdatomic>
int main() {}
EOF
@@ -175,13 +179,19 @@ EOF
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX"
fi
+ rm -f ${CPP0X_TEST_TEMPFILE} > /dev/null 2>&1
+
# Test whether tcmalloc is available
- $CXX $CXXFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF
+ TCMALLOC_TEST_TEMPFILE="${TMPDIR}/leveldb-build_detect_platform_tcmalloc.$$"
+
+ $CXX $CXXFLAGS -x c++ - -o ${TCMALLOC_TEST_TEMPFILE} -ltcmalloc 2>/dev/null <<EOF
int main() {}
EOF
if [ "$?" = 0 ]; then
PLATFORM_LIBS="$PLATFORM_LIBS -ltcmalloc"
fi
+
+ rm -f ${TCMALLOC_TEST_TEMPFILE} > /dev/null 2>&1
fi
PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS"
Something went wrong with that request. Please try again.