From 3d20cf312258ca0b0e23527c5a62e8241a93a8da Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 30 Apr 2014 08:17:22 +0200 Subject: [PATCH 1/8] gitian: don't export any symbols from executable This avoids conflicts between the libraries statically linked into bitcoin and any libraries we may link dynamically (such as Qt and OpenSSL, see issue #4094). It also avoids start-up overhead to not export any unnecessary symbols. To do this, build a linker script that marks all symbols as local. Conflicts: contrib/gitian-descriptors/gitian-linux.yml --- contrib/gitian-descriptors/gitian-linux.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 0a149e55a..43921c647 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -40,8 +40,18 @@ script: | unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip cd ../build + # Avoid exporting *any* symbols from the executable + # This avoids conflicts between the libraries statically linked into bitcoin and any + # libraries we may link dynamically (such as Qt and OpenSSL, see issue #4094). + # It also avoids start-up overhead to not export any unnecessary symbols. + # To do this, build a linker script that marks all symbols as local. + LINKER_SCRIPT=$HOME/build/linker_version_script + echo ' + { + local: *; + };' > $LINKER_SCRIPT function do_configure { - ./configure "$@" --enable-upnp-default --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=dogecoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --enable-glibc-back-compat + ./configure "$@" --enable-upnp-default --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib -Wl,--version-script=$LINKER_SCRIPT ${OPTFLAGS}" CXXFLAGS="-frandom-seed=dogecoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --enable-glibc-back-compat } # cd dogecoin From 6cbf8affeefe51a1a4db05e44c69f5f0a63566fd Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 25 Apr 2014 20:29:05 +0200 Subject: [PATCH 2/8] gitian: build against Qt 4.6 Should make it possible to run the resulting GUI executable on Linux distributions that use Qt 4.6, such as Debian Wheezy and Tails. Builds a mini-SDK for building against Qt 4.6. This includes the headers as well as host utilities such as `lrelease`, `qrc` and `moc`. This speeds up the gitian build a bit - libqt4-dev pulled in a lot of packages, and is no longer needed as this provides a replacement of our own. Note: This does not replace the Qt build with at static library. After this commit we still build dynamically against the system Qt library. The only difference is that compatibility with an older version is maintained. This loses minor GUI functionality (such as setPlaceholderText) but still allows integration into the window management of the host OS, unlike when statically linking. Conflicts: doc/release-process.md --- contrib/gitian-descriptors/gitian-linux.yml | 10 +- contrib/gitian-descriptors/qt-linux.yml | 263 ++++++++++++++++++++ doc/release-process.md | 5 + 3 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 contrib/gitian-descriptors/qt-linux.yml diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 43921c647..a365a55d4 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -7,7 +7,6 @@ architectures: - "amd64" packages: - "g++" -- "libqt4-dev" - "git-core" - "unzip" - "pkg-config" @@ -16,6 +15,11 @@ packages: - "automake" - "faketime" - "bsdmainutils" +- "libqt4-core" +- "libqt4-gui" +- "libqt4-dbus" +- "libqt4-network" +- "libqt4-test" reference_datetime: "2013-06-01 00:00:00" remotes: - "url": "https://github.com/dogecoin/dogecoin.git" @@ -25,6 +29,8 @@ files: - "dogecoin-deps-linux64-gitian-r5.zip" - "boost-linux32-1.55.0-gitian-r1.zip" - "boost-linux64-1.55.0-gitian-r1.zip" +- "qt-linux32-4.6.4-gitian-r1.tar.gz" +- "qt-linux64-4.6.4-gitian-r1.tar.gz" script: | STAGING="$HOME/install" OPTFLAGS='-O2' @@ -32,12 +38,14 @@ script: | TEMPDIR="$HOME/tempdir" export TZ=UTC export LIBRARY_PATH="$STAGING/lib" + export PATH="$STAGING/bin:$PATH" mkdir -p ${BINDIR} # mkdir -p $STAGING cd $STAGING unzip ../build/dogecoin-deps-linux${GBUILD_BITS}-gitian-r5.zip unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip + tar -zxf ../build/qt-linux${GBUILD_BITS}-4.6.4-gitian-r1.tar.gz cd ../build # Avoid exporting *any* symbols from the executable diff --git a/contrib/gitian-descriptors/qt-linux.yml b/contrib/gitian-descriptors/qt-linux.yml new file mode 100644 index 000000000..1462df328 --- /dev/null +++ b/contrib/gitian-descriptors/qt-linux.yml @@ -0,0 +1,263 @@ +--- +name: "qt-linux" +suites: +- "precise" +architectures: +- "i386" +- "amd64" +packages: +- "zip" +- "unzip" +- "faketime" +- "unzip" +- "libxext-dev" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "qt-everywhere-opensource-src-4.6.4.tar.gz" +script: | + export FAKETIME=$REFERENCE_DATETIME + export TZ=UTC + if [ "$GBUILD_BITS" == "32" ]; then + ARCH='i386-linux-gnu' + else + ARCH='x86_64-linux-gnu' + fi + # The purpose of this gitian build is not to actually build Qt, but to export + # the headers as well as pkgconfig files in a useable format so that we can + # pretend to link against an older version. The goal is to link to the + # system version of Qt 4. + # Also build development tools. + INSTALLPREFIX="$HOME/install" + # Integrity Check + echo "9ad4d46c721b53a429ed5a2eecfd3c239a9ab566562f183f99d3125f1a234250 qt-everywhere-opensource-src-4.6.4.tar.gz" | sha256sum -c + # Make install directories + mkdir -p $INSTALLPREFIX + mkdir -p $INSTALLPREFIX/include + PKGCONFIGDIR=$INSTALLPREFIX/lib/pkgconfig + mkdir -p $PKGCONFIGDIR + # + tar xzf qt-everywhere-opensource-src-4.6.4.tar.gz + cd qt-everywhere-opensource-src-4.6.4 + QTBUILDDIR=$(pwd) + + # Need to build 4.6-versioned host utilities as well (lrelease/qrc/lupdate/...) + ./configure -prefix $INSTALLPREFIX -confirm-license -release -opensource -no-qt3support -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -no-script -no-scripttools -no-javascript-jit -no-webkit -no-svg -no-xmlpatterns -no-sql-sqlite -no-nis -no-cups -no-iconv -no-dbus -no-gif -no-libtiff -no-opengl -nomake examples -nomake demos -nomake docs + # + make $MAKEOPTS -C src/tools install # (rcc, uic, moc) + make $MAKEOPTS -C tools/linguist/lrelease install # (lrelease) + # install includes and pkgconfig files + for DIR in src/corelib src/gui src/testlib src/dbus src/network; do + ( + cd $DIR + # extract module (QtCore/QtNetwork/...) from Makefile + MODULE=$(grep "QMAKE_TARGET *=" Makefile | cut -d = -f 2 | xargs) + # patch makefile so that not everything is build first + sed -i 's/first: all/first:/g' Makefile + make install_flat_headers install_class_headers install_targ_headers + # create and install pkgconfig descriptor + make ../../lib/pkgconfig/$MODULE.pc + sed -e "s,$QTBUILDDIR,$INSTALLPREFIX,g" ../../lib/pkgconfig/$MODULE.pc > $PKGCONFIGDIR/$MODULE.pc + # create links to existing Qt libraries + ln -sf /usr/lib/${ARCH}/lib${MODULE}.so.4 ${INSTALLPREFIX}/lib/lib${MODULE}.so + ) + done + + # Write our own configuration header, same as Ubuntu + # When we don't do this, the configuration will be without STL support (the QString from/to stdString methods) + QCONFIG=$INSTALLPREFIX/include/Qt/qconfig.h + echo ' + /* Qt Edition */ + #ifndef QT_EDITION + # define QT_EDITION QT_EDITION_OPENSOURCE + #endif + ' > $QCONFIG + + if [ "$GBUILD_BITS" == "32" ]; then + echo ' + /* Machine byte-order */ + #define Q_BIG_ENDIAN 4321 + #define Q_LITTLE_ENDIAN 1234 + #define QT_BUILD_KEY "i386 linux g++-4 full-config" + #define QT_BUILD_KEY_COMPAT "i686 Linux g++-4 full-config" + + #ifdef QT_BOOTSTRAPPED + #define Q_BYTE_ORDER Q_LITTLE_ENDIAN + #else + #define Q_BYTE_ORDER Q_LITTLE_ENDIAN + #endif + /* Machine Architecture */ + #ifndef QT_BOOTSTRAPPED + # define QT_ARCH_I386 + #else + # define QT_ARCH_I386 + #endif + /* Compile time features */ + #define QT_LARGEFILE_SUPPORT 64 + #define QT_POINTER_SIZE 4 + ' >> $QCONFIG + else + echo ' + /* Machine byte-order */ + #define Q_BIG_ENDIAN 4321 + #define Q_LITTLE_ENDIAN 1234 + #define QT_BUILD_KEY "x86_64 linux g++-4 full-config" + #define QT_BUILD_KEY_COMPAT "x86_64 Linux g++-4 full-config" + + #ifdef QT_BOOTSTRAPPED + #define Q_BYTE_ORDER Q_LITTLE_ENDIAN + #else + #define Q_BYTE_ORDER Q_LITTLE_ENDIAN + #endif + /* Machine Architecture */ + #ifndef QT_BOOTSTRAPPED + # define QT_ARCH_X86_64 + #else + # define QT_ARCH_X86_64 + #endif + /* Compile time features */ + #define QT_LARGEFILE_SUPPORT 64 + #define QT_POINTER_SIZE 8 + ' >> $QCONFIG + fi + + echo ' + #ifndef QT_BOOTSTRAPPED + + #if defined(QT_NO_EGL) && defined(QT_EGL) + # undef QT_NO_EGL + #elif !defined(QT_NO_EGL) && !defined(QT_EGL) + # define QT_NO_EGL + #endif + + #if defined(QT_NO_GSTREAMER) && defined(QT_GSTREAMER) + # undef QT_NO_GSTREAMER + #elif !defined(QT_NO_GSTREAMER) && !defined(QT_GSTREAMER) + # define QT_NO_GSTREAMER + #endif + + #if defined(QT_NO_ICD) && defined(QT_ICD) + # undef QT_NO_ICD + #elif !defined(QT_NO_ICD) && !defined(QT_ICD) + # define QT_NO_ICD + #endif + + #if defined(QT_NO_IMAGEFORMAT_JPEG) && defined(QT_IMAGEFORMAT_JPEG) + # undef QT_NO_IMAGEFORMAT_JPEG + #elif !defined(QT_NO_IMAGEFORMAT_JPEG) && !defined(QT_IMAGEFORMAT_JPEG) + # define QT_NO_IMAGEFORMAT_JPEG + #endif + + #if defined(QT_NO_IMAGEFORMAT_MNG) && defined(QT_IMAGEFORMAT_MNG) + # undef QT_NO_IMAGEFORMAT_MNG + #elif !defined(QT_NO_IMAGEFORMAT_MNG) && !defined(QT_IMAGEFORMAT_MNG) + # define QT_NO_IMAGEFORMAT_MNG + #endif + + #if defined(QT_NO_IMAGEFORMAT_TIFF) && defined(QT_IMAGEFORMAT_TIFF) + # undef QT_NO_IMAGEFORMAT_TIFF + #elif !defined(QT_NO_IMAGEFORMAT_TIFF) && !defined(QT_IMAGEFORMAT_TIFF) + # define QT_NO_IMAGEFORMAT_TIFF + #endif + + #if defined(QT_NO_MULTIMEDIA) && defined(QT_MULTIMEDIA) + # undef QT_NO_MULTIMEDIA + #elif !defined(QT_NO_MULTIMEDIA) && !defined(QT_MULTIMEDIA) + # define QT_NO_MULTIMEDIA + #endif + + #if defined(QT_NO_OPENVG) && defined(QT_OPENVG) + # undef QT_NO_OPENVG + #elif !defined(QT_NO_OPENVG) && !defined(QT_OPENVG) + # define QT_NO_OPENVG + #endif + + #if defined(QT_NO_PHONON) && defined(QT_PHONON) + # undef QT_NO_PHONON + #elif !defined(QT_NO_PHONON) && !defined(QT_PHONON) + # define QT_NO_PHONON + #endif + + #if defined(QT_NO_PULSEAUDIO) && defined(QT_PULSEAUDIO) + # undef QT_NO_PULSEAUDIO + #elif !defined(QT_NO_PULSEAUDIO) && !defined(QT_PULSEAUDIO) + # define QT_NO_PULSEAUDIO + #endif + + #if defined(QT_NO_S60) && defined(QT_S60) + # undef QT_NO_S60 + #elif !defined(QT_NO_S60) && !defined(QT_S60) + # define QT_NO_S60 + #endif + + #if defined(QT_NO_STYLE_S60) && defined(QT_STYLE_S60) + # undef QT_NO_STYLE_S60 + #elif !defined(QT_NO_STYLE_S60) && !defined(QT_STYLE_S60) + # define QT_NO_STYLE_S60 + #endif + + #if defined(QT_NO_SXE) && defined(QT_SXE) + # undef QT_NO_SXE + #elif !defined(QT_NO_SXE) && !defined(QT_SXE) + # define QT_NO_SXE + #endif + + #if defined(QT_NO_WEBKIT) && defined(QT_WEBKIT) + # undef QT_NO_WEBKIT + #elif !defined(QT_NO_WEBKIT) && !defined(QT_WEBKIT) + # define QT_NO_WEBKIT + #endif + + #if defined(QT_NO_ZLIB) && defined(QT_ZLIB) + # undef QT_NO_ZLIB + #elif !defined(QT_NO_ZLIB) && !defined(QT_ZLIB) + # define QT_NO_ZLIB + #endif + + #if defined(QT_RUNTIME_XCURSOR) && defined(QT_NO_RUNTIME_XCURSOR) + # undef QT_RUNTIME_XCURSOR + #elif !defined(QT_RUNTIME_XCURSOR) && !defined(QT_NO_RUNTIME_XCURSOR) + # define QT_RUNTIME_XCURSOR + #endif + + #if defined(QT_RUNTIME_XFIXES) && defined(QT_NO_RUNTIME_XFIXES) + # undef QT_RUNTIME_XFIXES + #elif !defined(QT_RUNTIME_XFIXES) && !defined(QT_NO_RUNTIME_XFIXES) + # define QT_RUNTIME_XFIXES + #endif + + #if defined(QT_RUNTIME_XINERAMA) && defined(QT_NO_RUNTIME_XINERAMA) + # undef QT_RUNTIME_XINERAMA + #elif !defined(QT_RUNTIME_XINERAMA) && !defined(QT_NO_RUNTIME_XINERAMA) + # define QT_RUNTIME_XINERAMA + #endif + + #if defined(QT_RUNTIME_XINPUT) && defined(QT_NO_RUNTIME_XINPUT) + # undef QT_RUNTIME_XINPUT + #elif !defined(QT_RUNTIME_XINPUT) && !defined(QT_NO_RUNTIME_XINPUT) + # define QT_RUNTIME_XINPUT + #endif + + #if defined(QT_RUNTIME_XRANDR) && defined(QT_NO_RUNTIME_XRANDR) + # undef QT_RUNTIME_XRANDR + #elif !defined(QT_RUNTIME_XRANDR) && !defined(QT_NO_RUNTIME_XRANDR) + # define QT_RUNTIME_XRANDR + #endif + + #if defined(QT_USE_MATH_H_FLOATS) && defined(QT_NO_USE_MATH_H_FLOATS) + # undef QT_USE_MATH_H_FLOATS + #elif !defined(QT_USE_MATH_H_FLOATS) && !defined(QT_NO_USE_MATH_H_FLOATS) + # define QT_USE_MATH_H_FLOATS + #endif + + #endif // QT_BOOTSTRAPPED + + #define QT_VISIBILITY_AVAILABLE + ' >> $QCONFIG + cp $QCONFIG $INSTALLPREFIX/include/QtCore/qconfig.h + + cd $INSTALLPREFIX + # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + # Create a .tar.gz because .zip has problems with symbolic links + find | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/qt-linux${GBUILD_BITS}-4.6.4-gitian-r1.tar.gz diff --git a/doc/release-process.md b/doc/release-process.md index 2d356f856..71ebca252 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -47,12 +47,15 @@ Release Process wget 'https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch' -O \ boost-mingw-gas-cross-compile-2013-03-03.patch wget 'https://download.qt-project.org/official_releases/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.tar.gz' + wget 'https://download.qt-project.org/archive/qt/4.6/qt-everywhere-opensource-src-4.6.4.tar.gz' wget 'https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2' cd .. ./bin/gbuild ../dogecoin/contrib/gitian-descriptors/boost-linux.yml mv build/out/boost-*.zip inputs/ ./bin/gbuild ../dogecoin/contrib/gitian-descriptors/deps-linux.yml mv build/out/dogecoin-deps-*.zip inputs/ + ./bin/gbuild ../dogecoin/contrib/gitian-descriptors/qt-linux.yml + mv build/out/qt-*.tar.gz inputs/ ./bin/gbuild ../dogecoin/contrib/gitian-descriptors/boost-win.yml mv build/out/boost-*.zip inputs/ ./bin/gbuild ../dogecoin/contrib/gitian-descriptors/deps-win.yml @@ -68,6 +71,8 @@ Release Process f88ca2b78e660622d58ea6cfb524427d6eedb82313124d8b80a48a8211a82dbb dogecoin-deps-linux64-gitian-r5.zip f29b7d9577417333fb56e023c2977f5726a7c297f320b175a4108cf7cd4c2d29 boost-linux32-1.55.0-gitian-r1.zip 88232451c4104f7eb16e469ac6474fd1231bd485687253f7b2bdf46c0781d535 boost-linux64-1.55.0-gitian-r1.zip + 74ec2d301cf1a9d03b194153f545102ba45dad02b390485212fe6717de486361 qt-linux32-4.6.4-gitian-r1.tar.gz + 01d0477e299467f09280f15424781154e2b1ea4072c5edb16e044c234954fd9a qt-linux64-4.6.4-gitian-r1.tar.gz 60dc2d3b61e9c7d5dbe2f90d5955772ad748a47918ff2d8b74e8db9b1b91c909 boost-win32-1.55.0-gitian-r6.zip f65fcaf346bc7b73bc8db3a8614f4f6bee2f61fcbe495e9881133a7c2612a167 boost-win64-1.55.0-gitian-r6.zip b16bc26125f824f38e42b5f76c1134ccd10c1497238943d5e445d10f2d88733f dogecoin-deps-win32-gitian-r12.zip From 789d78540c1d66c5deff4de32ed9f921948e64b4 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 1 May 2014 09:44:45 +0200 Subject: [PATCH 3/8] Log BerkeleyDB version at startup Prints the actual version of BerkeleyDB that is linked against, if wallet support is enabled. Useful for troubleshooting. For example: 2014-05-01 07:44:02 Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010) 2014-05-01 07:54:25 Using BerkeleyDB version Berkeley DB 5.1.29: (October 25, 20 11) --- src/init.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 5ec2245ce..24c365799 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -627,6 +627,9 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); LogPrintf("Dogecoin version %s (%s)\n", FormatFullVersion(), CLIENT_DATE); LogPrintf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION)); +#ifdef ENABLE_WALLET + LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0)); +#endif if (!fLogTimestamps) LogPrintf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime())); LogPrintf("Default data directory %s\n", GetDefaultDataDir().string()); From bd1bc7db09c8cf4b4612721f957634678ec9684a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 1 May 2014 09:56:36 +0200 Subject: [PATCH 4/8] Update build instructions for Berkeley DB - People were having problems with the .so when installing in alternative locations. Like gitian, build a static library with -fPIC that can be embedded into the executables. - Add some missing steps - Add reminder that BerkeleyDB is only needed when wallet support is enabled Conflicts: doc/build-unix.md --- doc/build-unix.md | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/doc/build-unix.md b/doc/build-unix.md index 5e3292423..253c09492 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -117,13 +117,33 @@ miniupnpc Berkeley DB ----------- -You need Berkeley DB 5.1. If you have to build Berkeley DB yourself: +It is recommended to use Berkeley DB 5.1. If you have to build it yourself: - cd build_unix/ - ../dist/configure --enable-cxx - make - sudo make install +```bash +BITCOIN_ROOT=$(pwd) +# Pick some path to install BDB to, here we create a directory within the bitcoin directory +BDB_PREFIX="${BITCOIN_ROOT}/db5" +mkdir -p $BDB_PREFIX + +# Fetch the source and verify that it is not tampered with +wget 'http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz' +echo '08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c db-5.1.29.NC.tar.gz' | sha256sum -c +# -> db-5.1.29.NC.tar.gz: OK +tar -xzvf db-5.1.29.NC.tar.gz + +# Build the library and install to our prefix +cd db-5.1.29.NC/build_unix/ +# Note: Do a static build so that it can be embedded into the exectuable, instead of having to find a .so at runtime +../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX +make install + +# Configure Bitcoin Core to use our own-built instance of BDB +cd $BITCOIN_ROOT +./configure (other args...) LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" +``` + +**Note**: You only need Berkeley DB if the wallet is enabled (see the section *Disable-Wallet mode* below). Boost ----- From 4154ed658f8d5b75e18a3b423418150447281fa0 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 30 Apr 2014 09:30:04 +0200 Subject: [PATCH 5/8] qt: add transifex configuration file This is a project-wide configuration file and should be the same for everyone. Also remove mention of creating it yourself from the translation process. --- .tx/config | 7 +++++++ doc/translation_process.md | 24 ++---------------------- 2 files changed, 9 insertions(+), 22 deletions(-) create mode 100644 .tx/config diff --git a/.tx/config b/.tx/config new file mode 100644 index 000000000..655379de7 --- /dev/null +++ b/.tx/config @@ -0,0 +1,7 @@ +[main] +host = https://www.transifex.com + +[bitcoin.tx] +file_filter = src/qt/locale/bitcoin_.ts +source_file = src/qt/locale/bitcoin_en.ts +source_lang = en diff --git a/doc/translation_process.md b/doc/translation_process.md index 2ba5a117d..20fdf6ddc 100644 --- a/doc/translation_process.md +++ b/doc/translation_process.md @@ -71,28 +71,8 @@ We are using https://transifex.com as a frontend for translating the client. https://www.transifex.com/projects/p/bitcoin/resource/tx/ The "Transifex client" (see: http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles) -will help with fetching new translations from Transifex. Use the following -config to be able to connect with the client: - -### .tx/config - - [main] - host = https://www.transifex.com - - [bitcoin.tx] - file_filter = src/qt/locale/bitcoin_.ts - source_file = src/qt/locale/bitcoin_en.ts - source_lang = en - -### .tx/config (for Windows) - - [main] - host = https://www.transifex.com - - [bitcoin.tx] - file_filter = src\qt\locale\bitcoin_.ts - source_file = src\qt\locale\bitcoin_en.ts - source_lang = en +will help with fetching new translations from Transifex. The Transifex configuration (`.tx/config`) +is part of the repository. It is also possible to directly download new translations one by one from the Transifex website. From b88566cc0ca8e6a3c1dac07d46ec6a6702e010f1 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 30 Apr 2014 09:46:04 +0200 Subject: [PATCH 6/8] devtools: add a script to fetch and postprocess translations Run this script from the root of the repository to update all translations from transifex. It will do the following automatically: - create a transifex configuration file - fetch all translations - post-process them into valid and committable format Conflicts: contrib/devtools/README.md --- contrib/devtools/README.md | 35 ++++++++++++- contrib/devtools/update-translations.py | 66 +++++++++++++++++++++++++ doc/translation_process.md | 7 +-- 3 files changed, 104 insertions(+), 4 deletions(-) create mode 100755 contrib/devtools/update-translations.py diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index f0d25fd7a..0a4e2aa39 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -46,4 +46,37 @@ For example a file changed in 2014 (with 2014 being the current year): ```// Copyright (c) 2009-2013 The Bitcoin developers``` would be changed to: -```// Copyright (c) 2009-2014 The Bitcoin developers``` \ No newline at end of file +```// Copyright (c) 2009-2014 The Bitcoin developers``` + +symbol-check.py +================== + +A script to check that the (Linux) executables produced by gitian only contain +allowed gcc, glibc and libstdc++ version symbols. This makes sure they are +still compatible with the minimum supported Linux distribution versions. + +Example usage after a gitian build: + + find ../gitian-builder/build -type f -executable | xargs python contrib/devtools/symbol-check.py + +If only supported symbols are used the return value will be 0 and the output will be empty. + +If there are 'unsupported' symbols, the return value will be 1 a list like this will be printed: + + .../64/test_bitcoin: symbol memcpy from unsupported version GLIBC_2.14 + .../64/test_bitcoin: symbol __fdelt_chk from unsupported version GLIBC_2.15 + .../64/test_bitcoin: symbol std::out_of_range::~out_of_range() from unsupported version GLIBCXX_3.4.15 + .../64/test_bitcoin: symbol _ZNSt8__detail15_List_nod from unsupported version GLIBCXX_3.4.15 + +update-translations.py +======================= + +Run this script from the root of the repository to update all translations from transifex. +It will do the following automatically: + +- fetch all translations +- post-process them into valid and committable format +- add missing translations to the build system (TODO) + +See doc/translation-process.md for more information. + diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py new file mode 100755 index 000000000..1950a4267 --- /dev/null +++ b/contrib/devtools/update-translations.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +# Copyright (c) 2014 Wladimir J. van der Laan +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +''' +Run this script from the root of the repository to update all translations from +transifex. +It will do the following automatically: + +- fetch all translations using the tx tool +- post-process them into valid and committable format + - remove invalid control characters + - remove location tags (makes diffs less noisy) + +TODO: +- auto-add new translations to the build system according to the translation process +- remove 'unfinished' translation items +''' +from __future__ import division, print_function +import subprocess +import re +import sys +import os + +# Name of transifex tool +TX = 'tx' +# Name of source language file +SOURCE_LANG = 'bitcoin_en.ts' +# Directory with locale files +LOCALE_DIR = 'src/qt/locale' + +def check_at_repository_root(): + if not os.path.exists('.git'): + print('No .git directory found') + print('Execute this script at the root of the repository', file=sys.stderr) + exit(1) + +def fetch_all_translations(): + if subprocess.call([TX, 'pull', '-f']): + print('Error while fetching translations', file=sys.stderr) + exit(1) + +def postprocess_translations(): + print('Postprocessing...') + for filename in os.listdir(LOCALE_DIR): + # process only language files, and do not process source language + if not filename.endswith('.ts') or filename == SOURCE_LANG: + continue + filepath = os.path.join(LOCALE_DIR, filename) + with open(filepath, 'rb') as f: + data = f.read() + # remove non-allowed control characters + data = re.sub('[\x00-\x09\x0b\x0c\x0e-\x1f]', '', data) + data = data.split('\n') + # strip locations from non-origin translation + # location tags are used to guide translators, they are not necessary for compilation + # TODO: actually process XML instead of relying on Transifex's one-tag-per-line output format + data = [line for line in data if not 'locale\/\1.qm<\/file>/'` 3. update `src/qt/Makefile.am` manually or via From 48a9c05875735219c8074930e1c9d8b7ef71cdf9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 24 Apr 2014 17:43:22 +0200 Subject: [PATCH 7/8] devtools: add script to check symbols from Linux gitian executables Add a script to check that the (Linux) executables produced by gitian only contain allowed gcc, glibc and libstdc++ version symbols. This makes sure they are still compatible with the minimum supported Linux distribution versions. Conflicts: contrib/devtools/README.md --- contrib/devtools/README.md | 5 +- contrib/devtools/symbol-check.py | 108 +++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100755 contrib/devtools/symbol-check.py diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index 0a4e2aa39..a57b4e561 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -3,7 +3,7 @@ Contents This directory contains tools for developers working on this repository. github-merge.sh ----------------- +================== A small script to automate merging pull-requests securely and sign them with GPG. @@ -36,7 +36,8 @@ Configuring the github-merge tool for the bitcoin repository is done in the foll git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing) git config --global user.signingkey mykeyid (if you want to GPG sign) -## fix-copyright-headers.py +fix-copyright-headers.py +=========================== Every year newly updated files need to have its copyright headers updated to reflect the current year. If you run this script from src/ it will automatically update the year on the copyright header for all diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py new file mode 100755 index 000000000..4f6a18da2 --- /dev/null +++ b/contrib/devtools/symbol-check.py @@ -0,0 +1,108 @@ +#!/usr/bin/python +# Copyright (c) 2014 Wladimir J. van der Laan +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +''' +A script to check that the (Linux) executables produced by gitian only contain +allowed gcc, glibc and libstdc++ version symbols. This makes sure they are +still compatible with the minimum supported Linux distribution versions. + +Example usage: + + find ../gitian-builder/build -type f -executable | xargs python contrib/devtools/symbol-check.py +''' +from __future__ import division, print_function +import subprocess +import re +import sys + +# Debian 6.0.9 (Squeeze) has: +# +# - g++ version 4.4.5 (https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=names&keywords=g%2B%2B) +# - libc version 2.11.3 (https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=names&keywords=libc6) +# - libstdc++ version 4.4.5 (https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=names&keywords=libstdc%2B%2B6) +# +# Ubuntu 10.04.4 (Lucid Lynx) has: +# +# - g++ version 4.4.3 (http://packages.ubuntu.com/search?keywords=g%2B%2B&searchon=names&suite=lucid§ion=all) +# - libc version 2.11.1 (http://packages.ubuntu.com/search?keywords=libc6&searchon=names&suite=lucid§ion=all) +# - libstdc++ version 4.4.3 (http://packages.ubuntu.com/search?suite=lucid§ion=all&arch=any&keywords=libstdc%2B%2B&searchon=names) +# +# Taking the minimum of these as our target. +# +# According to GNU ABI document (http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) this corresponds to: +# GCC 4.4.0: GCC_4.4.0 +# GCC 4.4.2: GLIBCXX_3.4.13, CXXABI_1.3.3 +# (glibc) GLIBC_2_11 +# +MAX_VERSIONS = { +'GCC': (4,4,0), +'CXXABI': (1,3,3), +'GLIBCXX': (3,4,13), +'GLIBC': (2,11) +} +READELF_CMD = '/usr/bin/readelf' +CPPFILT_CMD = '/usr/bin/c++filt' + +class CPPFilt(object): + ''' + Demangle C++ symbol names. + + Use a pipe to the 'c++filt' command. + ''' + def __init__(self): + self.proc = subprocess.Popen(CPPFILT_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + + def __call__(self, mangled): + self.proc.stdin.write(mangled + '\n') + return self.proc.stdout.readline().rstrip() + + def close(self): + self.proc.stdin.close() + self.proc.stdout.close() + self.proc.wait() + +def read_symbols(executable, imports=True): + ''' + Parse an ELF executable and return a list of (symbol,version) tuples + for dynamic, imported symbols. + ''' + p = subprocess.Popen([READELF_CMD, '--dyn-syms', '-W', executable], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) + (stdout, stderr) = p.communicate() + if p.returncode: + raise IOError('Could not read symbols for %s: %s' % (executable, stderr.strip())) + syms = [] + for line in stdout.split('\n'): + line = line.split() + if len(line)>7 and re.match('[0-9]+:$', line[0]): + (sym, _, version) = line[7].partition('@') + is_import = line[6] == 'UND' + if version.startswith('@'): + version = version[1:] + if is_import == imports: + syms.append((sym, version)) + return syms + +def check_version(max_versions, version): + if '_' in version: + (lib, _, ver) = version.rpartition('_') + else: + lib = version + ver = '0' + ver = tuple([int(x) for x in ver.split('.')]) + if not lib in max_versions: + return False + return ver <= max_versions[lib] + +if __name__ == '__main__': + cppfilt = CPPFilt() + retval = 0 + for filename in sys.argv[1:]: + for sym,version in read_symbols(filename, True): + if version and not check_version(MAX_VERSIONS, version): + print('%s: symbol %s from unsupported version %s' % (filename, cppfilt(sym), version)) + retval = 1 + + exit(retval) + + From 746b3ec76ee29618e21e48261924c0eba8df5751 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 30 Apr 2014 15:26:36 +0200 Subject: [PATCH 8/8] devtools: have symbol check script check for exported symbols After last commit, our executables should export no symbols anymore. To make sure that this stays the case, verify this in the symbol checker script. --- contrib/devtools/symbol-check.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index 4f6a18da2..8dd6d8f03 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -98,10 +98,15 @@ if __name__ == '__main__': cppfilt = CPPFilt() retval = 0 for filename in sys.argv[1:]: + # Check imported symbols for sym,version in read_symbols(filename, True): if version and not check_version(MAX_VERSIONS, version): print('%s: symbol %s from unsupported version %s' % (filename, cppfilt(sym), version)) retval = 1 + # Check exported symbols + for sym,version in read_symbols(filename, False): + print('%s: export of symbol %s not allowed' % (filename, cppfilt(sym))) + retval = 1 exit(retval)