错误“gnu/stubs-32.h:没有这样的文件或目录"在编译 Nachos 源代码时 [英] Error "gnu/stubs-32.h: No such file or directory" while compiling Nachos source code
问题描述
我正在尝试在我的笔记本电脑上安装 Nachos,而我在笔记本电脑上安装了 Ubuntu 11.04.
I am trying to install Nachos on my laptop and I have Ubuntu 11.04 on the laptop.
代码是用 C 语言编写的,所以为了构建它,我假设我需要交叉编译器.这就是我的问题所在.我使用命令
The code is in C and so to build it I assume I will need cross compiler. This is where my problem is. I downloaded the source code of the MIPS cross compiler using the command
wget http://mll.csie.ntu.edu.tw/course/os_f08/assignment/mips-decstation.linux-xgcc.gz
然后我用
tar zxvf mips-decstation.linux-xgcc.gz
这没问题,但是当我尝试使用 make 构建玉米片操作系统的源代码时,出现此错误 -
This is okay, but when I try to build the source code of the nachos os, using make, I get this error -
/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
我正在尝试按照此处给出的说明进行操作 - http://mll.csie.ntu.edu.tw/course/os_f08/217.htm 一切正常,除非我尝试使用 make.
I am trying to follow the instructions given over here - http://mll.csie.ntu.edu.tw/course/os_f08/217.htm and everything is working fine except when I try to use make.
推荐答案
您缺少 32 位 libc 开发包:
You're missing the 32 bit libc dev package:
在 Ubuntu 上,它被称为 libc6-dev-i386 - 执行 sudo apt-get install libc6-dev-i386
.有关 Ubuntu 12.04 的额外说明,请参见下文.
On Ubuntu it's called libc6-dev-i386 - do sudo apt-get install libc6-dev-i386
. See below for extra instructions for Ubuntu 12.04.
在 Red Hat 发行版上,包名称是 glibc-devel.i686
(感谢 David Gardner 的评论).
On Red Hat distros, the package name is glibc-devel.i686
(Thanks to David Gardner's comment).
在 CentOS 5.8 上,包名是 glibc-devel.i386
(感谢 JimKleck 的评论).
On CentOS 5.8, the package name is glibc-devel.i386
(Thanks to JimKleck's comment).
在 CentOS 6/7 上,包名称为 glibc-devel.i686
.
On CentOS 6 / 7, the package name is glibc-devel.i686
.
在 SLES 上,它被称为 glibc-devel-32bit - 在 glibc-devel-32bit 中执行 zypper
.
On SLES it's called glibc-devel-32bit - do zypper in glibc-devel-32bit
.
在 Gentoo 上它被称为 sys-libs/glibc
- do emerge -1a sys-libs/gcc
[source](注意:可以使用 equery
确认这是正确的;做equery属于/usr/include/gnu/stubs-32.h
)
On Gentoo it's called sys-libs/glibc
- do emerge -1a sys-libs/gcc
[source] (Note : One may use equery
to confirm this is correct; do equery belongs belongs /usr/include/gnu/stubs-32.h
)
在ArchLinux上,包名是lib32-glibc
- do pacman -S lib32-glibc
.
On ArchLinux, the package name is lib32-glibc
- do pacman -S lib32-glibc
.
您使用的是 Ubuntu 12.04 吗?一个已知问题,将文件放在非标准位置.您还需要:
Are you using Ubuntu 12.04? There is a known problem that puts the files in a non standard location. You'll also need to do:
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 中).
somewhere before you build (say in your .bashrc).
如果您还编译 C++ 代码,则还需要 32 位 stdc++ 库.如果您看到此警告:
If you are also compiling C++ code, you will also need the 32 bit stdc++ library. If you see this warning:
..../usr/bin/ld: 找不到 -lstdc++ ....
.... /usr/bin/ld: cannot find -lstdc++ ....
在 Ubuntu 上,您需要执行 sudo apt-get install g++-multilib
On Ubuntu you will need to do sudo apt-get install g++-multilib
在 CentOS 5 上,您需要 yum install libstdc++-devel.i386
在 CentOS 6 上,您需要 yum install libstdc++-devel.i686
请随时在其他系统的软件包中进行编辑.
Please feel free to edit in the packages for other systems.
这篇关于错误“gnu/stubs-32.h:没有这样的文件或目录"在编译 Nachos 源代码时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!