x86_64 Linux Error: gnu/stubs-32.h Missing Error and Solution

I‘m getting the following error while compiling application under CentOS / RHEL / Fedora Linux 64 bit edition:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:
No such file or directory

How do I fix this error and compile my applications using gcc under RHEL / Fedora / CentOS Linux 64bit system?

You need to install the glibc-devel package. It contains the object files necessary for developing programs which use the standard C libraries (which are used by nearly all programs). If you are developing programs which will use the standard C libraries, your system needs to have these standard object files available in order to create the executables.

How to fix gnu/stubs-32.h: no such file or directory

Install glibc-devel if you are going to develop programs which will use the standard C libraries.

Fix for the RHEL/CentOS 5.x for GCC gnu/stub-32.h missing error

Type the following yum command:
# yum -y install glibc-devel.i386

Fix for the RHEL/CentOS 6.x for GCC gnu/stubs-32.h missing error

Type the following yum command:
# yum -y install glibc-devel.i686 glibc-devel
Sample outputs:

Loaded plugins: product-id, protectbase, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
ksplice-uptrack                                          |  951 B     00:00     
rhel-x86_64-server-6                                     | 1.5 kB     00:00     
rhel-x86_64-server-6-debuginfo                           | 1.3 kB     00:00     
rhel-x86_64-server-optional-6                            | 1.5 kB     00:00     
rhel-x86_64-server-optional-6-debuginfo                  | 1.3 kB     00:00     
rhel-x86_64-server-supplementary-6                       | 1.5 kB     00:00     
rhel-x86_64-server-supplementary-6-debuginfo             | 1.3 kB     00:00     
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glibc-devel.i686 0:2.12-1.107.el6 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.107.el6 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnss_hesiod.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libcidn.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnss_nis.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libBrokenLocale.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libanl.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnss_files.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libthread_db.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnss_compat.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnss_dns.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnss_nisplus.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libutil.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libnsl.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libdl.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: librt.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libresolv.so.2 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libcrypt.so.1 for package: glibc-devel-2.12-1.107.el6.i686
--> Processing Dependency: libm.so.6 for package: glibc-devel-2.12-1.107.el6.i686
--> Running transaction check
---> Package glibc.i686 0:2.12-1.107.el6 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.107.el6.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.107.el6.i686
---> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.32-358.2.1.el6 will be installed
---> Package nss-softokn-freebl.i686 0:3.12.9-11.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package             Arch    Version                Repository             Size
================================================================================
Installing:
 glibc-devel         i686    2.12-1.107.el6         rhel-x86_64-server-6  974 k
Installing for dependencies:
 glibc               i686    2.12-1.107.el6         rhel-x86_64-server-6  4.3 M
 glibc-headers       x86_64  2.12-1.107.el6         rhel-x86_64-server-6  604 k
 kernel-headers      x86_64  2.6.32-358.2.1.el6     rhel-x86_64-server-6  2.3 M
 nss-softokn-freebl  i686    3.12.9-11.el6          rhel-x86_64-server-6  116 k
 
Transaction Summary
================================================================================
Install       5 Package(s)
 
Total download size: 8.3 M
Installed size: 0  
Downloading Packages:
(1/5): glibc-2.12-1.107.el6.i686.rpm                     | 4.3 MB     00:00     
(2/5): glibc-devel-2.12-1.107.el6.i686.rpm               | 974 kB     00:00     
(3/5): glibc-headers-2.12-1.107.el6.x86_64.rpm           | 604 kB     00:00     
(4/5): kernel-headers-2.6.32-358.2.1.el6.x86_64.rpm      | 2.3 MB     00:00     
(5/5): nss-softokn-freebl-3.12.9-11.el6.i686.rpm         | 116 kB     00:00     
--------------------------------------------------------------------------------
Total                                           5.8 MB/s | 8.3 MB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-headers-2.6.32-358.2.1.el6.x86_64                     1/5 
  Installing : nss-softokn-freebl-3.12.9-11.el6.i686                        2/5 
  Installing : glibc-2.12-1.107.el6.i686                                    3/5 
  Installing : glibc-headers-2.12-1.107.el6.x86_64                          4/5 
  Installing : glibc-devel-2.12-1.107.el6.i686                              5/5 
  Verifying  : glibc-2.12-1.107.el6.i686                                    1/5 
  Verifying  : glibc-devel-2.12-1.107.el6.i686                              2/5 
  Verifying  : nss-softokn-freebl-3.12.9-11.el6.i686                        3/5 
  Verifying  : glibc-headers-2.12-1.107.el6.x86_64                          4/5 
  Verifying  : kernel-headers-2.6.32-358.2.1.el6.x86_64                     5/5 
 
Installed:
  glibc-devel.i686 0:2.12-1.107.el6                                             
 
Dependency Installed:
  glibc.i686 0:2.12-1.107.el6                                                   
  glibc-headers.x86_64 0:2.12-1.107.el6                                         
  kernel-headers.x86_64 0:2.6.32-358.2.1.el6                                    
  nss-softokn-freebl.i686 0:3.12.9-11.el6                                       
 
Complete!

Loaded plugins: product-id, protectbase, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
ksplice-uptrack | 951 B 00:00
rhel-x86_64-server-6 | 1.5 kB 00:00
rhel-x86_64-server-6-debuginfo | 1.3 kB 00:00
rhel-x86_64-server-optional-6 | 1.5 kB 00:00
rhel-x86_64-server-optional-6-debuginfo | 1.3 kB 00:00
rhel-x86_64-server-supplementary-6 | 1.5 kB 00:00
rhel-x86_64-server-supplementary-6-debuginfo | 1.3 kB 00:00
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package glibc-devel.i686 0:2.12-1.107.el6 will be installed
–> Processing Dependency: glibc-headers = 2.12-1.107.el6 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnss_hesiod.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libcidn.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnss_nis.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libBrokenLocale.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libanl.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnss_files.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libthread_db.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnss_compat.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnss_dns.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnss_nisplus.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libutil.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libnsl.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libdl.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: librt.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libresolv.so.2 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libcrypt.so.1 for package: glibc-devel-2.12-1.107.el6.i686
–> Processing Dependency: libm.so.6 for package: glibc-devel-2.12-1.107.el6.i686
–> Running transaction check
—> Package glibc.i686 0:2.12-1.107.el6 will be installed
–> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.107.el6.i686
–> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.107.el6.i686
—> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
–> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
–> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
–> Running transaction check
—> Package kernel-headers.x86_64 0:2.6.32-358.2.1.el6 will be installed
—> Package nss-softokn-freebl.i686 0:3.12.9-11.el6 will be installed
–> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
glibc-devel i686 2.12-1.107.el6 rhel-x86_64-server-6 974 k
Installing for dependencies:
glibc i686 2.12-1.107.el6 rhel-x86_64-server-6 4.3 M
glibc-headers x86_64 2.12-1.107.el6 rhel-x86_64-server-6 604 k
kernel-headers x86_64 2.6.32-358.2.1.el6 rhel-x86_64-server-6 2.3 M
nss-softokn-freebl i686 3.12.9-11.el6 rhel-x86_64-server-6 116 k Transaction Summary
================================================================================
Install 5 Package(s) Total download size: 8.3 M
Installed size: 0
Downloading Packages:
(1/5): glibc-2.12-1.107.el6.i686.rpm | 4.3 MB 00:00
(2/5): glibc-devel-2.12-1.107.el6.i686.rpm | 974 kB 00:00
(3/5): glibc-headers-2.12-1.107.el6.x86_64.rpm | 604 kB 00:00
(4/5): kernel-headers-2.6.32-358.2.1.el6.x86_64.rpm | 2.3 MB 00:00
(5/5): nss-softokn-freebl-3.12.9-11.el6.i686.rpm | 116 kB 00:00
——————————————————————————–
Total 5.8 MB/s | 8.3 MB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-headers-2.6.32-358.2.1.el6.x86_64 1/5
Installing : nss-softokn-freebl-3.12.9-11.el6.i686 2/5
Installing : glibc-2.12-1.107.el6.i686 3/5
Installing : glibc-headers-2.12-1.107.el6.x86_64 4/5
Installing : glibc-devel-2.12-1.107.el6.i686 5/5
Verifying : glibc-2.12-1.107.el6.i686 1/5
Verifying : glibc-devel-2.12-1.107.el6.i686 2/5
Verifying : nss-softokn-freebl-3.12.9-11.el6.i686 3/5
Verifying : glibc-headers-2.12-1.107.el6.x86_64 4/5
Verifying : kernel-headers-2.6.32-358.2.1.el6.x86_64 5/5 Installed:
glibc-devel.i686 0:2.12-1.107.el6 Dependency Installed:
glibc.i686 0:2.12-1.107.el6
glibc-headers.x86_64 0:2.12-1.107.el6
kernel-headers.x86_64 0:2.6.32-358.2.1.el6
nss-softokn-freebl.i686 0:3.12.9-11.el6 Complete!

Fix for Debian/Ubuntu Linux for GCC gnu/stub-32.h missing error

Type the following apt-get command to fix on a Debian or Ubuntu Linux:
$ sudo apt-get install g++-multilib libc6-dev-i386
Now, try gcc or make command again to recompile your application.

Fix “gnu/stubs-32.h: No such file or directory” on SUSE (SLES) /OpenSUSE Linux

Run the following zypper command:
sudo zypper install glibc-devel-32bit

Fix gnu/stubs-32.h: no such file or directory on Gentoo Linux

Run the following command:
# emerge -1a sys-libs/gcc

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.