diff --git a/.bazelrc b/.bazelrc index 584f94338bb3..452423ac49aa 100644 --- a/.bazelrc +++ b/.bazelrc @@ -18,6 +18,10 @@ build:aarch64 --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo run:aarch64 --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo test:aarch64 --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo --host_javabase=@local_jdk//:jdk +build:crossbuild-aarch64 --incompatible_enable_cc_toolchain_resolution --platforms=//bazel/platforms:aarch64-none-linux-gnu --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo +run:crossbuild-aarch64 --incompatible_enable_cc_toolchain_resolution --platforms=//bazel/platforms:aarch64-none-linux-gnu --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo +test:crossbuild-aarch64 --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo --host_javabase=@local_jdk//:jdk + build --define gotags=selinux # let our unit tests produce our own junit reports diff --git a/Makefile b/Makefile index b8be5a2d8207..39ab7d0ed10a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ ifeq (${TIMESTAMP}, 1) endif all: - hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/build-manifests.sh && \ + hack/dockerized "export BUILD_ARCH=${BUILD_ARCH} && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/build-manifests.sh && \ hack/bazel-fmt.sh && hack/bazel-build.sh" go-all: @@ -16,7 +16,7 @@ bazel-generate: SYNC_VENDOR=true hack/dockerized "./hack/bazel-generate.sh" bazel-build: - hack/dockerized "hack/bazel-fmt.sh && hack/bazel-build.sh" + hack/dockerized "export BUILD_ARCH=${BUILD_ARCH} && hack/bazel-fmt.sh && hack/bazel-build.sh" bazel-build-verify: bazel-build ./hack/dockerized "hack/bazel-fmt.sh" @@ -25,10 +25,10 @@ bazel-build-verify: bazel-build ./hack/dockerized "hack/bazel-test.sh" bazel-build-images: - hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} ./hack/bazel-build-images.sh" + hack/dockerized "export BUILD_ARCH=${BUILD_ARCH} && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} ./hack/bazel-build-images.sh" bazel-push-images: - hack/dockerized "hack/bazel-fmt.sh && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} PUSH_TARGETS='${PUSH_TARGETS}' ./hack/bazel-push-images.sh" + hack/dockerized "export BUILD_ARCH=${BUILD_ARCH} && hack/bazel-fmt.sh && DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} PUSH_TARGETS='${PUSH_TARGETS}' ./hack/bazel-push-images.sh" push: bazel-push-images diff --git a/WORKSPACE b/WORKSPACE index 68a19b090b0d..b264632f7e6e 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,3 +1,12 @@ +load("//third_party:deps.bzl", "deps") + +deps() + +# register crosscompiler toolchains +load("//bazel/toolchain:toolchain.bzl", "register_all_toolchains") + +register_all_toolchains() + load( "@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", @@ -5,6 +14,12 @@ load( ) load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +http_archive( + name = "rules_python", + sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz", +) + # Additional bazel rules http_archive( @@ -40,12 +55,9 @@ http_archive( http_archive( name = "io_bazel_rules_docker", - sha256 = "4521794f0fba2e20f3bf15846ab5e01d5332e587e9ce81629c7f96c793bb7036", - strip_prefix = "rules_docker-0.14.4", - urls = [ - "https://github.com/bazelbuild/rules_docker/releases/download/v0.14.4/rules_docker-v0.14.4.tar.gz", - "https://storage.googleapis.com/builddeps/4521794f0fba2e20f3bf15846ab5e01d5332e587e9ce81629c7f96c793bb7036", - ], + sha256 = "95d39fd84ff4474babaf190450ee034d958202043e366b9fc38f438c9e6c3334", + strip_prefix = "rules_docker-0.16.0", + urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.16.0/rules_docker-v0.16.0.tar.gz"], ) http_archive( @@ -310,46 +322,6 @@ load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps") container_deps() -load("@io_bazel_rules_docker//repositories:pip_repositories.bzl", "pip_deps") - -pip_deps() - -http_file( - name = "go_puller_linux_aarch64", - executable = True, - sha256 = "433133e05182aaffe8842194433566e90345ca2ec3fc85f9a2e3fa4bac8a0bb5", - urls = [ - "https://storage.googleapis.com/builddeps/433133e05182aaffe8842194433566e90345ca2ec3fc85f9a2e3fa4bac8a0bb5", - ], -) - -http_file( - name = "go_pusher_linux_aarch64", - executable = True, - sha256 = "8d0c13034f7473cb778e4b488dc02d9ac781a4548826c9aac56e1b6a6b7ea36f", - urls = [ - "https://storage.googleapis.com/builddeps/8d0c13034f7473cb778e4b488dc02d9ac781a4548826c9aac56e1b6a6b7ea36f", - ], -) - -http_file( - name = "go_puller_linux_ppc64le", - executable = True, - sha256 = "540f4d7b2a3d627d7c3190f11c4fab5f8aad48bd42a9dffb037786e26270b6bd", - urls = [ - "https://storage.googleapis.com/builddeps/540f4d7b2a3d627d7c3190f11c4fab5f8aad48bd42a9dffb037786e26270b6bd", - ], -) - -http_file( - name = "go_pusher_linux_ppc64le", - executable = True, - sha256 = "961e5a11677ab5ebf9d7ada76864ca271abcc795a6808ac2e7e98b3458b4e435", - urls = [ - "https://storage.googleapis.com/builddeps/961e5a11677ab5ebf9d7ada76864ca271abcc795a6808ac2e7e98b3458b4e435", - ], -) - # Pull base image fedora31 # WARNING: please update any automated process to push this image to quay.io # instead of index.docker.io @@ -366,7 +338,6 @@ container_pull( container_pull( name = "fedora_ppc64le", digest = "sha256:50ab81a4619f7e94793aba65f3a40505bdfb9b59dcf6ae6deb8f974723e966d9", - puller_linux = "@go_puller_linux_ppc64le//file:downloaded", registry = "quay.io", repository = "kubevirtci/fedora", tag = "31", @@ -377,7 +348,6 @@ container_pull( container_pull( name = "fedora_aarch64", digest = "sha256:425676dd30f2c85ba3593b82040ce03341cd6dc4e38838e57c8bc5eef95b5f81", - puller_linux = "@go_puller_linux_aarch64//file:downloaded", registry = "index.docker.io", repository = "library/fedora", tag = "32", @@ -397,7 +367,6 @@ container_pull( container_pull( name = "fedora_sriov_lane_ppc64le", digest = "sha256:2d332d28863d0e415d58e335e836bd4f8a8c714e7a9d1f8f87418ef3db7c0afb", - puller_linux = "@go_puller_linux_ppc64le//file:downloaded", registry = "index.docker.io", repository = "kubevirt/fedora-sriov-testing", #tag = "32", @@ -406,7 +375,6 @@ container_pull( container_pull( name = "fedora_sriov_lane_aarch64", digest = "sha256:6f66ee747d62c354c0d36e640f8c97d6be0b6ad88a9e8c0180496ac55cba31bf", - puller_linux = "@go_puller_linux_aarch64//file:downloaded", registry = "quay.io", repository = "kubevirtci/fedora-sriov-testing", ) @@ -422,7 +390,6 @@ container_pull( container_pull( name = "go_image_base_ppc64le", digest = "sha256:4c45b244e8b23b064a822b46732defaff32455b3cd4671e2dd367d8e8a051e10", - puller_linux = "@go_puller_linux_ppc64le//file:downloaded", registry = "gcr.io", repository = "distroless/base", ) @@ -430,7 +397,6 @@ container_pull( container_pull( name = "go_image_base_aarch64", digest = "sha256:789c477fbd30a7d85435450306e54f20c53938e40af644284a229d852db30dde", - puller_linux = "@go_puller_linux_aarch64//file:downloaded", registry = "gcr.io", repository = "distroless/base", ) @@ -449,7 +415,6 @@ container_pull( container_pull( name = "nfs-server_ppc64le", digest = "sha256:8c1fa882dddb2885c4152e9ce632c466f4b8dce29339455e9b6bfe71f0a3d3ef", - puller_linux = "@go_puller_linux_ppc64le//file:downloaded", registry = "quay.io", repository = "kubevirtci/nfs-ganesha", # see https://github.com/slintes/docker-nfs-ganesha ) @@ -457,7 +422,6 @@ container_pull( container_pull( name = "nfs-server_aarch64", digest = "sha256:8c1fa882dddb2885c4152e9ce632c466f4b8dce29339455e9b6bfe71f0a3d3ef", - puller_linux = "@go_puller_linux_aarch64//file:downloaded", registry = "quay.io", repository = "kubevirtci/nfs-ganesha", # see https://github.com/slintes/docker-nfs-ganesha ) @@ -475,7 +439,6 @@ container_pull( container_pull( name = "fedora_with_test_tooling_ppc64le", digest = "sha256:9ec3e137bff093597d192f5a4e346f25b614c3a94216b857de0e3d75b68bfb17", - puller_linux = "@go_puller_linux_ppc64le//file:downloaded", registry = "quay.io", repository = "kubevirt/fedora-with-test-tooling", ) @@ -483,7 +446,6 @@ container_pull( container_pull( name = "fedora_with_test_tooling_aarch64", digest = "sha256:9ec3e137bff093597d192f5a4e346f25b614c3a94216b857de0e3d75b68bfb17", - puller_linux = "@go_puller_linux_aarch64//file:downloaded", registry = "quay.io", repository = "kubevirt/fedora-with-test-tooling", ) diff --git a/bazel/BUILD b/bazel/BUILD new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/bazel/platforms/BUILD b/bazel/platforms/BUILD new file mode 100644 index 000000000000..418c49ebc427 --- /dev/null +++ b/bazel/platforms/BUILD @@ -0,0 +1,7 @@ +platform( + name = "aarch64-none-linux-gnu", + constraint_values = [ + "@platforms//cpu:aarch64", + "@platforms//os:linux", + ], +) diff --git a/bazel/toolchain/BUILD b/bazel/toolchain/BUILD new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/bazel/toolchain/aarch64-none-linux-gnu/BUILD b/bazel/toolchain/aarch64-none-linux-gnu/BUILD new file mode 100644 index 000000000000..9c39b3f0f83a --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/BUILD @@ -0,0 +1,56 @@ +package(default_visibility = ["//visibility:public"]) + +load(":cc_toolchain_config.bzl", "cc_toolchain_config") + +filegroup(name = "empty") + +filegroup( + name = "wrappers", + srcs = glob([ + "wrappers/**", + ]), +) + +filegroup( + name = "all_files", + srcs = [ + ":wrappers", + "@aarch64-none-linux-gnu//:toolchain", + ], +) + +cc_toolchain_config(name = "aarch64_toolchain_config") + +cc_toolchain( + name = "aarch64_toolchain", + all_files = ":all_files", + compiler_files = ":all_files", + dwp_files = ":empty", + linker_files = ":all_files", + objcopy_files = ":empty", + strip_files = ":empty", + toolchain_config = ":aarch64_toolchain_config", + toolchain_identifier = "aarch64-toolchain", +) + +cc_toolchain_suite( + name = "gcc_toolchain", + tags = ["manual"], + toolchains = { + "aarch64": ":aarch64_toolchain", + }, +) + +toolchain( + name = "aarch64_linux_toolchain", + exec_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:aarch64", + ], + toolchain = ":aarch64_toolchain", + toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", +) diff --git a/bazel/toolchain/aarch64-none-linux-gnu/cc_toolchain_config.bzl b/bazel/toolchain/aarch64-none-linux-gnu/cc_toolchain_config.bzl new file mode 100644 index 000000000000..7b1bfa158faf --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/cc_toolchain_config.bzl @@ -0,0 +1,133 @@ +load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") +load( + "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", + "feature", + "flag_group", + "flag_set", + "tool_path", +) + +all_link_actions = [ + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, +] + +all_compile_actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.clif_match, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.lto_backend, + ACTION_NAMES.preprocess_assemble, +] + +def _impl(ctx): + tool_paths = [ + tool_path( + name = "ar", + path = "wrappers/aarch64-none-linux-gnu-ar", + ), + tool_path( + name = "cpp", + path = "wrappers/aarch64-none-linux-gnu-cpp", + ), + tool_path( + name = "gcc", + path = "wrappers/aarch64-none-linux-gnu-gcc", + ), + tool_path( + name = "gcov", + path = "wrappers/aarch64-none-linux-gnu-gcov", + ), + tool_path( + name = "ld", + path = "wrappers/aarch64-none-linux-gnu-ld", + ), + tool_path( + name = "nm", + path = "wrappers/aarch64-none-linux-gnu-nm", + ), + tool_path( + name = "objdump", + path = "wrappers/aarch64-none-linux-gnu-objdump", + ), + tool_path( + name = "strip", + path = "wrappers/aarch64-none-linux-gnu-strip", + ), + ] + + default_compiler_flags = feature( + name = "default_compiler_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = all_compile_actions, + flag_groups = [ + flag_group( + flags = [ + "-no-canonical-prefixes", + "-fno-canonical-system-headers", + "-Wno-builtin-macro-redefined", + "-D__DATE__=\"redacted\"", + "-D__TIMESTAMP__=\"redacted\"", + "-D__TIME__=\"redacted\"", + ], + ), + ], + ), + ], + ) + + default_linker_flags = feature( + name = "default_linker_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = ([ + flag_group( + flags = [ + "-lstdc++", + ], + ), + ]), + ), + ], + ) + + features = [ + default_compiler_flags, + default_linker_flags, + ] + + return cc_common.create_cc_toolchain_config_info( + ctx = ctx, + cxx_builtin_include_directories = [ + "/proc/self/cwd/external/aarch64-none-linux-gnu/aarch64-none-linux-gnu/include/c++/10.2.1/", + "/proc/self/cwd/external/aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/usr/include/", + "/proc/self/cwd/external/aarch64-none-linux-gnu/lib/gcc/aarch64-none-linux-gnu/10.2.1/include/", + "/proc/self/cwd/external/aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc/lib/", + ], + features = features, + toolchain_identifier = "aarch64-toolchain", + host_system_name = "local", + target_system_name = "unknown", + target_cpu = "unknown", + target_libc = "unknown", + compiler = "unknown", + abi_version = "unknown", + abi_libc_version = "unknown", + tool_paths = tool_paths, + ) + +cc_toolchain_config = rule( + implementation = _impl, + attrs = {}, + provides = [CcToolchainConfigInfo], +) diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-ar b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-ar new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-ar @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-cpp b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-cpp new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-cpp @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-gcc b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-gcc new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-gcc @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-gcov b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-gcov new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-gcov @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-ld b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-ld new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-ld @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-nm b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-nm new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-nm @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-objdump b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-objdump new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-objdump @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-strip b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-strip new file mode 120000 index 000000000000..22cb46f8d789 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/aarch64-none-linux-gnu-strip @@ -0,0 +1 @@ +wrapper \ No newline at end of file diff --git a/bazel/toolchain/aarch64-none-linux-gnu/wrappers/wrapper b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/wrapper new file mode 100755 index 000000000000..8889df305ae2 --- /dev/null +++ b/bazel/toolchain/aarch64-none-linux-gnu/wrappers/wrapper @@ -0,0 +1,11 @@ +#!/bin/bash + +CUR_DIR="$( + cd "$(dirname "$BASH_SOURCE[0]")/" + pwd +)" + +NAME=$(basename "$0") +TOOLCHAIN_BINDIR=${CUR_DIR}/../../../../external/aarch64-none-linux-gnu/bin + +exec "${TOOLCHAIN_BINDIR}"/"${NAME}" "$@" diff --git a/bazel/toolchain/toolchain.bzl b/bazel/toolchain/toolchain.bzl new file mode 100644 index 000000000000..d859d41b5c3b --- /dev/null +++ b/bazel/toolchain/toolchain.bzl @@ -0,0 +1,4 @@ +def register_all_toolchains(): + native.register_toolchains( + "//bazel/toolchain/aarch64-none-linux-gnu:aarch64_linux_toolchain", + ) diff --git a/hack/bazel-build.sh b/hack/bazel-build.sh index b30e38771cc5..d48f8a0f8391 100755 --- a/hack/bazel-build.sh +++ b/hack/bazel-build.sh @@ -38,22 +38,22 @@ bazel run \ # build platform native virtctl explicitly bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ :build-virtctl -- ${CMD_OUT_DIR}/virtctl/virtctl # cross-compile virtctl for # linux bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ :build-virtctl-amd64 -- ${CMD_OUT_DIR}/virtctl/virtctl-${KUBEVIRT_VERSION}-linux-amd64 # darwin bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ :build-virtctl-darwin -- ${CMD_OUT_DIR}/virtctl/virtctl-${KUBEVIRT_VERSION}-darwin-amd64 # windows bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ :build-virtctl-windows -- ${CMD_OUT_DIR}/virtctl/virtctl-${KUBEVIRT_VERSION}-windows-amd64.exe diff --git a/hack/bazel-fmt.sh b/hack/bazel-fmt.sh index 0fc9b13a5c55..3dcbe41f85f0 100755 --- a/hack/bazel-fmt.sh +++ b/hack/bazel-fmt.sh @@ -23,15 +23,15 @@ source hack/common.sh source hack/config.sh bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ //vendor/mvdan.cc/sh/v3/cmd/shfmt:shfmt -- -i 4 -w ${KUBEVIRT_DIR}/hack/ ${KUBEVIRT_DIR}/images/ bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ //:gazelle -- pkg/ tools/ tests/ cmd/ bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ //:goimports # allign BAZEL files to a single format bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ //:buildifier diff --git a/hack/build-manifests.sh b/hack/build-manifests.sh index 67033c1ed05e..c93f19e3fb1a 100755 --- a/hack/build-manifests.sh +++ b/hack/build-manifests.sh @@ -38,7 +38,7 @@ mkdir -p "${TESTS_OUT_DIR}/tools" templator=${TESTS_OUT_DIR}/tools/manifest-templator bazel run \ - --config=${ARCHITECTURE} \ + --config=${HOST_ARCHITECTURE} \ //:build-manifest-templator -- ${templator} # first process file includes only diff --git a/hack/common.sh b/hack/common.sh index 7b76dac8fec8..aeb2a3d2f8bf 100644 --- a/hack/common.sh +++ b/hack/common.sh @@ -19,7 +19,8 @@ ARTIFACTS=${ARTIFACTS:-${OUT_DIR}/artifacts} MANIFESTS_OUT_DIR=$OUT_DIR/manifests MANIFEST_TEMPLATES_OUT_DIR=$OUT_DIR/templates/manifests PYTHON_CLIENT_OUT_DIR=$OUT_DIR/client-python -ARCHITECTURE=$(uname -m) +ARCHITECTURE="${BUILD_ARCH:-$(uname -m)}" +HOST_ARCHITECTURE="$(uname -m)" function build_func_tests() { mkdir -p "${TESTS_OUT_DIR}/" diff --git a/hack/rpm-deps.sh b/hack/rpm-deps.sh index ae65d765c437..81e7efa3d59c 100755 --- a/hack/rpm-deps.sh +++ b/hack/rpm-deps.sh @@ -60,11 +60,11 @@ bazel run \ # create a rpmtree for libvirt-devel. libvirt-devel is needed for compilation and unit-testing. bazel run \ --config=${ARCHITECTURE} \ - //:bazeldnf -- rpmtree --public --name libvirt-devel_x86_64 $basesystem libvirt-devel-${LIBVIRT_VERSION} + //:bazeldnf -- rpmtree --public --name libvirt-devel_x86_64 $basesystem libvirt-devel-${LIBVIRT_VERSION} lz4-libs bazel run \ --config=${ARCHITECTURE} \ - //:bazeldnf -- rpmtree --public --arch=aarch64 --name libvirt-devel_aarch64 $basesystem libvirt-devel-${LIBVIRT_VERSION} + //:bazeldnf -- rpmtree --public --arch=aarch64 --name libvirt-devel_aarch64 $basesystem libvirt-devel-${LIBVIRT_VERSION} lz4-libs # create a rpmtree for virt-launcher and virt-handler. This is the OS for our node-components. bazel run \ --config=${ARCHITECTURE} \ diff --git a/rpm/BUILD.bazel b/rpm/BUILD.bazel index 7671f5d3ccf8..2745729f0b79 100644 --- a/rpm/BUILD.bazel +++ b/rpm/BUILD.bazel @@ -8,6 +8,8 @@ bazeldnf( "/usr/lib64/libvirt-lxc.so.0", "/usr/lib64/libvirt-qemu.so.0", "/usr/lib64/libvirt.so.0", + "/usr/lib64/libgcrypt.so.20", + "/usr/lib64/liblz4.so.1", ], rpmtree = ":libvirt-devel_x86_64", rulename = "libvirt-libs_x86_64", @@ -20,6 +22,8 @@ bazeldnf( "/usr/lib64/libvirt-lxc.so.0", "/usr/lib64/libvirt-qemu.so.0", "/usr/lib64/libvirt.so.0", + "/usr/lib64/libgcrypt.so.20", + "/usr/lib64/liblz4.so.1", ], rpmtree = ":libvirt-devel_aarch64", rulename = "libvirt-libs_aarch64", @@ -1441,6 +1445,8 @@ tar2files( "libffi.so.6.0.2", "libgcc_s-10-20201125.so.1", "libgcc_s.so.1", + "libgcrypt.so.20", + "libgcrypt.so.20.2.5", "libgio-2.0.so.0", "libgio-2.0.so.0.6400.6", "libglib-2.0.so.0", @@ -1453,6 +1459,8 @@ tar2files( "libgnutls.so.30.28.1", "libgobject-2.0.so.0", "libgobject-2.0.so.0.6400.6", + "libgpg-error.so.0", + "libgpg-error.so.0.27.0", "libgssapi_krb5.so.2", "libgssapi_krb5.so.2.2", "libhogweed.so.5", @@ -1467,6 +1475,8 @@ tar2files( "libkrb5.so.3.3", "libkrb5support.so.0", "libkrb5support.so.0.1", + "liblz4.so.1", + "liblz4.so.1.9.1", "liblzma.so.5", "liblzma.so.5.2.5", "libm-2.31.so", @@ -1593,6 +1603,8 @@ tar2files( "libffi.so.6.0.2", "libgcc_s-10-20201125.so.1", "libgcc_s.so.1", + "libgcrypt.so.20", + "libgcrypt.so.20.2.5", "libgio-2.0.so.0", "libgio-2.0.so.0.6400.6", "libglib-2.0.so.0", @@ -1605,6 +1617,8 @@ tar2files( "libgnutls.so.30.28.1", "libgobject-2.0.so.0", "libgobject-2.0.so.0.6400.6", + "libgpg-error.so.0", + "libgpg-error.so.0.27.0", "libgssapi_krb5.so.2", "libgssapi_krb5.so.2.2", "libhogweed.so.5", @@ -1619,6 +1633,8 @@ tar2files( "libkrb5.so.3.3", "libkrb5support.so.0", "libkrb5support.so.0.1", + "liblz4.so.1", + "liblz4.so.1.9.1", "liblzma.so.5", "liblzma.so.5.2.5", "libm-2.31.so", diff --git a/third_party/BUILD b/third_party/BUILD new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/deps.bzl b/third_party/deps.bzl new file mode 100644 index 000000000000..d11823e14852 --- /dev/null +++ b/third_party/deps.bzl @@ -0,0 +1,4 @@ +load("//third_party/toolchains:toolchains.bzl", "toolchains") + +def deps(): + toolchains() diff --git a/third_party/toolchains/BUILD b/third_party/toolchains/BUILD new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/toolchains/aarch64-none-linux-gnu.BUILD b/third_party/toolchains/aarch64-none-linux-gnu.BUILD new file mode 100644 index 000000000000..b7ffb729b036 --- /dev/null +++ b/third_party/toolchains/aarch64-none-linux-gnu.BUILD @@ -0,0 +1,8 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "toolchain", + srcs = glob([ + "**", + ]), +) diff --git a/third_party/toolchains/toolchains.bzl b/third_party/toolchains/toolchains.bzl new file mode 100644 index 000000000000..5803bd9acdbd --- /dev/null +++ b/third_party/toolchains/toolchains.bzl @@ -0,0 +1,13 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +URL = "http://repo.ltekieli.com:8080/" + +def toolchains(): + if "aarch64-none-linux-gnu" not in native.existing_rules(): + http_archive( + name = "aarch64-none-linux-gnu", + build_file = Label("//third_party/toolchains:aarch64-none-linux-gnu.BUILD"), + url = "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu.tar.xz", + sha256 = "fe7f72330216612de44891ebe5e228eed7c0c051ac090c395b2b33115c6f5408", + strip_prefix = "gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu", + )