[cfe-users] Clang buil problem
Bill Liao
lwlw1988 at gmail.com
Thu Dec 27 04:41:34 PST 2012
I built llvm with clang on my machine. But it's not working.
For clang to build c program,
$ cat > t.c <<EOF
$ typedef float V __attribute__((vector_size(16)));
$ V foo(V a, V b) { return a+b*a; }
$ EOF
$ clang -v t.c
---------------------------------------------------
clang version 3.3 (trunk 169698)
Target: x86_64-unknown-linux-gnu
Thread model: posix
"/usr/local/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -main-file-name t.c -mrelocation-model static
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -v -resource-dir
/usr/local/bin/../lib/clang/3.3 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/local/include
-internal-isystem /usr/local/bin/../lib/clang/3.3/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/waliao/Fiddle/LLVM/tutor -ferror-limit 19
-fmessage-length 149 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/t-LRUTOA.o -x c t.c
clang -cc1 version 3.3 based upon LLVM 3.3svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/bin/../lib/clang/3.3/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
"/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -o a.out
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.7
-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../.. -L/lib -L/usr/lib
/tmp/t-LRUTOA.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
------------------------------------------
So I have to explicitly add `clang t.c -L
/usr/lib/gcc/x86_64-linux-gnu/4.6/` to get it built.
And for c++ programs,
--------------------------------
$ clang++ parser.cpp -v
clang version 3.3 (trunk 169698)
Target: x86_64-unknown-linux-gnu
Thread model: posix
"/usr/local/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -main-file-name parser.cpp -mrelocation-model
static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -v -resource-dir
/usr/local/bin/../lib/clang/3.3 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++ -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.3/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/waliao/Fiddle/LLVM/tutor -ferror-limit 19
-fmessage-length 149 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/parser-gkc4A6.o -x c++ parser.cpp
clang -cc1 version 3.3 based upon LLVM 3.3svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/backward"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++
/usr/local/include
/usr/local/bin/../lib/clang/3.3/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
parser.cpp:1:10: fatal error: 'cstdio' file not found
#include <cstdio>
^
1 error generated.
----------------------------------------------------
I know the search path is weird, but dont know how to fix this.
And help is appreciated.
regards
wliao <lwlw1988 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20121227/e25f72fc/attachment.html>
More information about the cfe-users
mailing list