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

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.

Leave a Comment