编译LLVM2.9';使用GCC4.6在内核3.0上安装GCC4.2

编译LLVM2.9';使用GCC4.6在内核3.0上安装GCC4.2,gcc,compiler-errors,linux-kernel,llvm,llvm-gcc,Gcc,Compiler Errors,Linux Kernel,Llvm,Llvm Gcc,我试图在这个运行3.0.0-21通用内核的x86_64系统上编译。LLVM2.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

我试图在这个运行3.0.0-21通用内核的x86_64系统上编译。LLVM2.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。源代码和我的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
我觉得有点奇怪,include路径从系统的
stdio.h
返回到
llvm gcc
头,然后再次尝试包含系统头。但也许这很正常

在这个错误之后,同一个编译单元会出现数百行带有更多错误的代码

可能是因为我的系统的GCC4.6.1或我的系统头与过时的llvm GCC4.2头不兼容吗?另外,我知道在另一个系统(运行2.6内核)上,GCC4.5.2与LLVM2.7的GCC4.2配合得很好


我在这里不知所措,因为我确实需要一个最新的llvm 2.*,而其他两个可接受的llvm版本(2.7、2.8)没有显示任何更有用的结果。

您的系统上的/usr/include似乎提供了32位头,因此编译失败,因为您没有安装所有的多库头。您可能需要使用与发行版补丁gcc相同的方法来修补llvm gcc,以便找到标题位置

或者,您可以尝试安装32位头并尝试llvm gcc的多库构建


但是最好的方法是切换到LLVM 3.1和clang:)

也许是个愚蠢的问题,但是你用clang尝试过LLVM-3.0或LLVM-3.1吗?@honk:我没有。主要是因为我不会使用llvm>=3.0。我需要LLVMGCC和LLVM2.9(或8或7)。