commit 0fcee6e11c1b9b9de700cb2af4125237a51f5608 (tree)
parent 58ee5f4e61cd9b7a9ba65798e2214efa3753a733
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Wed, 23 Sep 2020 20:59:09 +0200
Merge pull request #6373 from notCalle/workaround-6087
Workaround MacOS build failure due to #6087
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -56,6 +56,7 @@ set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")
set(ZIG_WORKAROUND_4799 off CACHE BOOL "workaround for https://github.com/ziglang/zig/issues/4799")
set(ZIG_WORKAROUND_POLLY_SO off CACHE STRING "workaround for https://github.com/ziglang/zig/issues/4799")
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
+set(ZIG_WORKAROUND_6087 off CACHE BOOL "workaround for https://github.com/ziglang/zig/issues/6087")
if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
@@ -90,6 +91,11 @@ if(APPLE AND ZIG_STATIC)
list(APPEND LLVM_LIBRARIES "${ZLIB}")
endif()
+if(APPLE AND ZIG_WORKAROUND_6087)
+ list(REMOVE_ITEM LLVM_LIBRARIES "-llibxml2.tbd")
+ list(APPEND LLVM_LIBRARIES "-lxml2")
+endif()
+
if(APPLE AND ZIG_WORKAROUND_4799)
# eg: ${CMAKE_PREFIX_PATH} could be /usr/local/opt/llvm/
list(APPEND LLVM_LIBRARIES "-Wl,${CMAKE_PREFIX_PATH}/lib/libPolly.a" "-Wl,${CMAKE_PREFIX_PATH}/lib/libPollyPPCG.a" "-Wl,${CMAKE_PREFIX_PATH}/lib/libPollyISL.a")
diff --git a/README.md b/README.md
@@ -73,6 +73,11 @@ in which case try `-DZIG_WORKAROUND_4799=ON`
Hopefully this will be fixed upstream with LLVM 10.0.1.
+Building with LLVM 10.0.1 you might run into this problem:
+`ld: library not found for -llibxml2.tbd`
+[Building with LLVM 10.0.1 installed via Homebrew fails](https://github.com/ziglang/zig/issues/6087),
+in which case you can try `-DZIG_WORKAROUND_6087=ON`.
+
##### Windows
See https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows