我正在尝试在运行3.0.0-21通用内核的x86_64系统上编译llvm-gcc 4.2.2.9。 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
标头然后再次尝试包含系统标头有点奇怪。但也许这是正常的?
在此错误之后,数百行有更多错误的行会从同一个编译单元中跟随。
可能是我的系统的gcc 4.6.1或我的系统的标题可能与过时的llvm-gcc 4.2标题不兼容?然后,我知道在不同的系统上(运行2.6内核)gcc 4.5.2与llvm 2.7的gcc 4.2一起运行良好。
我在这里不知所措,因为我确实需要最近的llvm 2. *,另外两个可接受的llvm版本(2.7,2.8)没有显示任何更有帮助的结果。
答案 0 :(得分:0)
您的系统上的/ usr / include似乎提供了32位标头,因此编译失败,因为您没有安装所有multilib标头。您可能需要以与分发补丁gcc相同的方式修补llvm-gcc,以便找到标题位置。
或者,您可以尝试安装32位标头并尝试llvm-gcc的multilib构建。
但最好的方法是切换到LLVM 3.1和clang:)