Last active
August 29, 2015 14:05
-
-
Save palmerc/59115c29aa5703f669fc to your computer and use it in GitHub Desktop.
Download, compile LLVM and OpenMP Runtime for Mac
This file contains hidden or 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
INTEL_OPENMP_LATEST_BUILD_LINK=https://www.openmprtl.org/sites/default/files/libomp_20131209_oss.tgz | |
CLANG_INCLUDE=~/code/llvm/include | |
CLANG_BIN=~/code/llvm/build/Debug+Asserts/bin | |
CLANG_LIB=~/code/llvm/build/Debug+Asserts/lib | |
OPENMP_INCLUDE=~/code/libomp_oss/exports/common/include | |
OPENMP_LIB=~/code/libomp_oss/exports/mac_32e/lib.thin | |
cd ~/ | |
mkdir code | |
cd ~/code | |
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 | |
make | |
cd Debug+Asserts/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 ~/code | |
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; 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 | |
echo "LLVM+Clang+OpenMP is now accessible through [ clang2 ] via terminal and does not conflict with Apple's clang" |
I have this error when compiling the test program
/tmp/test.cpp:1:10: fatal error: 'cmath' file not found
include
^
#include <cmath>
int main()
{
const int size = 256;
double sinTable[size];
#pragma omp parallel for
for(int n=0; n<size; ++n)
sinTable[n] = std::sin(2 * M_PI * n / size);
// the table is now initialized
}
I think the line number changed. As of today, I believe the line in makefile.mk that needs to be commented out is 447:
ifeq "$(ld)" "icc"
#ld-flags += -no-intel-extensions
endif
Correct me if I'm wrong! (Too late for me but for others maybe.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed to add
export LIBOMP_WORK=~/code/libomp_oss
to avoid error:
No rule to make target `../../src/makefile.mk'. Stop
while running "make compiler=clang".
Also needed to comment out line 433 of src/makefile.mk to remove -no-intel-extensions as noted on stackoverflow