Download the Bazel release matching the build architecture - #247
Download the Bazel release matching the build architecture#247hsinhoyeh wants to merge 1 commit into
Conversation
The server image hardcoded bazel-$BAZEL_VERSION-installer-linux-x86_64.sh, so ml_metadata_store_server could only be built on x86_64. This is one of the reasons the published image is amd64-only, which in turn blocks Kubeflow Pipelines on ARM clusters (kubeflow/pipelines#10308). Bazel publishes a linux-arm64 release for 7.7.0, but as a plain binary rather than an installer script, so select the artifact from `dpkg --print-architecture` and install it directly to /usr/local/bin. On x86_64 this is equivalent to the previous installer invocation: the installer's only effect here was to place the same bazel binary on PATH.
|
Updated the description with verification results — the earlier "could not complete a master build" caveat no longer applies. Summary of what I confirmed on
Two things I'd flag for whoever takes the
I left the |
|
Sent the It is gated on |
Problem
ml_metadata/tools/docker_server/Dockerfilehardcodes the x86_64 Bazel installer, so the server image can only be built on x86_64:This is one reason
gcr.io/tfx-oss-public/ml_metadata_store_serveris published for amd64 only, which in turn is the last image blocking Kubeflow Pipelines on ARM clusters — see kubeflow/pipelines#10308 and kubeflow/pipelines#10309, open since December 2023.Change
Bazel publishes a
linux-arm64release for 7.7.0, but as a plain binary rather than an installer script. This selects the artifact fromdpkg --print-architectureand installs it directly to/usr/local/bin:On x86_64 this is equivalent to the previous invocation — the installer's only effect here was to place the same
bazelbinary onPATH. TheLICENSE.txtfetch is unchanged.Six lines changed, one file.
Verification
Verified on
master(be943b8) on an aarch64 host (NVIDIA GB10, Ubuntu 24.04, Docker 28.5.1):This change works. With it,
bazel-7.7.0-linux-arm64is fetched and installed correctly, and Bazel starts and runs the build on aarch64. Without it the image cannot be built on ARM at all.masterthen needs one more thing to finish an aarch64 build, which is outside the scope of this PR. Abseil'sstacktrace.ccemits the ARMv8.3 pointer-authentication instructionxpaclri, which the assembler rejects at the defaultarmv8-abaseline:Adding
--copt=-march=armv8.3-a --host_copt=-march=armv8.3-ato thebazel buildinvocation resolves it, andmasterthen builds clean on arm64 with zero errors, producing a working server:Two details worth recording for whoever picks that up:
--host_coptis required in addition to--copt. The failing target is compiled[for tool], i.e. in the exec configuration, which--coptdoes not affect. With--coptalone the error persists unchanged.-march=armv8-a+pauthwould be preferable to bumping the whole baseline toarmv8.3-a, sincexpaclriis a HINT-space instruction that is a no-op on older cores, and raising the baseline means the binary requires ARMv8.3 hardware (Graviton2, for example, is ARMv8.2). But GCC 9 on theubuntu:20.04builder rejects it:I have deliberately not included the
-marchchange here: it needs to be conditional on the target CPU (it is invalid on x86_64), and choosing between raising the baseline and bumping the builder image is a call for maintainers. Happy to send it as a follow-up in whichever form you prefer.Earlier I also verified the same Dockerfile change against the
v1.14.0tag (Bazel 5.3.0, which likewise publisheslinux-arm64), where the full build additionally required making the vendored PostgreSQLpg_config.harchitecture-aware — see the note below. Deployed into a Kubeflow Pipelines 2.16.1 install on an arm64 kind cluster,metadata-grpc-deploymentreaches1/1 Running, andml-pipeline-persistenceagent/ml-pipeline-scheduledworkflow— previously crash-looping against the unavailable metadata service — recover with it.Note on the remaining aarch64 blocker
On
v1.14.0this Dockerfile change alone was not sufficient — the vendored PostgreSQL build also had to be made architecture-aware.ml_metadata/postgresql.BUILDgeneratespg_config.hfrom a fixed list of lines captured from aconfigurerun on x86_64 (PG_VERSION_STRstill records"PostgreSQL 12.1 on x86_64-apple-darwin19.2.0"), asserting x86-only CPU capabilities unconditionally. WithHAVE__GET_CPUIDdefined,src/port/pg_bitutils.cincludes<cpuid.h>, which only exists on x86:On
masterthat macro is already/* #undef HAVE__GET_CPUID */, and mymasterbuild above confirms this is no longer an issue there:#define HAVE_X86_64_POPCNTQ 1remains unconditional, but it does not break the aarch64 build on its own. So nopg_config.hchange is needed formaster— I am recording it only because it is still present on release branches such asv1.14.0, and because the underlying pattern (aconfiguresnapshot hardcoded for one CPU, with noselect()on architecture) may resurface.Scoping this PR to the Dockerfile alone keeps it reviewable and independently useful.