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

Posted on in Categories , , , , , , , last updated April 12, 2014

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.

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/stub-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!

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.

32 comment

      1. Hi,
        It worked for me. I was trying to compile 32 bit version but my system is x86_64. I got the same issue. and installed
        sudo yum -y install glibc-devel.i686

        then finally able to compile and generate executable.

        Thanks
        Arul

      2. Doesn’t work for me on RHEL6.2. I get:

        # yum -y install glibc-devel.i686
        Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
        Updating certificate-based repositories.
        ftp://ftp.redhat.com/pub/redhat/linux/beta/6Server/en/os/SRPMS/repodata/repomd.xml: [Errno 14] PYCURL ERROR 9 – “Server denied you to change to the given directory”
        Trying other mirror.
        Error: Cannot retrieve repository metadata (repomd.xml) for repository: rhel-source-beta. Please verify its path and try again

        I ftp’ed to http://ftp.redhat.com, and there is no en/ dir under 6Server. I navigated to the SRPM directory, and there is no glibc-devel* packages there at all.

        Ideas anybody?

  1. i m facing d same problem..wen i tries to do wat u said it showed
    Package glibc-devel-2.12-3.x86_64 already installed and latest version
    still its giving the same error..wat 2 do??

  2. Hello,

    I’m encountering same pb under my 64bit Fedora 14 although it seems I’ve succesffully installed relevant packages being suggested previously (as it is reported
    by doing a “rpm -qa | grep -i glibc”) :

    rpm -qa | grep -i glibc
    glibc-headers-2.13-1.x86_64
    glibc-2.13-1.x86_64
    glibc-common-2.13-1.x86_64
    glibc-devel-2.13-1.x86_64
    glibc-2.13-1.i686

    So, what to do now ?
    Thanks a lot in advance for any solution / anymore suggestion.
    Kind regards.

    Alain-Pierre

  3. Hello again,
    I made a mistake in my previous post !
    I’m clearly missing the “glibc-devel-2.13-1.i686” (or glibc-devel-2.13-1.i386 ?) package…
    So, I surfed to Fedora website and googled the Net… But where shall I exactly
    look for this missing rpm file to be able to install it ?
    All links that I found are strange and unusable “.rpm.html” files/links, hu ?
    Where can I find the required rpm file ?
    Thanks a lot in advance.
    Alain-Pierre

    1. Use yum command to search and install the same. No need to Google it. Here are commands:

      ## search to get exact package name
      yum search glibc-devel
      ## install it
      yum install glibc-devel.i386 glibc-devel.x86_64
      
      1. can’t find what is glibc-devel.i386 ?

        yum search glibc-devel
        Modules complémentaires chargés : langpacks, presto, refresh-packagekit
        Adding fr_FR to language list
        ============================= Matched: glibc-devel =============================
        glibc-devel.i686 : Object files for development using standard C libraries.
        glibc-devel.x86_64 : Object files for development using standard C libraries.
        

        So, just installed glibc-devel.i686.

        But now, when trying to compile & link the Qt “weathertrayicon” example application in 32bit target mode with Qt Creator (with choosing the “-spec linux-g++-32” option in the compiling/linking build steps), here is what I’m obtaining :

        Exécution des étapes de compilation pour le projet weathertrayicon…
        Configuration inchangée, étape QMake sautée.
        Commence : “/usr/bin/make” -w
        make : on entre dans le répertoire « /home/aoip/projets/divers/aqp/weathertrayicon-build-desktop »
        g++ -c -m32 -pipe -g -Wall -W -D_REENTRANT -DNO_REGEX -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/usr/lib64/qt4/mkspecs/linux-g++-32 -I../weathertrayicon -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I../aqp -I../option_parser -I. -I../weathertrayicon -I. -o kuhn_munkres.o ../aqp/kuhn_munkres.cpp
        In file included from /usr/include/QtCore/qglobal.h:62:0,
        from /usr/include/QtCore/qscopedpointer.h:45,
        from /usr/include/QtCore/qdatastream.h:45,
        from /usr/include/QtCore/qpair.h:45,
        from /usr/include/QtCore/QPair:1,
        from ../aqp/kuhn_munkres.hpp:25,
        from ../aqp/kuhn_munkres.cpp:17:
        /usr/include/QtCore/qconfig.h:10:34: erreur fatale: QtCore/qconfig-i386.h : Aucun fichier ou dossier de ce type
        compilation terminée.
        make: *** [kuhn_munkres.o] Erreur 1
        make: on quitte le répertoire « /home/aoip/projets/divers/aqp/weathertrayicon-build-desktop »
        Le processus “/usr/bin/make” s’est terminé avec le code 2.
        Erreur à la compilation du projet weathertrayicon (cible : Bureau)
        Lors de l’exécution de l’étape ‘Make’

        anymore idea / suggestion ?

        Regards,

        Alain-Pierre

          1. No idea anymore on my side,
            I don’t know what should be done with Qt packages & libraries,
            tried same operations on 64bit Ubuntu 10.10 and 64bit Fedora 14,
            not exactly same results on these 2 “equivalent” linux platforms,
            but both having some trouble with generating 32bit target application
            when forcing the “-spec linux-g++-32” mode for qmake/make to let
            gcc “-m32” compiling & linking option…
            What I can say at this point is that Qt technical teams seem not to be
            as collaborative as we could expect, because having posting a “bug report” about Qt Creator on their side, I have received a quite “direct” answer from them like that : “there is no bug in Qt Creator, our bug reporting system is not a help system ! Problem seems to be on Ubuntu side”…
            arrgggghhhhhhh
            So, what to do ? Where can be the incriminated missing “QtCore/qconfig-i386.h” include file ? And, may be, this file is not the unique missing one…
            I didn’t find that file at all, although I think my Qt Creator and Qt library & framework installation and setup is ok (standard installation and setup of relevant DEB/Ubuntu or RPM/Fedora packages) on my two 64bit linux platforms (Ubuntu 10.10 & Fedora 14).
            Very, very annonying.

            Kind regards.

            Alain-Pierre

  4. This can also happen when cross compiling as well when the preprocessor is looking for header files that are absent in it’s “staging” area.

  5. Hi,

    After installation when i provide ./nicstat.sh then it gives me below error on CentOS machine.

    ./nicstat.sh: can not find platform executable

    How could i resolve this issue. Appreciate your help.

Leave a Comment