天天看点

gnu stubs arch linux,编译Nachos源代码时出错“gnu/stubs-32.h:没有这样的文件或目录”...

问题描述

我想在我的笔记本电脑上安装Nachos,笔记本电脑上有Ubuntu 11.04。

代码在C中,所以要构建它我假设我需要交叉编译器。这就是我的问题所在。我使用命令下载了MIPS交叉编译器的源代码

wget http://mll.csie.ntu.edu.tw/course/os_f08/assignment/mips-decstation.linux-xgcc.gz

我用它解压缩它

tar zxvf mips-decstation.linux-xgcc.gz

这没关系,但是当我尝试构建nachos操作系统的源代码时,使用make,我得到了这个错误 –

/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated. make: *** [bitmap.o] Error 1

最佳解决办法

你错过了32位libc dev包:

在Ubuntu上,它被称为libc6-dev-i386 – 做sudo apt-get install libc6-dev-i386。有关Ubuntu 12.04的其他说明,请参见下文。

在Red Hat发行版中,软件包名称为glibc-devel.i686(感谢David Gardner的评论)。

在CentOS 5.8上,软件包名称为glibc-devel.i386(感谢JimKleck的评论)。

在CentOS 6/7上,软件包名称为glibc-devel.i686。

在SLES上,它被称为glibc-devel-32bit – 做zypper in glibc-devel-32bit。

在Gentoo上它被称为sys-libs/glibc – 做emerge -1a sys-libs/gcc [source](注意:可以使用equery来确认这是正确的;做equery belongs belongs /usr/include/gnu/stubs-32.h)

在ArchLinux上,包名称为lib32-glibc – 执行pacman -S lib32-glibc。

export LIBRARY_PATH=/usr/lib/$(gcc -print-multiarch)

export C_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)

export CPLUS_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)

在构建之前的某个地方(比如你的.bashrc)。

如果您还在编译C++代码,那么您还需要32位stdc ++库。如果您看到此警告:

…. /usr/bin/ld: cannot find -lstdc++ ….

在Ubuntu上,你需要做sudo apt-get install g++-multilib

在CentOS 5上,您需要执行yum install libstdc++-devel.i386

在CentOS 6上,您需要执行yum install libstdc++-devel.i686

请随意在其他系统的软件包中进行编辑。

次佳解决办法

Compiler build fails with fatal error: gnu/stubs-32.h: No such file or directory

This error message shows up on the 64 bit systems where GCC/UPC multilib feature is enabled, and it indicates that 32 bit version of libc is not installed. There are two ways to correct this problem:

Install 32 bit version of glibc (e.g. glibc-devel.i686 on Fedora, CentOS, ..)

Disable ‘multilib’ build by supplying “–disable-multilib” switch on the compiler configuration command

第三种解决办法

尝试做sudo apt-get install libc6-dev。

apt-file告诉我有问题的文件属于该软件包。

第四种办法

第五种办法

我在fedora 18盒子上遇到以下错误:

1. /usr/include/gnu/stubs.h:7:27:致命错误:gnu /stubs-32.h:没有终止此类文件或目录编译。

我安装了glibc.i686和glibc-devel.i686,然后编译失败并出现以下错误:

2. /usr /bin /ld:在搜索-lgcc_s /usr /bin /ld时跳过不兼容的/usr/lib/gcc/x86_64-redhat-linux/4.7.2/libgcc_s.so:找不到-lgcc_s collect2:error:ld返回1退出状态

解:

我安装了(yum install)glibc.i686 glibc-devel.i386和libgcc.i686来摆脱编译问题。

现在编译32位(-m32)工作正常。

参考资料