错误“gnu/stubs-32.h:没有这样的文件或目录”编译 Nachos 源代码时
我正在尝试在我的笔记本电脑上安装 Nachos,并且笔记本电脑上有 Ubuntu 11.04。
代码是用 C 语言编写的,因此为了构建它,我假设我需要交叉编译器。这就是我的问题所在。我使用命令下载了 MIPS 交叉编译器的源代码
wget http://mll.csie.ntu.edu.tw/course/os_f08/assignment/mips-decstation.linux-xgcc.gz
,并使用 This 解压缩它
tar zxvf mips-decstation.linux-xgcc.gz
,但是当我尝试使用 make 构建 nachos 操作系统的源代码时,我收到此错误 -
/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 install Nachos on my laptop and I have Ubuntu 11.04 on the laptop.
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
and I unzipped it using
tar zxvf mips-decstation.linux-xgcc.gz
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
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(13)
您缺少 32 位 libc 开发包:
在 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 - do
zypper in glibc-devel-32bit
。在 Gentoo 上,它被称为
sys-libs/glibc
- doemerge -1a sys-libs/gcc
[来源](注意:可以使用
equery
确认这是正确的;执行equery 属于 /usr/include/gnu/stubs-32.h
)在 ArchLinux 上,包名称为
lib32-glibc
- 执行pacman -S lib32-glibc
。您使用的是Ubuntu 12.04吗? 一个已知问题会将文件放在非标准位置。您还需要做:
在构建之前的某个地方(在你的 .bashrc 中说)。
如果您还编译 C++ 代码,则还需要 32 位 stdc++ 库。如果您看到此警告:
在 Ubuntu 上,您需要执行
sudo apt-get install g++-multilib
On <在 CentOS 5 上,您需要执行 yum install libstdc++-devel.i386
在 CentOS 6 上,您需要执行 yum install libstdc++-devel.i686
请随意在其他系统的包中进行编辑。
You're missing the 32 bit libc dev package:
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.On Red Hat distros, the package name is
glibc-devel.i686
(Thanks to David Gardner's comment).On CentOS 5.8, the package name is
glibc-devel.i386
(Thanks to JimKleck's comment).On CentOS 6 / 7, the package name is
glibc-devel.i686
.On SLES it's called glibc-devel-32bit - do
zypper in glibc-devel-32bit
.On Gentoo it's called
sys-libs/glibc
- doemerge -1a sys-libs/gcc
[source] (Note : One may use
equery
to confirm this is correct; doequery belongs belongs /usr/include/gnu/stubs-32.h
)On ArchLinux, the package name is
lib32-glibc
- dopacman -S lib32-glibc
.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:
somewhere before you build (say in your .bashrc).
If you are also compiling C++ code, you will also need the 32 bit stdc++ library. If you see this warning:
On Ubuntu you will need to do
sudo apt-get install g++-multilib
On CentOS 5 you will need to do
yum install libstdc++-devel.i386
On CentOS 6 you will need to do
yum install libstdc++-devel.i686
Please feel free to edit in the packages for other systems.
来自 GNU UPC 网站:
From the GNU UPC website:
尝试执行
sudo apt-get install libc6-dev
。apt-file 告诉我有问题的文件属于该包。
Try doing a
sudo apt-get install libc6-dev
.apt-file
tells me that the file in question belongs to that package.这现在位于 GCC wiki 常见问题解答中,请参阅 http://gcc.gnu.org /wiki/FAQ#gnu_stubs-32.h
This is now in the GCC wiki FAQ, see http://gcc.gnu.org/wiki/FAQ#gnu_stubs-32.h
嗯,我在 ubuntu 12.04 上,在尝试编译 gcc 4.7.2 时遇到了同样的错误
我尝试安装 libc6-dev-i386 包并得到以下信息:
我还设置了正确的环境变量在 bash 中:
但是,我仍然收到错误,然后我只是将
stubs-32.h
复制到 gcc 期望在快速比较后找到它的位置:现在编译,让我们看看它是否会抱怨更多......
Hmm well I am on ubuntu 12.04 and I got this same error when trying to compile gcc 4.7.2
I tried installing the
libc6-dev-i386
package and got the following:I also set the correct environment variables in bash:
however, I was still getting the error then I simply copied
stubs-32.h
over to where gcc was expecting to find it after doing a quick diff:It's compiling now, let's see if it complains more ...
我在 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/lib/gcc/x86_64-redhat-linux/4.7.2/libgcc_s.so
/usr/bin/ld: 找不到 -lgcc_s
collect2: error: ld returned 1 exit status
解决方案:
我安装了(yum install)glibc.i686 glibc-devel.i386 和 libgcc.i686 以解决编译问题。
现在 32 位 (-m32) 的编译工作正常。
I was getting following error on a fedora 18 box:
1.
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated.
I Installed glibc.i686 and glibc-devel.i686, then compilation failed with following error:
2.
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.7.2/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
Solution:
I installed (yum install) glibc.i686 glibc-devel.i386 and libgcc.i686 to get rid of the compilation issue.
Now compilation for 32 bit (-m32) works fine.
FWIW,交叉编译时使用 /usr/include 中的文件闻起来像是一个错误(或者至少是未来痛苦的潜在来源)。
FWIW, it smells like an error (or at least a potential source of future pain) to be using files from /usr/include when cross-compiling.
gnu/stubs-32.h
不直接包含在程序中。它是gnu/stubs.h
的后端类型头文件,就像gnu/stubs-64.h
一样。您可以安装multilib
软件包来添加两者。gnu/stubs-32.h
is not directed included in programms. It's a back-end type header file ofgnu/stubs.h
, just likegnu/stubs-64.h
. You can install themultilib
package to add both.# sudo apt-get install g++-multilib
应该在 64 位计算机 (Debian/Ubuntu) 上修复此错误。
# sudo apt-get install g++-multilib
Should fix this error on 64-bit machines (Debian/Ubuntu).
如果您在使用 python 的 Mac-OSX 终端中遇到此问题,请尝试更新您正在使用的软件包的版本。因此,转到 python 中的文件以及指定包的位置,将它们更新到互联网上可用的最新版本。
If you are facing this issue in Mac-OSX terminal with python, try updating the versions of the packages you are using. So, go to your files in python and where you specified the packages, update them to the latest versions available on the internet.
在 Debian/Ubuntu 上使用:
sudo apt-get install g++-multilib libc6-dev-i386
On Debian/Ubuntu use:
sudo apt-get install g++-multilib libc6-dev-i386
如果你和我一样使用 Arch Linux。您可以尝试
它对我有用。
If you are on Arch Linux like me. You can try
It worked for me.
你好,我遇到了同样的问题。当我在 MAKEFILE 中添加“-D__TARGET_ARCH_x86”时,它起作用了!
错误信息如下:
从stubs.h中的内容
可以看出,真正的原因是缺少宏定义x86_64。编译器必须找到stubs-x32.h。所以你可以安装32位的glibc来解决这个问题。但更好的方法是将 arch 指定为 64 位。只需在 MAKEFILE 中的 gcc&g++ 命令中添加 '-D__TARGET_ARCH_x86' 即可。
Hi,I encountered the same question. When I add '-D__TARGET_ARCH_x86' in MAKEFILE, it worked!
The the error message is like:
The content in stubs.h is
you could find the real reason is the missing of macro definition x86_64. The compilor has to find stubs-x32.h. So you can install glibc with 32bits to solve the question. But the better way is to specific the arch as 64bits。You only need to add '-D__TARGET_ARCH_x86' in gcc&g++ command in MAKEFILE.