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 @@ -134,29 +134,97 @@ ibd/debug.log: log/debug.log build-linux32: - script: builds/build-linux32.sh - templates: - - common_unix_artifacts + cross_build: + static_depends: linux32 + toolchain: Linux32 + targets: + - - all + - install + - install-secp256k1 + - - check + - check-secp256k1 + - check-functional timeout: 3600 build-linux64: - script: builds/build-linux64.sh - templates: - - common_unix_artifacts + cross_build: + static_depends: linux64 + toolchain: Linux64 + targets: + - - all + - install + - install-secp256k1 + - - check + - check-secp256k1 + - check-functional timeout: 3600 build-linux-aarch64: - script: builds/build-linux-aarch64.sh - templates: - - common_unix_artifacts + 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" + targets: + - - all + - install + - install-secp256k1 + - - check + - check-secp256k1 + - check-functional timeout: 3600 env: QEMU_LD_PREFIX: /usr/aarch64-linux-gnu build-linux-arm: - script: builds/build-linux-arm.sh - templates: - - common_unix_artifacts + 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" + targets: + - - all + - install + - install-secp256k1 + - - check + - check-secp256k1 + - check-functional timeout: 3600 env: QEMU_LD_PREFIX: /usr/arm-linux-gnueabihf