Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

ubuntu - Error "gnu/stubs-32.h: No such file or directory" while compiling Nachos source code

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.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...