我正在尝试让llvm-gcc 4.2.2.9在运行3.0.0-21-通用内核的x86_64系统上进行编译。 llvm 2.9本身可以很好地构建。我怀疑llvm-gcc的可下载版本引起了其他问题,因此我决定自己构建llvm-gcc。
就像我配置的README.LLVM
中建议的那样
../llvm-gcc-4.2-2.9.source/configure \
--prefix=/opt/llvm-gcc4.2-2.9/../llvm-gcc4.2-2.9-install \
--disable-multilib \
--program-prefix=llvm- \
--enable-llvm=/opt/llvm-2.9 \
--host=x86_64-generic-linux-gnu
--enable-languages=c,c++
/opt/llvm-gcc4.2-2.9
目录中运行它,而源代码位于/opt/llvm-gcc-4.2-2.9.source
中,而我的llvm 2.9则位于/opt/llvm-2.9
中。请注意,我设置的是--host
而不是--target
,因为这隐式地将--target
设置为相同的体系结构。make
确实构建了很多东西(产生大量警告):make[3]: Entering directory `/opt/llvm-gcc4.2-2.9/gcc'
/opt/llvm-gcc4.2-2.9/./gcc/xgcc -B/opt/llvm-gcc4.2-2.9/./gcc/ -B/opt/llvm-gcc4.2-2.9/../llvm-gcc4.2-2.9-install/x86_64-generic-linux-gnu/bin/ -B/opt/llvm-gcc4.2-2.9/../llvm-gcc4.2-2.9-install/x86_64-generic-linux-gnu/lib/ -isystem /opt/llvm-gcc4.2-2.9/../llvm-gcc4.2-2.9-install/x86_64-generic-linux-gnu/include -isystem /opt/llvm-gcc4.2-2.9/../llvm-gcc4.2-2.9-install/x86_64-generic-linux-gnu/sys-include -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -I. -I. -I../../llvm-gcc-4.2-2.9.source/gcc -I../../llvm-gcc-4.2-2.9.source/gcc/. -I../../llvm-gcc-4.2-2.9.source/gcc/../include -I../../llvm-gcc-4.2-2.9.source/gcc/../libcpp/include -I../../llvm-gcc-4.2-2.9.source/gcc/../libdecnumber -I../libdecnumber -I/opt/llvm-2.9/include -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-omit-frame-pointer -fno-asynchronous-unwind-tables \
-c ../../llvm-gcc-4.2-2.9.source/gcc/crtstuff.c -DCRT_BEGIN \
-o crtbegin.o
In file included from /usr/include/stdio.h:28,
from ../../llvm-gcc-4.2-2.9.source/gcc/tsystem.h:90,
from ../../llvm-gcc-4.2-2.9.source/gcc/crtstuff.c:68:
/usr/include/features.h:323:26: error: bits/predefs.h: No such file or directory
/usr/include/features.h:356:25: error: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: error: gnu/stubs.h: No such file or directory
stdio.h
返回llvm-gcc
header ,然后再次尝试包含系统 header ,这有点奇怪。但这也许是正常的吗?最佳答案
您的系统上的/usr/include似乎提供了32位 header ,因此编译失败,因为您没有安装所有的multilib header 。您可能需要以与分发补丁gcc相同的方式来修补llvm-gcc,以查找 header 位置。
或者,您可以尝试安装32位 header 并尝试llvm-gcc的multilib构建。
但是最好的方法是切换到LLVM 3.1和clang :)
https://stackoverflow.com/questions/11064540/