解决 error: gnu/stubs-32.h: No such file or directory

简介:

场景

    将服务程序从SUSE迁移到CentOS,编译出错

make[1]: Entering directory `/root/rpmbuild/BUILD/test/conf'

In file included from /usr/include/features.h:385,

                 from /usr/include/stdint.h:26,

                 from ../include/MyTypes.h:4,

                 from conf_init.c:1:

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

make[1]: *** [conf_init32.o] Error 1

make[1]: Leaving directory `/root/rpmbuild/BUILD/test/conf'

make: *** [all] Error 1


解决

1 从SUSE上拷贝gnu/stubs-32.h到相应的目录

2.其他解决思路

说明如下:conf_init.c:第一行引用../include/MyTypes.h头文件,

而这个头文件在第四行引用/usr/include/stdint.h头文件,

而这个头文件在第26行引用/usr/include/features.h头文件,

而这个头文件在第385行应用了/usr/include/gnu/stubs.h头文件,

而这个头文件在第7行引用了gnu/stubs-32.h头文件


下面是/usr/include/gnu/stubs.h文件的内容如下:


/* This file selects the right generated file of `__stub_FUNCTION' macros

   based on the architecture being compiled for.  */



#include <bits/wordsize.h>


#if __WORDSIZE == 32

# include <gnu/stubs-32.h>

#elif __WORDSIZE == 64

# include <gnu/stubs-64.h>

#els

# error "unexpected value for __WORDSIZE macro"

#endif

~       

注明:这个文件说明了64位或者32位编译环境选择的头文件。所以在编译的过程中,

使用了-m2的参数就会链接到32位版本的编译器,修改所有的Makefile文件,查看

是否有什么32位编译的删除即可。


查阅的外文资料几乎没有任何用处:

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.3, the package name is glibc-devel.i686.


On SLES it's called glibc-devel-32bit - do zypper in glibc-devel-32bit

在SLES系统上,执行上述指令安装,在/usr/include/gnu目录下确实生成了上述的文件。

在CentOS系统上,无效。





     本文转自fengyuzaitu 51CTO博客,原文链接:http://blog.51cto.com/fengyuzaitu/1430454,如需转载请自行联系原作者



相关文章
|
关系型数据库 MySQL C语言
gcc版本过低导致charconv: No such file or directory
gcc版本过低导致charconv: No such file or directory
1390 0
|
C语言 Python Windows
gcc: error: /FIPython.h: File o directory non esistente
gcc: error: /FIPython.h: File o directory non esistente
114 0
x86_64-linux-gnu/libgdk-x11-2.0.so: error adding symbols: DSO missing from command line
x86_64-linux-gnu/libgdk-x11-2.0.so: error adding symbols: DSO missing from command line
223 0
fatal error: gnu/stubs-n64_hard_2008.h: No such file or directory
fatal error: gnu/stubs-n64_hard_2008.h: No such file or directory
119 0
|
C语言
gcc is unable to create an executable file.
gcc is unable to create an executable file.
362 0
|
C语言
configure:3855: gcc -V >&5 gcc: error: unrecognized command line option '-V'
configure:3855: gcc -V >&5 gcc: error: unrecognized command line option '-V'
582 0
|
C语言
编译OpenJDK8:configure error /usr/lib64/ccache/gcc is a symbolic link to ccache
编译OpenJDK8:configure error /usr/lib64/ccache/gcc is a symbolic link to ccache
120 0
|
Web App开发 C语言
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
使用yum update gcc只能更新到gcc-4.4.7-11.el6.x86_64 下载了更高版本的GCC http://mirror.hust.edu.cn/gnu/gcc/gcc-4.
2676 0
|
5月前
|
编译器 Linux 开发工具