Last active
April 7, 2017 07:59
-
-
Save simonlynen/627b31610555447ac9d5 to your computer and use it in GitHub Desktop.
clang omp osx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stolen and altered from here: http://stackoverflow.com/questions/20321988/error-enabling-openmp-ld-library-not-found-for-lgomp-and-clang-errors/21789869#21789869 | |
INTEL_OPENMP_LATEST_BUILD_LINK=https://www.openmprtl.org/sites/default/files/libomp_20140926_oss.tgz | |
CLANG_INCLUDE=~/clang_omp/llvm/include | |
CLANG_BIN=~/clang_omp/llvm/build/Release/bin | |
CLANG_LIB=~/clang_omp/llvm/build/Release/lib | |
OPENMP_INCLUDE=~/clang_omp/libomp_oss/exports/common/include | |
OPENMP_LIB=~/clang_omp/libomp_oss/exports/mac_32e/lib.thin | |
cd ~/ | |
mkdir clang_omp | |
cd ~/clang_omp | |
git clone https://github.com/clang-omp/llvm | |
git clone https://github.com/clang-omp/compiler-rt llvm/projects/compiler-rt | |
git clone -b clang-omp https://github.com/clang-omp/clang llvm/tools/clang | |
cd llvm | |
mkdir build | |
cd build | |
../configure --enable-optimized --disable-assertions --enable-libcpp --with-c-include-dirs=/Library/Developer/CommandLineTools/usr/include/c++/v1/:/usr/include/ | |
make -j8 | |
cd Release/bin | |
mv clang clang2 | |
rm -rf clang++ | |
ln -s clang2 clang2++ | |
echo "LLVM+Clang+OpenMP Include Path : " ${CLANG_INCLUDE} | |
echo "LLVM+Clang+OpenMP Bin Path : " ${CLANG_BIN} | |
echo "LLVM+Clang+OpenMP Lib Path : " ${CLANG_LIB} | |
cd ~/clang_omp | |
curl ${INTEL_OPENMP_LATEST_BUILD_LINK} -o libomp_oss_temp.tgz | |
gunzip -c libomp_oss_temp.tgz | tar xopf - | |
rm -rf libomp_oss_temp.tgz | |
cd libomp_oss | |
echo "If you do not have GCC installed (not normal on vanilla Mavericks), you must comment out lines 450-451 in libomp_oss/tools/check-tools.pl. Have you done this or want to compile anyway?" | |
select yn in "Yes" "No"; do | |
case $yn in | |
Yes ) make compiler=clang -j8; break;; | |
No ) exit;; | |
esac | |
done | |
echo "OpenMP Runtime Include Path : " ${OPENMP_INCLUDE} | |
echo "OpenMP Runtime Lib Path : " ${OPENMP_LIB} | |
(echo 'export PATH='${CLANG_BIN}':$PATH'; | |
echo 'export C_INCLUDE_PATH='${CLANG_INCLUDE}':'${OPENMP_INCLUDE}':$C_INCLUDE_PATH'; | |
echo 'export CPLUS_INCLUDE_PATH='${CLANG_INCLUDE}':'${OPENMP_INCLUDE}':$CPLUS_INCLUDE_PATH'; | |
echo 'export LIBRARY_PATH='${CLANG_LIB}':'${OPENMP_LIB}':$LIBRARY_PATH'; | |
echo 'export DYLD_LIBRARY_PATH='${CLANG_LIB}':'${OPENMP_LIB}':$DYLD_LIBRARY_PATH}') >> ~/.profile | |
source ~/.profile | |
echo "LLVM+Clang+OpenMP is now accessible through [ clang2 ] via terminal and does not conflict with Apple's clang" | |
echo "***Copy the content of ~/.profile to your bash profile.****" | |
echo "***You will need to make the symlinks for ccache + clang2 manually***" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment