diff --git a/contrib/teamcity/build-configurations.py b/contrib/teamcity/build-configurations.py --- a/contrib/teamcity/build-configurations.py +++ b/contrib/teamcity/build-configurations.py @@ -164,14 +164,49 @@ if self.config.get("fail_fast", False): generator_flags.append("-k0") + # Handle cross build configuration + cross_build = self.config.get("cross_build", None) + if cross_build: + static_depends = cross_build.get("static_depends", None) + toolchain = cross_build.get("toolchain", None) + emulator = cross_build.get("emulator", None) + + # Both static_depends and toochain are mandatory for cross builds + if not static_depends: + raise AssertionError( + "`static_depends` configuration is required for cross builds") + if not toolchain: + raise AssertionError( + "`toolchain` configuration is required for cross builds") + + self.build_steps.append( + { + "bin": str(self.project_root.joinpath("contrib/devtools/build_depends.sh")), + "args": [static_depends], + } + ) + + toolchain_file = self.project_root.joinpath( + "cmake/platforms/{}.cmake".format(toolchain) + ) + self.cmake_flags.append( + "-DCMAKE_TOOLCHAIN_FILE={}".format(str(toolchain_file)) + ) + + if emulator: + self.cmake_flags.append( + "-DCMAKE_CROSSCOMPILING_EMULATOR={}".format( + shutil.which(emulator)) + ) + # First call should use the build_cmake.sh script in order to run # cmake. - self.build_steps = [ + self.build_steps.append( { "bin": str(self.project_root.joinpath("contrib/devtools/build_cmake.sh")), "args": targets[0] + build_cmake_flags, } - ] + ) for target_group in targets[1:]: self.build_steps.append( diff --git a/contrib/teamcity/build-configurations.yml b/contrib/teamcity/build-configurations.yml --- a/contrib/teamcity/build-configurations.yml +++ b/contrib/teamcity/build-configurations.yml @@ -21,6 +21,15 @@ artifacts: gitian-results: '' + check+secp256k1: + targets: + - - all + - install + - install-secp256k1 + - - check + - check-secp256k1 + - check-functional + # The build descriptions. # If a script is defined, then this will be the only step to run. # Otherwise a list of targets can be specified, grouped by parallel runs. @@ -42,13 +51,8 @@ - '-DCMAKE_BUILD_TYPE=Debug' - '-DCRYPTO_USE_ASM=OFF' - '-DENABLE_SANITIZERS=address' - targets: - - - all - - install - - install-secp256k1 - - - check - - check-secp256k1 - - check-functional + templates: + - check+secp256k1 timeout: 1800 env: ASAN_OPTIONS: log_path=stdout @@ -134,29 +138,77 @@ ibd/debug.log: log/debug.log build-linux32: - script: builds/build-linux32.sh + cross_build: + static_depends: linux32 + toolchain: Linux32 templates: - - common_unix_artifacts + - check+secp256k1 timeout: 3600 build-linux64: - script: builds/build-linux64.sh + cross_build: + static_depends: linux64 + toolchain: Linux64 templates: - - common_unix_artifacts + - check+secp256k1 timeout: 3600 build-linux-aarch64: - script: builds/build-linux-aarch64.sh + cross_build: + static_depends: linux-aarch64 + toolchain: LinuxAArch64 + emulator: qemu-aarch64-static + cmake_flags: + # The ZMQ functional test will fail with qemu (due to a qemu limitation), + # so disable it to avoid the failure. + # Extracted from stderr: + # Unknown host QEMU_IFLA type: 50 + # Unknown host QEMU_IFLA type: 51 + # Unknown QEMU_IFLA_BRPORT type 33 + - "-DBUILD_BITCOIN_ZMQ=OFF" + # This is an horrible hack to workaround a qemu bug: + # https://bugs.launchpad.net/qemu/+bug/1748612 + # Qemu emits a message for unsupported features called by the guest. + # Because the output filtering is not working at all, it causes the + # qemu stderr to end up in the node stderr and fail the functional + # tests. + # Disabling the unsupported feature (here bypassing the config + # detection) fixes the issue. + # FIXME: get rid of the hack, either by using a better qemu version + # or by filtering stderr at the framework level. + - "-DHAVE_DECL_GETIFADDRS=OFF" templates: - - common_unix_artifacts + - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/aarch64-linux-gnu build-linux-arm: - script: builds/build-linux-arm.sh + cross_build: + static_depends: linux-arm + toolchain: LinuxARM + emulator: qemu-arm-static + cmake_flags: + # The ZMQ functional test will fail with qemu (due to a qemu limitation), + # so disable it to avoid the failure. + # Extracted from stderr: + # Unknown host QEMU_IFLA type: 50 + # Unknown host QEMU_IFLA type: 51 + # Unknown QEMU_IFLA_BRPORT type 33 + - "-DBUILD_BITCOIN_ZMQ=OFF" + # This is an horrible hack to workaround a qemu bug: + # https://bugs.launchpad.net/qemu/+bug/1748612 + # Qemu emits a message for unsupported features called by the guest. + # Because the output filtering is not working at all, it causes the + # qemu stderr to end up in the node stderr and fail the functional + # tests. + # Disabling the unsupported feature (here bypassing the config + # detection) fixes the issue. + # FIXME: get rid of the hack, either by using a better qemu version + # or by filtering stderr at the framework level. + - "-DHAVE_DECL_GETIFADDRS=OFF" templates: - - common_unix_artifacts + - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/arm-linux-gnueabihf @@ -214,13 +266,8 @@ cmake_flags: - '-DCMAKE_BUILD_TYPE=Debug' - '-DENABLE_SANITIZERS=undefined' - targets: - - - all - - install - - install-secp256k1 - - - check - - check-secp256k1 - - check-functional + templates: + - check+secp256k1 timeout: 1800 env: UBSAN_OPTIONS: log_path=stdout diff --git a/contrib/teamcity/builds/build-linux-aarch64.sh b/contrib/teamcity/builds/build-linux-aarch64.sh deleted file mode 100755 --- a/contrib/teamcity/builds/build-linux-aarch64.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C.UTF-8 - -set -euxo pipefail - -# shellcheck source=../ci-fixture.sh -source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" - -build_static_dependencies linux-aarch64 - -CMAKE_FLAGS=( - "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/LinuxAArch64.cmake" - # This will prepend our executable commands with the given emulator call - "-DCMAKE_CROSSCOMPILING_EMULATOR=$(command -v qemu-aarch64-static)" - # The ZMQ functional test will fail with qemu (due to a qemu limitation), - # so disable it to avoid the failure. - # Extracted from stderr: - # Unknown host QEMU_IFLA type: 50 - # Unknown host QEMU_IFLA type: 51 - # Unknown QEMU_IFLA_BRPORT type 33 - "-DBUILD_BITCOIN_ZMQ=OFF" - # This is an horrible hack to workaround a qemu bug: - # https://bugs.launchpad.net/qemu/+bug/1748612 - # Qemu emits a message for unsupported features called by the guest. - # Because the output filtering is not working at all, it causes the - # qemu stderr to end up in the node stderr and fail the functional - # tests. - # Disabling the unsupported feature (here bypassing the config - # detection) fixes the issue. - # FIXME: get rid of the hack, either by using a better qemu version - # or by filtering stderr at the framework level. - "-DHAVE_DECL_GETIFADDRS=OFF" -) -build_with_cmake --junit - -ninja -k0 check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-linux-arm.sh b/contrib/teamcity/builds/build-linux-arm.sh deleted file mode 100755 --- a/contrib/teamcity/builds/build-linux-arm.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C.UTF-8 - -set -euxo pipefail - -# shellcheck source=../ci-fixture.sh -source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" - -build_static_dependencies linux-arm - -CMAKE_FLAGS=( - "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/LinuxARM.cmake" - # This will prepend our executable commands with the given emulator call - "-DCMAKE_CROSSCOMPILING_EMULATOR=$(command -v qemu-arm-static)" - # The ZMQ functional test will fail with qemu (due to a qemu limitation), - # so disable it to avoid the failure. - # Extracted from stderr: - # Unknown host QEMU_IFLA type: 50 - # Unknown host QEMU_IFLA type: 51 - # Unknown QEMU_IFLA_BRPORT type 33 - "-DBUILD_BITCOIN_ZMQ=OFF" - # This is an horrible hack to workaround a qemu bug: - # https://bugs.launchpad.net/qemu/+bug/1748612 - # Qemu emits a message for unsupported features called by the guest. - # Because the output filtering is not working at all, it causes the - # qemu stderr to end up in the node stderr and fail the functional - # tests. - # Disabling the unsupported feature (here bypassing the config - # detection) fixes the issue. - # FIXME: get rid of the hack, either by using a better qemu version - # or by filtering stderr at the framework level. - "-DHAVE_DECL_GETIFADDRS=OFF" -) -build_with_cmake --junit - -ninja check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-linux32.sh b/contrib/teamcity/builds/build-linux32.sh deleted file mode 100755 --- a/contrib/teamcity/builds/build-linux32.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C.UTF-8 - -set -euxo pipefail - -# shellcheck source=../ci-fixture.sh -source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" - -build_static_dependencies linux32 - -# Build, run unit tests and functional tests. -CMAKE_FLAGS=( - "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/Linux32.cmake" -) -build_with_cmake --junit - -ninja -k0 check check-secp256k1 check-functional diff --git a/contrib/teamcity/builds/build-linux64.sh b/contrib/teamcity/builds/build-linux64.sh deleted file mode 100755 --- a/contrib/teamcity/builds/build-linux64.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C.UTF-8 - -set -euxo pipefail - -# shellcheck source=../ci-fixture.sh -source "${TOPLEVEL}/contrib/teamcity/ci-fixture.sh" - -build_static_dependencies linux64 - -# Build, run unit tests and functional tests. -CMAKE_FLAGS=( - "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_PLATFORMS_DIR}/Linux64.cmake" -) -build_with_cmake --junit - -ninja -k0 check check-secp256k1 check-functional