I need to use older version of LLVM on my Mac OS 10.12, namely 3.7 because it is required by ghc
.
I have installed it via: brew install [email protected]
.
Now I am getting the <stdin>:1:10: fatal error: 'math.h' file not found
error when I do even the simplest thing:
echo '#include <math.h>' | clang-3.7 -xc -v -
Real code that produces this error is my attempt to run ghc -fllvm
on a simple helloworld.hs code which I want to get as LLVM bitcode.
I have done:
$ find /usr/local/Cellar/llvm\@3.7 | grep math
/usr/local/Cellar/[email protected]/3.7.1/lib/llvm-3.7/include/c++/v1/cmath
/usr/local/Cellar/[email protected]/3.7.1/lib/llvm-3.7/include/c++/v1/ctgmath
/usr/local/Cellar/[email protected]/3.7.1/lib/llvm-3.7/include/c++/v1/tgmath.h
/usr/local/Cellar/[email protected]/3.7.1/lib/llvm-3.7/lib/clang/3.7.1/include/tgmath.h
I am seeing that there is no any math.h
headers.
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
What am I missing?
I have realized what was my mistake: I should have looked missing math.h
in C headers, not C++ headers.
Adding either of the following to the C compiler flags in /usr/local/Cellar/ghc/8.0.2/lib/ghc-8.0.2/settings
fixes the problem:
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
or
-idirafter /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With