From 1a5c1c9aa78cd84d23eafb17d80841a9369a8d9c Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Thu, 31 Aug 2023 20:27:01 -0600 Subject: [PATCH] override target The "-target native" argument causes Zig to call detectAbiAndDynamicLinker() and determine the dynamic-linker from the ELF data of `/usr/bin/env`. Problem is, `env` is a 32-bit executable, and the zig binary is 64-bit. One other person hit this same issue but in this case their `/usr/bin/env` was a link to a statically built busybox, meaning there was no interpreter to find. https://github.com/ziglang/zig/issues/14577 The real fix is probably to just have detectAbiAndDynamicLinker() use hard-coded defaults on the `solaris` tag. But for now I'm going to try to make progress by setting the target explicitly. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aa1c8c87481..30ec5fb139eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,10 @@ else() set(ZIG_USE_LLVM_CONFIG OFF CACHE BOOL "use llvm-config to find LLVM libraries") endif() +set(ZIG_TARGET_TRIPLE "x86_64-solaris") +set(ZIG_USE_LLVM_CONFIG ON) + + if(ZIG_AR_WORKAROUND) string(REPLACE "" " ar" CMAKE_C_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE}) string(REPLACE "" " ar" CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_CXX_ARCHIVE_CREATE})