From e4b991e56d2e1984fb66792254e8fbaa384ff789 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 16 Jan 2014 11:55:54 +0100 Subject: [PATCH 1/6] build: Auto-detect whether -DBOOST_TEST_DYN_LINK is needed Use AC_LINK_IFELSE to auto-detect whether boost test is linked dynamically, instead of assuming based on target. --- configure.ac | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ba45d84bb..2261addae 100644 --- a/configure.ac +++ b/configure.ac @@ -207,10 +207,8 @@ case $host in fi CPPFLAGS="$CPPFLAGS -DMAC_OSX" - TESTDEFS="-DBOOST_TEST_DYN_LINK" ;; *) - TESTDEFS="-DBOOST_TEST_DYN_LINK" ;; esac @@ -345,6 +343,24 @@ if test x$use_tests = xyes; then AX_BOOST_UNIT_TEST_FRAMEWORK + + dnl Determine if -DBOOST_TEST_DYN_LINK is needed + AC_MSG_CHECKING([for dynamic linked boost test]) + TEMP_LIBS="$LIBS" + LIBS="$LIBS $BOOST_UNIT_TEST_FRAMEWORK_LIB" + TEMP_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + AC_LINK_IFELSE([AC_LANG_SOURCE([ + #define BOOST_TEST_DYN_LINK + #define BOOST_TEST_MAIN + #include + + ])], + [AC_MSG_RESULT(yes)] + [TESTDEFS="$TESTDEFS -DBOOST_TEST_DYN_LINK"], + [AC_MSG_RESULT(no)]) + LIBS="$TEMP_LIBS" + CPPFLAGS="$TEMP_CPPFLAGS" fi BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB" From 0d40f5a6be7bfb7e874994bf5f68dc72f86eaa6d Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 15 Jan 2014 23:28:41 +0100 Subject: [PATCH 2/6] build: Allow providing extra libs for Boost Chrono Pass BOOST_CHRONO_EXTRALIBS to give extra dependency libraries for Boost Chrono which are not auto-detected. --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 2261addae..fa0a6dd1f 100644 --- a/configure.ac +++ b/configure.ac @@ -373,6 +373,9 @@ dnl after 1.56. dnl If neither is available, abort. dnl If sleep_for is used, boost_chrono becomes a requirement. if test x$ax_cv_boost_chrono = xyes; then +dnl Allow passing extra needed dependency libraries for boost-chrono from static gitian build +BOOST_CHRONO_LIB="$BOOST_CHRONO_LIB $BOOST_CHRONO_EXTRALIBS" + TEMP_LIBS="$LIBS" LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB" AC_TRY_LINK([ From 714cdecb0398a075e80e2263a09b9fb3a4fe70ea Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 15 Jan 2014 23:29:54 +0100 Subject: [PATCH 3/6] build: Pass BOOST_CPPFLAGS to sleep implementation test Makes sure that `-pthread` and other flags required for boost compilation are passed. --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index fa0a6dd1f..9e5b83f2d 100644 --- a/configure.ac +++ b/configure.ac @@ -378,6 +378,8 @@ BOOST_CHRONO_LIB="$BOOST_CHRONO_LIB $BOOST_CHRONO_EXTRALIBS" TEMP_LIBS="$LIBS" LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB" +TEMP_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" AC_TRY_LINK([ #include #include @@ -392,11 +394,14 @@ AC_TRY_LINK([ AC_DEFINE(HAVE_WORKING_BOOST_SLEEP_FOR, 1, [Define this symbol if boost sleep_for works])], [boost_sleep=no]) LIBS="$TEMP_LIBS" +CPPFLAGS="$TEMP_CPPFLAGS" fi if test x$boost_sleep != xyes; then TEMP_LIBS="$LIBS" LIBS="$LIBS $BOOST_LIBS" +TEMP_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" AC_TRY_LINK([ #include #include @@ -411,6 +416,7 @@ AC_TRY_LINK([ [boost_sleep=yes; AC_DEFINE(HAVE_WORKING_BOOST_SLEEP, 1, [Define this symbol if boost sleep works])], [boost_sleep=no]) LIBS="$TEMP_LIBS" +CPPFLAGS="$TEMP_CPPFLAGS" fi if test x$boost_sleep != xyes; then From 7eb99a844f6048bc1e1f7c67c7189de819453e44 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 15 Jan 2014 19:58:45 +0100 Subject: [PATCH 4/6] gitian: Reduce build time for boost windows dependency Build only the mt-s (multithreaded, static runtime link) variant of the library. This cuts the build time in half. Also prevent unpacked boost from ending up in output directory, checking and hashing all the source files as output files this takes a lot of time and is pointless. --- contrib/gitian-descriptors/boost-win32.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/gitian-descriptors/boost-win32.yml b/contrib/gitian-descriptors/boost-win32.yml index b14cd1f6c..55e74ce3e 100644 --- a/contrib/gitian-descriptors/boost-win32.yml +++ b/contrib/gitian-descriptors/boost-win32.yml @@ -16,7 +16,7 @@ files: - "boost-mingw-gas-cross-compile-2013-03-03.patch" script: | # Defines - INSTALLPREFIX="$OUTDIR/staging/boost" + INSTALLPREFIX="$HOME/install" HOST=i686-w64-mingw32 # Input Integrity Check echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c @@ -57,10 +57,9 @@ script: | # Note: Might need these options in the future for 64bit builds. # "Please note that address-model=64 must be given to bjam command line on 64bit Windows for 64bit build; otherwise 32bit code will be generated." # "For cross-compiling the lib you must specify certain additional properties at bjam command line: target-os, abi, binary-format, architecture and address-model." - ./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install + ./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 threading=multi variant=release link=static runtime-link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install cd "$INSTALLPREFIX" export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME - zip -r boost-win32-1.55.0-gitian-r6.zip * - cp boost-win32-1.55.0-gitian-r6.zip $OUTDIR + zip -r $OUTDIR/boost-win32-1.55.0-gitian-r6.zip * From 64be7f7892d00734ae33e8a16ed5f80d23a981dd Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 15 Jan 2014 20:01:27 +0100 Subject: [PATCH 5/6] gitian: Build boost dependency for linux Instead of using the boost provided by Ubuntu 12.04, build our own dependency like we do for Windows. This allows using a much newer version (1.55 versus 1.46) as well as building with `-fPIC` so that `-pie` can be used in the x86-64 build. --- contrib/gitian-descriptors/boost-linux.yml | 42 +++++++++++++++++++++ contrib/gitian-descriptors/gitian-linux.yml | 13 +++---- doc/release-process.md | 2 + 3 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 contrib/gitian-descriptors/boost-linux.yml diff --git a/contrib/gitian-descriptors/boost-linux.yml b/contrib/gitian-descriptors/boost-linux.yml new file mode 100644 index 000000000..5d22294dd --- /dev/null +++ b/contrib/gitian-descriptors/boost-linux.yml @@ -0,0 +1,42 @@ +--- +name: "boost" +suites: +- "precise" +architectures: +- "i386" +- "amd64" +packages: +- "unzip" +- "pkg-config" +- "libtool" +- "faketime" +- "bsdmainutils" +- "zip" +reference_datetime: "2011-01-30 00:00:00" +remotes: [] +files: +- "boost_1_55_0.tar.bz2" +script: | + STAGING="$HOME/install" + export LIBRARY_PATH="$STAGING/lib" + # Input Integrity Check + echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c + + mkdir -p "$STAGING" + tar xjf boost_1_55_0.tar.bz2 + cd boost_1_55_0 + GCCVERSION=$(g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2) + # note: bjam with -d+2 reveals that -O3 is implied by default, no need to provide it in cxxflags + echo "using gcc : $GCCVERSION : g++ + : + \"-frandom-seed=boost1 -fPIC\" + ;" > user-config.jam + + ./bootstrap.sh --without-icu + + ./bjam toolset=gcc threadapi=pthread threading=multi variant=release link=static runtime-link=shared --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 --layout=tagged --build-type=complete --prefix="$STAGING" $MAKEOPTS install + + cd "$STAGING" + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + zip -r $OUTDIR/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip * diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index b0fe86e25..d0bdf144a 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -6,13 +6,7 @@ architectures: - "i386" - "amd64" packages: -- "qt4-qmake" - "libqt4-dev" -- "libboost-system-dev" -- "libboost-filesystem-dev" -- "libboost-program-options-dev" -- "libboost-thread-dev" -- "libboost-test-dev" - "libssl-dev" - "git-core" - "unzip" @@ -29,6 +23,8 @@ remotes: files: - "bitcoin-deps-linux32-gitian-r1.zip" - "bitcoin-deps-linux64-gitian-r1.zip" +- "boost-linux32-1.55.0-gitian-r1.zip" +- "boost-linux64-1.55.0-gitian-r1.zip" script: | STAGING="$HOME/install" OPTFLAGS='-O2' @@ -39,17 +35,18 @@ script: | mkdir -p $STAGING cd $STAGING unzip ../build/bitcoin-deps-linux${GBUILD_BITS}-gitian-r1.zip + unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip cd ../build # cd bitcoin export TAR_OPTIONS=--mtime=`echo $REFERENCE_DATETIME | awk '{ print $1 }'` ./autogen.sh - ./configure --prefix=$STAGING --bindir=$BINDIR --with-protoc-bindir=$STAGING/host/bin --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=bitcoin ${OPTFLAGS}" + ./configure --prefix=$STAGING --bindir=$BINDIR --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=bitcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" make dist mkdir -p distsrc cd distsrc tar --strip-components=1 -xf ../bitcoin-*.tar.* - ./configure --prefix=$STAGING --bindir=$BINDIR --with-protoc-bindir=$STAGING/host/bin --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=bitcoin ${OPTFLAGS}" + ./configure --prefix=$STAGING --bindir=$BINDIR --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=bitcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" make $MAKEOPTS make $MAKEOPTS install-strip mkdir -p $OUTDIR/src diff --git a/doc/release-process.md b/doc/release-process.md index 428193681..7fccf2172 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -53,6 +53,8 @@ Release Process cd .. ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/deps-linux.yml mv build/out/bitcoin-deps-*.zip inputs/ + ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/boost-linux.yml + mv build/out/boost-linux-*.zip inputs/ ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/boost-win32.yml mv build/out/boost-win32-*.zip inputs/ ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/deps-win32.yml From 1cbbeb6a270d974b89c68d01e6a8544136a3c562 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 15 Jan 2014 20:39:49 +0100 Subject: [PATCH 6/6] gitian: Add openssl to linux deps Build OpenSSL instead of using distribution-provided library. --- contrib/gitian-descriptors/deps-linux.yml | 13 ++++++++++++- contrib/gitian-descriptors/gitian-linux.yml | 7 +++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/contrib/gitian-descriptors/deps-linux.yml b/contrib/gitian-descriptors/deps-linux.yml index 4ebf5c53a..41d8d65fb 100644 --- a/contrib/gitian-descriptors/deps-linux.yml +++ b/contrib/gitian-descriptors/deps-linux.yml @@ -15,6 +15,7 @@ packages: reference_datetime: "2013-06-01 00:00:00" remotes: [] files: +- "openssl-1.0.1e.tar.gz" - "miniupnpc-1.8.tar.gz" - "qrencode-3.4.3.tar.bz2" - "protobuf-2.5.0.tar.bz2" @@ -24,11 +25,21 @@ script: | OPTFLAGS='-O2' export LIBRARY_PATH="$STAGING/lib" # Integrity Check + echo "f74f15e8c8ff11aa3d5bb5f276d202ec18d7246e95f961db76054199c69c1ae3 openssl-1.0.1e.tar.gz" | sha256sum -c echo "bc5f73c7b0056252c1888a80e6075787a1e1e9112b808f863a245483ff79859c miniupnpc-1.8.tar.gz" | sha256sum -c echo "dfd71487513c871bad485806bfd1fdb304dedc84d2b01a8fb8e0940b50597a98 qrencode-3.4.3.tar.bz2" | sha256sum -c echo "13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 protobuf-2.5.0.tar.bz2" | sha256sum -c echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c + # + tar xzf openssl-1.0.1e.tar.gz + cd openssl-1.0.1e + # need -fPIC to avoid relocation error in 64 bit builds + ./config no-shared no-zlib no-dso no-krb5 --openssldir=$STAGING -fPIC + make + make install_sw + cd .. + # tar xzfm miniupnpc-1.8.tar.gz cd miniupnpc-1.8 # miniupnpc is always built with -fPIC @@ -60,4 +71,4 @@ script: | cd ../.. # cd $STAGING - zip -r $OUTDIR/bitcoin-deps-linux${GBUILD_BITS}-gitian-r1.zip include lib bin host + zip -r $OUTDIR/bitcoin-deps-linux${GBUILD_BITS}-gitian-r2.zip include lib bin host diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index d0bdf144a..417f31e27 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -7,7 +7,6 @@ architectures: - "amd64" packages: - "libqt4-dev" -- "libssl-dev" - "git-core" - "unzip" - "pkg-config" @@ -21,8 +20,8 @@ remotes: - "url": "https://github.com/bitcoin/bitcoin.git" "dir": "bitcoin" files: -- "bitcoin-deps-linux32-gitian-r1.zip" -- "bitcoin-deps-linux64-gitian-r1.zip" +- "bitcoin-deps-linux32-gitian-r2.zip" +- "bitcoin-deps-linux64-gitian-r2.zip" - "boost-linux32-1.55.0-gitian-r1.zip" - "boost-linux64-1.55.0-gitian-r1.zip" script: | @@ -34,7 +33,7 @@ script: | # mkdir -p $STAGING cd $STAGING - unzip ../build/bitcoin-deps-linux${GBUILD_BITS}-gitian-r1.zip + unzip ../build/bitcoin-deps-linux${GBUILD_BITS}-gitian-r2.zip unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip cd ../build #