x86_64 Linux错误:gnu/stubs-32.h缺少错误和解决方案

时间:2020-01-09 10:44:14  来源:igfitidea点击:

我在CentOS/RHEL/Fedora Linux 64位版本下编译应用程序时收到以下错误:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:No such file or directory
/usr/include/gnu/stubs.h:7:27:错误:gnu/stubs-32.h:没有这样的文件或者目录

如何在RHEL/Fedora/CentOS Linux 64位系统下使用gcc修复此错误并编译应用程序?

解决方法:
您需要安装glibc-devel软件包。它包含开发使用标准C库的程序(几乎所有程序都使用)所必需的目标文件。如果您正在开发将使用标准C库的程序,则系统需要具有这些标准目标文件才能创建可执行文件。

如何修复gnu/stubs-32.h:没有这样的文件或者目录

如果要开发将使用标准C库的程序,请安装glibc-devel。

修复GCC gnu/stub-32.h的RHEL/CentOS 5.x丢失错误

执行以下yum命令:

# yum -y install glibc-devel.i386

修复GCC gnu/stubs-32.h的RHEL/CentOS 6.x丢失错误

执行以下yum命令:

# yum -y install glibc-devel.i686 glibc-devel

输出示例:

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!

针对GCC gnu/stub-32.h的Debian/Ubuntu Linux修复错误

执行以下apt-get命令以在Debian或者Ubuntu Linux上修复:

$ sudo apt-get install g++-multilib libc6-dev-i386

现在,再次尝试使用gcc或者make命令重新编译您的应用程序。

修复gnu/stubs-32.h:SUSE(SLES)/OpenSUSE Linux上没有这样的文件或者目录

运行以下zypper命令:

sudo zypper install glibc-devel-32bit

修复gnu/stubs-32.h:Gentoo Linux上没有这样的文件或者目录

运行以下命令:

# emerge -1a sys-libs/gcc