Skip to content

Commit

Permalink
macOS: use the proper LLVM version
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Jul 9, 2021
1 parent ee60fd5 commit 95fdcac
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
19 changes: 11 additions & 8 deletions INSTALL_MACOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,27 +389,30 @@ config.pri:
```Shell
# copy and paste the following in a terminal
# Get the LLVM version corresponding to your Xcode version, from
# the table at https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
# Here it is LLVM 11 for Xcode 12.5.1
cat > config.pri << EOF
boost: INCLUDEPATH += /usr/local/include
boost: LIBS += -L/usr/local/lib -lboost_serialization-mt -lboost_thread-mt -lboost_system-mt
expat: PKGCONFIG -= expat
expat: INCLUDEPATH += /usr/local/opt/expat/include
expat: LIBS += -L/usr/local/opt/expat/lib -lexpat
macx:openmp {
QMAKE_CC=/usr/local/opt/llvm/bin/clang
QMAKE_CXX=/usr/local/opt/llvm/bin/clang++
QMAKE_CC=/usr/local/opt/llvm@11/bin/clang
QMAKE_CXX=/usr/local/opt/llvm@11/bin/clang++
QMAKE_OBJECTIVE_CC=\$\$QMAKE_CC -stdlib=libc++
QMAKE_LINK=\$\$QMAKE_CXX
LIBS += -L/usr/local/opt/llvm/lib -lomp
LIBS += -L/usr/local/opt/llvm@11/lib -lomp
cc_setting.name = CC
cc_setting.value = /usr/local/opt/llvm/bin/clang
cc_setting.value = /usr/local/opt/llvm@11/bin/clang
cxx_setting.name = CXX
cxx_setting.value = /usr/local/opt/llvm/bin/clang++
cxx_setting.value = /usr/local/opt/llvm@11/bin/clang++
ld_setting.name = LD
ld_setting.value = /usr/local/opt/llvm/bin/clang
ld_setting.value = /usr/local/opt/llvm@11/bin/clang
ldplusplus_setting.name = LDPLUSPLUS
ldplusplus_setting.value = /usr/local/opt/llvm/bin/clang++
ldplusplus_setting.value = /usr/local/opt/llvm@11/bin/clang++
QMAKE_MAC_XCODE_SETTINGS += cc_setting cxx_setting ld_setting ldplusplus_setting
QMAKE_FLAGS = "-B /usr/bin"
Expand Down Expand Up @@ -481,7 +484,7 @@ Then, configure using the following qmake command on MacPorts:
Or on Homebrew:
```Shell
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig qmake -spec macx-xcode CONFIG+=debug CONFIG+=enable-cairo CONFIG+=enable-osmesa CONFIG+=openmp -r QMAKE_CXX='/usr/local/opt/llvm/bin/clang++ -stdlib=libc++' QMAKE_CC=/usr/local/opt/llvm/bin/clang QMAKE_OBJECTIVE_CXX='/usr/local/opt/llvm/bin/clang++ -stdlib=libc++' QMAKE_OBJECTIVE_CC='/usr/local/opt/llvm/bin/clang -stdlib=libc++' QMAKE_LD='/usr/local/opt/llvm/bin/clang++ -stdlib=libc++'
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig qmake -spec macx-xcode CONFIG+=debug CONFIG+=enable-cairo CONFIG+=enable-osmesa CONFIG+=openmp -r QMAKE_CXX='/usr/local/opt/llvm@11/bin/clang++ -stdlib=libc++' QMAKE_CC=/usr/local/opt/llvm@11/bin/clang QMAKE_OBJECTIVE_CXX='/usr/local/opt/llvm@11/bin/clang++ -stdlib=libc++' QMAKE_OBJECTIVE_CC='/usr/local/opt/llvm@11/bin/clang -stdlib=libc++' QMAKE_LD='/usr/local/opt/llvm@11/bin/clang++ -stdlib=libc++'
```
To build the plugins, use the following command-line:
Expand Down
4 changes: 2 additions & 2 deletions Project.pro
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ addresssanitizer {
message(" qmake QMAKE_CC=clang-mp-5.0 QMAKE_CXX='clang++-mp-5.0 -stdlib=libc++' QMAKE_LINK='clang++-mp-5.0 -stdlib=libc++' QMAKE_OBJECTIVE_CC='clang-mp-5.0 -stdlib=libc++' QMAKE_OBJECTIVE_CXX='clang++-mp-5.0 -stdlib=libc++' CONFIG+=addresssanitizer ...")
message("- with homebrew:")
message(" brew install llvm")
message(" export ASAN_SYMBOLIZER_PATH=/usr/local/opt/llvm/bin/llvm-symbolizer")
message(" qmake QMAKE_CC=/usr/local/opt/llvm/bin/clang QMAKE_CXX='/usr/local/opt/llvm/bin/clang++ -stdlib=libc++' QMAKE_LINK='/usr/local/opt/llvm/bin/clang++ -stdlib=libc++' QMAKE_OBJECTIVE_CC='/usr/local/opt/llvm/bin/clang -stdlib=libc++' QMAKE_OBJECTIVE_CXX='/usr/local/opt/llvm/bin/clang++ -stdlib=libc++' CONFIG+=addresssanitizer ...")
message(" export ASAN_SYMBOLIZER_PATH=/usr/local/opt/llvm@11/bin/llvm-symbolizer")
message(" qmake QMAKE_CC=/usr/local/opt/llvm@11/bin/clang QMAKE_CXX='/usr/local/opt/llvm@11/bin/clang++ -stdlib=libc++' QMAKE_LINK='/usr/local/opt/llvm@11/bin/clang++ -stdlib=libc++' QMAKE_OBJECTIVE_CC='/usr/local/opt/llvm@11/bin/clang -stdlib=libc++' QMAKE_OBJECTIVE_CXX='/usr/local/opt/llvm@11/bin/clang++ -stdlib=libc++' CONFIG+=addresssanitizer ...")
message("see http://clang.llvm.org/docs/AddressSanitizer.html")
}
}
8 changes: 4 additions & 4 deletions tools/buildmaster/compiler-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [ "$PKGOS" = "OSX" ]; then
fi
fi
# clang path on homebrew (should always be the latest version)
if command -v /usr/local/opt/llvm/bin/clang >/dev/null 2>&1; then
if command -v /usr/local/opt/llvm@11/bin/clang >/dev/null 2>&1; then
COMPILER=clang-omp
fi
#COMPILER=clang-omp
Expand Down Expand Up @@ -67,9 +67,9 @@ if [ "$PKGOS" = "OSX" ]; then
elif command -v clang-mp-4.0 >/dev/null 2>&1; then
CC=clang-mp-4.0
CXX="clang++-mp-4.0 -stdlib=libc++ -std=c++11"
elif command -v /usr/local/opt/llvm/bin/clang >/dev/null 2>&1; then
CC=/usr/local/opt/llvm/bin/clang
CXX="/usr/local/opt/llvm/bin/clang++ -std=c++11"
elif command -v /usr/local/opt/llvm@11/bin/clang >/dev/null 2>&1; then
CC=/usr/local/opt/llvm@11/bin/clang
CXX="/usr/local/opt/llvm@11/bin/clang++ -std=c++11"
fi
# clang > 7.0 sometimes chokes on building Universal CImg.ofx, probably because of #pragma omp atomic
#Undefined symbols for architecture i386:
Expand Down
8 changes: 4 additions & 4 deletions tools/jenkins/compiler-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [ "$PKGOS" = "OSX" ]; then
fi
fi
# clang path on homebrew (should always be the latest version)
if command -v /usr/local/opt/llvm/bin/clang >/dev/null 2>&1; then
if command -v /usr/local/opt/llvm@11/bin/clang >/dev/null 2>&1; then
COMPILER=clang-omp
fi
#COMPILER=clang-omp
Expand Down Expand Up @@ -68,9 +68,9 @@ if [ "$PKGOS" = "OSX" ]; then
elif command -v clang-mp-4.0 >/dev/null 2>&1; then
CC=clang-mp-4.0
CXX="clang++-mp-4.0 -stdlib=libc++ -std=c++11"
elif command -v /usr/local/opt/llvm/bin/clang >/dev/null 2>&1; then
CC=/usr/local/opt/llvm/bin/clang
CXX="/usr/local/opt/llvm/bin/clang++ -std=c++11"
elif command -v /usr/local/opt/llvm@11/bin/clang >/dev/null 2>&1; then
CC=/usr/local/opt/llvm@11/bin/clang
CXX="/usr/local/opt/llvm@11/bin/clang++ -std=c++11"
fi
# clang > 7.0 sometimes chokes on building Universal CImg.ofx, probably because of #pragma omp atomic
#Undefined symbols for architecture i386:
Expand Down

0 comments on commit 95fdcac

Please sign in to comment.