From 25e0e6f780b8d8412c293db53cb4cd79c2b9c02e Mon Sep 17 00:00:00 2001 From: Simon Scatton <44714756+SDAChess@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:30:48 +0200 Subject: [PATCH] fix(bazel): pin CMake library installs to lib (#10126) rules_foreign_cc expects libraries under its default lib output directory. GNUInstallDirs may instead select lib64, causing Bazel to reject an otherwise successful CMake build because its declared output is missing. Share the default CMake arguments between the static and dynamic targets and set CMAKE_INSTALL_LIBDIR to lib. --- BUILD.bazel | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index ef78b6e83e..ab99f75e5f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -16,10 +16,14 @@ filegroup( srcs = glob(["**"]), ) +_DEFAULT_CMAKE_GENERATE_ARGS = [ + "-G Ninja", + "-D CMAKE_INSTALL_LIBDIR=lib", # Matches rules_foreign_cc's default out_lib_dir. +] + cmake( name = "z3_dynamic", - generate_args = [ - "-G Ninja", + generate_args = _DEFAULT_CMAKE_GENERATE_ARGS + [ "-D Z3_EXPORTED_TARGETS=", # prevents installation, leaving symlinks between dylibs intact on copy ], lib_source = ":all_files", @@ -44,8 +48,7 @@ cmake( cmake( name = "z3_static", - generate_args = [ - "-G Ninja", + generate_args = _DEFAULT_CMAKE_GENERATE_ARGS + [ "-D BUILD_SHARED_LIBS=OFF", "-D Z3_BUILD_LIBZ3_SHARED=OFF", ],