I tried configure LLVM and Clang and I'm getting the following error:
Related
I'm trying to use clang to make IR for riscv64.
When I use llc --version, it shows many targets including riscv64.
But when I use the following command:
clang -target riscv64 hello.c
clang -target riscv64-unknown-linux hello.c
It shows clang-4.0: error: unknown target triple 'riscv64-unknown-linux', please use -triple or -arch
I'm not using ucb-bar's llvm for riscv. I'm using riscv from upstream of llvm.org.
Did I do something wrong or do I have to do something before building llvm?
Try elf instead of linux.
clang -target riscv32-unknown-elf
clang -target riscv64-unknown-elf
Edit: I created this repo for everyone interested in using RISC-V with LLVM.
I followed the article "Standalone Toolchains" to create seven customized toolchains (armeabi, armeabi-v7a, arm64-v8a, misp, mips64, x86, and x86_64). Then I want to build PROJ.4 library. I know ARM clang toolchain by default targets armeabi-v7a, so in order to target armeabi, I use the following commands:
export CFLAGS="-march=arm -O2"
export CC=~/Android/toolchain/arm/bin/clang
export CXX==~/Android/toolchain/arm/bin/clang++
./configure --host=arm-linux-androideabi
Then I get the errors:
clang38: error: the clang compiler does not support '-march=arm'
If I change CFLAGS to "-march=arm-v7a -O2", there would be no errors. But it targets armeabi-v7a, not armeabi. So what is the value for -march flag targeting armeabi?
Try armv5 instead, as described here:
https://developer.android.com/ndk/guides/abis.html
I intentionally downgraded the clang version I'm compiling with in xcode to a special 3.6 version.
Now I've an error on a flag that was added on a later version of clang
clang-3.6: error: unknown argument: '-gmodules'
Which switch I should disable on Xcode to not add this flag on build ?
I would like to create both the executable and LLVM IR using clang at the same time. Is there a way to do that?
I'm currently using
clang -flto -Wl,-plugin-opt=also-emit-llvm -o foo foo.c
and get the error
clang: error: unknown argument: '-plugin-opt=also-emit-llvm'
with a -v invocation, I see that
/usr/bin/ld: unrecognized option '-plugin'
You can do both quite easily. Take a look at the tool:
https://github.com/SRI-CSL/whole-program-llvm
No matter what I try, any compilation I attempt always calls clang. For example, in CMake, setting CC=/usr/bin/gcc has no effect and clang is still called. In terminal entering any compiler results in clang being called:
~/tinyos-main/tools$ nescc
clang: error: no input files
~/tinyos-main/tools$ gcc
clang: error: no input files
Can I stop this? Running on OS X Yosemite and using home-brew.
~$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
No, gcc is not installed as /usr/bin/gcc. Clang is installed as /usr/bin/gcc, because Apple doesn't ship gcc anymore. If you want gcc, you need to install it (presumably by saying brew install gcc) and then setting CC=/usr/local/bin/gcc.