Software⏱️ 2 min read📅 2026-06-03

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

Error gnu/stubs-32.h: No such file or directory while compiling Nachos source code on Ubuntu 11.04.

Quick Answer: The issue is likely due to the missing MIPS cross compiler toolchain. You need to extract and configure the toolchain before compiling Nachos.

The error 'gnu/stubs-32.h: No such file or directory' while compiling Nachos source code on Ubuntu 11.04 is caused by the lack of a MIPS-specific stub header file. This file is required for the cross-compiler to generate correct machine code for the MIPS architecture.

🛑 Root Causes of the Error

  • The source code is compiled with a 32-bit architecture, but the MIPS cross-compiler requires a 64-bit architecture to generate correct machine code.

🚀 How to Resolve This Issue

Method 1: Installing the GCC-MIPS Cross-Compiler

  1. Step 1: Install the GCC-MIPS cross-compiler using the following command:
sudo apt-get install gcc-mips

Method 2: Configuring the Makefile to Use a MIPS Cross-Compiler

  1. Step 1: Edit the configure script in the Nachos source code directory and add the following line at the end of the file:
-mips32-elf

Method 3: Using a MIPS Cross-Compiler Toolchain

  1. Step 1: Download the GCC-MIPS cross-compiler toolchain from the official website and extract it to a directory.

✨ Wrapping Up

By following these methods, you should be able to resolve the 'gnu/stubs-32.h: No such file or directory' error and successfully compile the Nachos source code.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions