authorgravatar for timothee.cour2@gmail.comTimothee Cour <timothee.cour2@gmail.com> 2020-04-17 17:22:00-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-03 04:40:25+00:00
log9a7f05378f4497d1ebe1ee6f5ca17390121665a9
tree8ac2087c771fa23eaba6d920126780be2ad4915c
parent70cc1751ca69dd77625c703445713d067215b5d9

fix https://github.com/ziglang/zig/issues/4799


2 files changed, 10 insertions(+), 1 deletions(-)

CMakeLists.txt+7
...@@ -53,6 +53,7 @@ set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not com...@@ -53,6 +53,7 @@ set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not com
53set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")53set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
54set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")54set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")
55set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")55set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")
56set(ZIG_WORKAROUND_4799 off CACHE BOOL "workaround for https://github.com/ziglang/zig/issues/4799")
56set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")57set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
5758
58if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)59if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
...@@ -88,6 +89,11 @@ if(APPLE AND ZIG_STATIC)...@@ -88,6 +89,11 @@ if(APPLE AND ZIG_STATIC)
88 list(APPEND LLVM_LIBRARIES "${ZLIB}")89 list(APPEND LLVM_LIBRARIES "${ZLIB}")
89endif()90endif()
9091
92if(APPLE AND ZIG_WORKAROUND_4799)
93 # eg: ${CMAKE_PREFIX_PATH} could be /usr/local/opt/llvm/
94 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")
95endif()
96
91set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zig_cpp")97set(ZIG_CPP_LIB_DIR "${CMAKE_BINARY_DIR}/zig_cpp")
9298
93# Handle multi-config builds and place each into a common lib. The VS generator99# Handle multi-config builds and place each into a common lib. The VS generator
...@@ -397,6 +403,7 @@ add_library(zig_cpp STATIC ${ZIG_CPP_SOURCES})...@@ -397,6 +403,7 @@ add_library(zig_cpp STATIC ${ZIG_CPP_SOURCES})
397set_target_properties(zig_cpp PROPERTIES403set_target_properties(zig_cpp PROPERTIES
398 COMPILE_FLAGS ${EXE_CFLAGS}404 COMPILE_FLAGS ${EXE_CFLAGS}
399)405)
406
400target_link_libraries(zig_cpp LINK_PUBLIC407target_link_libraries(zig_cpp LINK_PUBLIC
401 ${CLANG_LIBRARIES}408 ${CLANG_LIBRARIES}
402 ${LLD_LIBRARIES}409 ${LLD_LIBRARIES}
README.md+3-1
...@@ -61,11 +61,13 @@ brew outdated llvm || brew upgrade llvm...@@ -61,11 +61,13 @@ brew outdated llvm || brew upgrade llvm
61mkdir build61mkdir build
62cd build62cd build
63cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm)63cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix llvm)
64make install64make -j install
65```65```
6666
67You will now run into this issue:67You will now run into this issue:
68[homebrew and llvm 10 packages in apt.llvm.org are broken with undefined reference to getPollyPluginInfo](https://github.com/ziglang/zig/issues/4799)68[homebrew and llvm 10 packages in apt.llvm.org are broken with undefined reference to getPollyPluginInfo](https://github.com/ziglang/zig/issues/4799)
69or this https://github.com/ziglang/zig/issues/5055, in which case try `-DZIG_WORKAROUND_4799=ON`
70
6971
70Please help upstream LLVM and Homebrew solve this issue, there is nothing Zig72Please help upstream LLVM and Homebrew solve this issue, there is nothing Zig
71can do about it. See that issue for a workaround you can do in the meantime.73can do about it. See that issue for a workaround you can do in the meantime.