Skip to content

Commit 1afa2ca

Browse files
committed
Fix CI build break on Mac with LLVM 10.0.1 (#1245)
There's a bug in the current Homebrew llvm 10.0.1 where it fails to link because of missing libxml2.tbd. It's fixed upstream in LLVM, but not yet fixed in Homebrew. Hopefully a subsequent 10.0.x or 11.x will fix it, but for now, just fall back to llvm@9. Also issue a warning in the build scripts if this condition is detected, so if a user encounters it on their system, they have a hint about how to address it. Signed-off-by: Larry Gritz <[email protected]>
1 parent c5b2afa commit 1afa2ca

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,20 @@ jobs:
242242
CMAKE_CXX_STANDARD: 14
243243
PYTHON_VERSION: 3.8
244244
LLVM_BC_GENERATOR: /usr/bin/clang++
245+
LLVMBREWVER: "@9"
246+
# ^^ There's a bug in the current Homebrew llvm 10.0.1 where
247+
# it fails to link because of missing libxml2.tbd. It's fixed
248+
# upstream in LLVM, but not yet fixed in Homebrew. Hopefully
249+
# a subsequent 10.0.x or 11.x will fix it, but for now, just
250+
# fall back to llvm@9.
245251
MY_CMAKE_FLAGS: -DLLVM_BC_GENERATOR=/usr/bin/clang++
246252
# ^^ Force bitcode compiles to use the system clang compiler by
247253
# preemptively telling it the LLVM_BC_GENERATOR, to avoid some
248254
# library mismatches we tend to see on GH CI's Mac images.
249255
run: |
250256
source src/build-scripts/ci-startup.bash
251257
source src/build-scripts/install_homebrew_deps.bash
258+
brew uninstall llvm
252259
OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0"
253260
source src/build-scripts/build_openimageio.bash
254261
source src/build-scripts/ci-build-and-test.bash

src/build-scripts/install_homebrew_deps.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ fi
5656
export PATH=/usr/local/opt/qt5/bin:$PATH
5757
export PATH=/usr/local/opt/python/libexec/bin:$PATH
5858
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
59-
export PATH=/usr/local/opt/llvm/bin:$PATH
59+
export PATH=/usr/local/opt/llvm${LLVMBREWVER}/bin:$PATH
60+
export LLVM_DIRECTORY=/usr/local/opt/llvm${LLVMBREWVER}
61+
export LLVM_ROOT=/usr/local/opt/llvm${LLVMBREWVER}

src/cmake/externalpackages.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ if (LLVM_VERSION VERSION_GREATER_EQUAL 10.0.0 AND
255255
"icc >= 7, MSVS >= 2017. "
256256
"If you must use C++11, you need to build against LLVM 9 or earlier.")
257257
endif ()
258+
if (APPLE AND LLVM_VERSION VERSION_EQUAL 10.0.1 AND EXISTS "/usr/local/Cellar/llvm")
259+
message (WARNING
260+
"${ColorYellow}If you are using LLVM 10.0.1 installed by Homebrew, "
261+
"please note that a known bug in LLVM may produce a link error where "
262+
"it says it can't find libxml2.tbd. If you encounter this, please "
263+
"try downgrading to LLVM 9: \n"
264+
" brew uninstall llvm \n"
265+
" brew install llvm@9 \n"
266+
" export LLVM_DIRECTORY=/usr/local/opt/llvm@9 "
267+
"${ColorReset}\n")
268+
endif ()
258269

259270
checked_find_package (partio)
260271

0 commit comments

Comments
 (0)