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

发布于 2024-12-04 08:58:48 字数 733 浏览 0 评论 0原文

我正在尝试在我的笔记本电脑上安装 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

猫九 2024-12-11 08:58:48

您缺少 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 - do emerge -1a sys-libs/gcc
[来源](注意:可以使用equery确认这是正确的;执行 equery 属于 /usr/include/gnu/stubs-32.h)

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


您使用的是Ubuntu 12.04吗? 一个已知问题会将文件放在非标准位置。您需要做:

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: 找不到 -lstdc++ ....

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 - 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)

On ArchLinux, the package name is lib32-glibc - do pacman -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:

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)

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:

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

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.

没︽人懂的悲伤 2024-12-11 08:58:48

来自 GNU UPC 网站

编译器构建失败并出现致命错误:gnu/stubs-32.h:没有这样的文件或
目录

此错误消息显示在 GCC/UPC 的 64 位系统上
multilib 功能已启用,表示 32 位版本
libc 未安装。有两种方法可以解决此问题:

  • 安装 32 位版本的 glibc(例如 Fedora 上的 glibc-devel.i686,
    CentOS,..)
  • 通过提供“--disable-multilib”禁用“multilib”构建
    打开编译器配置命令

From the GNU UPC website:

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
若言繁花未落 2024-12-11 08:58:48

尝试执行 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.

南汐寒笙箫 2024-12-11 08:58:48

这现在位于 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

-小熊_ 2024-12-11 08:58:48

嗯,我在 ubuntu 12.04 上,在尝试编译 gcc 4.7.2 时遇到了同样的错误

我尝试安装 libc6-dev-i386 包并得到以下信息:

Package libc6-dev-i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libc6-dev-i386' has no installation candidate

我还设置了正确的环境变量在 bash 中:

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)

但是,我仍然收到错误,然后我只是将 stubs-32.h 复制到 gcc 期望在快速比较后找到它的位置

vic@ubuntu:/usr/include/i386-linux-gnu/gnu$ diff ../../gnu ./
Only in ./: stubs-32.h
Only in ../../gnu: stubs-64.h
vic@ubuntu:/usr/include/i386-linux-gnu/gnu$ sudo cp stubs-32.h ../../gnu/
[sudo] password for vic: 
vic@ubuntu:/usr/include/i386-linux-gnu/gnu$ diff ../../gnu ./
Only in ../../gnu: stubs-64.h
vic@ubuntu:/usr/include/i386-linux-gnu/gnu$

:现在编译,让我们看看它是否会抱怨更多......

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:

Package libc6-dev-i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libc6-dev-i386' has no installation candidate

I also set the correct environment variables in bash:

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)

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:

vic@ubuntu:/usr/include/i386-linux-gnu/gnu$ diff ../../gnu ./
Only in ./: stubs-32.h
Only in ../../gnu: stubs-64.h
vic@ubuntu:/usr/include/i386-linux-gnu/gnu$ sudo cp stubs-32.h ../../gnu/
[sudo] password for vic: 
vic@ubuntu:/usr/include/i386-linux-gnu/gnu$ diff ../../gnu ./
Only in ../../gnu: stubs-64.h
vic@ubuntu:/usr/include/i386-linux-gnu/gnu$

It's compiling now, let's see if it complains more ...

叫思念不要吵 2024-12-11 08:58:48

我在 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.

贪了杯 2024-12-11 08:58:48

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.

赠意 2024-12-11 08:58:48

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 of gnu/stubs.h, just like gnu/stubs-64.h. You can install the multilib package to add both.

淤浪 2024-12-11 08:58:48

# 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).

毁梦 2024-12-11 08:58:48

如果您在使用 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.

帅气称霸 2024-12-11 08:58:48

在 Debian/Ubuntu 上使用:

sudo apt-get install g++-multilib libc6-dev-i386

On Debian/Ubuntu use:

sudo apt-get install g++-multilib libc6-dev-i386

水波映月 2024-12-11 08:58:48

如果你和我一样使用 Arch Linux。您可以尝试

  • sudo pacman -S lib32-gcc-libs

它对我有用。

If you are on Arch Linux like me. You can try

  • sudo pacman -S lib32-gcc-libs

It worked for me.

泅渡 2024-12-11 08:58:48

你好,我遇到了同样的问题。当我在 MAKEFILE 中添加“-D__TARGET_ARCH_x86”时,它起作用了!

错误信息如下:

In file included from /usr/include/string.h:26:
In file included from /usr/include/bits/libc-header-start.h:33:
In file included from /usr/include/features.h:452:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
# include <gnu/stubs-32.h>nter code here

从stubs.h中的内容

#if !defined __x86_64__
# include <gnu/stubs-32.h>
#endif
#if defined __x86_64__ && defined __LP64__
# include <gnu/stubs-64.h>
#endif
#if defined __x86_64__ && defined __ILP32__
# include <gnu/stubs-x32.h>
#endif

可以看出,真正的原因是缺少宏定义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:

In file included from /usr/include/string.h:26:
In file included from /usr/include/bits/libc-header-start.h:33:
In file included from /usr/include/features.h:452:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
# include <gnu/stubs-32.h>nter code here

The content in stubs.h is

#if !defined __x86_64__
# include <gnu/stubs-32.h>
#endif
#if defined __x86_64__ && defined __LP64__
# include <gnu/stubs-64.h>
#endif
#if defined __x86_64__ && defined __ILP32__
# include <gnu/stubs-x32.h>
#endif

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文