diff --git a/chronik/CMakeLists.txt b/chronik/CMakeLists.txt --- a/chronik/CMakeLists.txt +++ b/chronik/CMakeLists.txt @@ -91,6 +91,7 @@ # Compile Rust, generates chronik-lib corrosion_import_crate( MANIFEST_PATH "chronik-lib/Cargo.toml" + NO_LINKER_OVERRIDE FLAGS ${CHRONIK_CARGO_FLAGS} ${CHRONIK_FEATURE_FLAGS} diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -426,6 +426,8 @@ time-machine shell --manifest="${PWD}/contrib/guix/manifest.scm" \ --container \ --pure \ + --network \ + --emulate-fhs \ --no-cwd \ --share="$PWD"=/bitcoin \ --share="$OUTDIR_BASE"=/outdir-base \ diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -62,6 +62,7 @@ # includes/libs NATIVE_GCC="$(store_path gcc-toolchain)" NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)" +NATIVE_GCC_LIBS="$(store_path gcc lib)" unset LIBRARY_PATH unset CPATH @@ -70,7 +71,7 @@ unset OBJC_INCLUDE_PATH unset OBJCPLUS_INCLUDE_PATH -export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib" +export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib:${NATIVE_GCC_LIBS}/lib" export C_INCLUDE_PATH="${NATIVE_GCC}/include" export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include" export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include" @@ -211,21 +212,34 @@ case "$HOST" in *mingw*) CMAKE_TOOLCHAIN_FILE="/bitcoin/cmake/platforms/Win64.cmake" + RUST_TARGET="x86_64-pc-windows-gnu" ;; aarch64-linux-gnu) CMAKE_TOOLCHAIN_FILE="/bitcoin/cmake/platforms/LinuxAArch64.cmake" + RUST_TARGET="aarch64-unknown-linux-gnu" ;; arm-linux-gnueabihf) CMAKE_TOOLCHAIN_FILE="/bitcoin/cmake/platforms/LinuxARM.cmake" + RUST_TARGET="arm-unknown-linux-gnueabihf" ;; x86_64-linux-gnu) CMAKE_TOOLCHAIN_FILE="/bitcoin/cmake/platforms/Linux64.cmake" + RUST_TARGET="x86_64-unknown-linux-gnu" ;; *darwin*) CMAKE_TOOLCHAIN_FILE="/bitcoin/cmake/platforms/OSX.cmake" + RUST_TARGET="x86_64-apple-darwin" ;; esac +curl -sSf https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init -o rustup-init +echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db rustup-init" | sha256sum -c +chmod +x rustup-init +./rustup-init -y --default-toolchain=1.76.0 +# shellcheck disable=SC1091 +source "$HOME/.cargo/env" +rustup target add "${RUST_TARGET}" + mkdir -p source_package pushd source_package rm -f CMakeCache.txt @@ -283,7 +297,7 @@ CMAKE_EXTRA_OPTIONS=(-DBUILD_BITCOIN_SEEDER=OFF -DCPACK_PACKAGE_FILE_NAME="${DISTNAME}-win64-setup-unsigned") ;; *linux*) - CMAKE_EXTRA_OPTIONS=(-DENABLE_STATIC_LIBSTDCXX=ON -DENABLE_GLIBC_BACK_COMPAT=ON -DUSE_LINKER=) + CMAKE_EXTRA_OPTIONS=(-DENABLE_STATIC_LIBSTDCXX=ON -DENABLE_GLIBC_BACK_COMPAT=ON -DBUILD_BITCOIN_CHRONIK=ON -DUSE_LINKER=) ;; *darwin*) CMAKE_EXTRA_OPTIONS=(-DGENISOIMAGE_EXECUTABLE="${WRAP_DIR}/genisoimage") @@ -301,7 +315,14 @@ # binary tarballs. INSTALLPATH=$(pwd)/installed/${DISTNAME} mkdir -p "${INSTALLPATH}" - + # Needed for rustup, cargo and rustc + export LD_LIBRARY_PATH="${LIBRARY_PATH}" + # rocksdb-sys uses libclang to parse the headers but it doesn't know what + # the host arch is. As a consequence it fails to parse gnu/stubs.h if the + # multilib headers are not installed because it falls back to the 32 bits + # variant gnu/stubs-32.h that guix don't provide. + # Instead we can instruct clang to use the correct arch. + export BINDGEN_EXTRA_CLANG_ARGS="-D__x86_64__ -D__LP64__ -U__ILP32__" cmake -GNinja .. \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \ -DCLIENT_VERSION_IS_RELEASE=ON \ diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -51,7 +51,7 @@ time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ - --commit=160f78a4d92205df986ed9efcce7d3aac188cb24 \ + --commit=afdcba78558bd7a33f517716e69bb9494297064d \ --cores="$JOBS" \ --keep-failed \ --fallback \ diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -8,6 +8,7 @@ (gnu packages commencement) (gnu packages compression) (gnu packages cross-base) + (gnu packages curl) (gnu packages file) (gnu packages gawk) (gnu packages gcc) @@ -581,6 +582,7 @@ bzip2 gzip xz + zlib ;; Build tools cmake-minimal ninja @@ -593,13 +595,17 @@ ;; Native GCC 10 toolchain gcc-toolchain-10 (list gcc-toolchain-10 "static") + (list gcc "lib") ;; Scripting python-minimal ;; (3.10) perl ;; Git git-minimal ;; Tests - python-lief) + python-lief + ;; Web + curl + nss-certs) (let ((target (getenv "HOST"))) (cond ((string-suffix? "-mingw32" target) ;; Windows @@ -609,7 +615,7 @@ nss-certs osslsigncode)) ((string-contains target "-linux-") - (list (make-bitcoin-cross-toolchain target))) + (list clang-10 (make-bitcoin-cross-toolchain target))) ((string-contains target "darwin") (list clang-toolchain-10 binutils xorriso python-signapple)) (else '())))))