X86_64下源代码编译的一个问题
2007-07-03 23:24
281 查看
前段时间编译了几个源代码包,因为我的机器是X86_64的,所以出现了一个64位系统的问题,折腾了些时间才解决。记录在此,以防忘记。
问题的表现如下:
头文件asm-x86_64/types.h和sys/types.h的int64_t、u_int64_t定义有冲突,原因是头文件asm-x86_64/types.h在定义int64_t等时没有防止重复定义,而sys/types.h头文件在定义int64_t等时是有防止重复定义的措施的。将asm/types.h(其中包含了asm-x86_64/types.h)放到所有头文件的前面包含,解决问题。
另外,sys/types.h的防止重复定义的代码有个漏洞,只对有符号的类别的类型定义有防止重复定义的代码,如下所示:
因此需要将无符号的类别的类型定义也加上防止重复定义的代码,如下所示:
问题的表现如下:
/usr/include/asm-x86_64/types.h:22: error: conflicting types for 'int64_t' /usr/include/sys/types.h:198: error: previous declaration of 'int64_t' was here /usr/include/asm-x86_64/types.h:23: error: conflicting types for 'u_int64_t' /usr/include/sys/types.h:206: error: previous declaration of 'u_int64_t' was here |
另外,sys/types.h的防止重复定义的代码有个漏洞,只对有符号的类别的类型定义有防止重复定义的代码,如下所示:
# ifndef __int8_t_defined # define __int8_t_defined __intN_t (8, __QI__); __intN_t (16, __HI__); __intN_t (32, __SI__); __intN_t (64, __DI__); # endif __u_intN_t (8, __QI__); __u_intN_t (16, __HI__); __u_intN_t (32, __SI__); __u_intN_t (64, __DI__); |
# ifndef __int8_t_defined # define __int8_t_defined __intN_t (8, __QI__); __intN_t (16, __HI__); __intN_t (32, __SI__); __intN_t (64, __DI__); # endif # ifndef __u_int8_t_defined # define __u_int8_t_defined __u_intN_t (8, __QI__); __u_intN_t (16, __HI__); __u_intN_t (32, __SI__); __u_intN_t (64, __DI__); #endif |
相关文章推荐
- 未能加载文件或程序集或它的某一个依赖项(针对资源问题,x86文件在x64上编译失败)
- 64位系统上设置编译平台为x86的项目编译在特定的情况下比如当一个窗体上放有包含了图像的ImageList之后,ResGen就会产生这种问题
- 未能加载文件或程序集或它的某一个依赖项(针对资源问题,x86文件在x64上编译失败)
- 未能加载文件或程序集或它的某一个依赖项(针对资源问题,x86文件在x64上编译失败)
- 编译libodb-mysql.lib时遇到的一个问题
- 一个关于bin目录下DLL动态编译的问题
- 现在为了让程序兼容vista,我们需要给程序加上一个manifest文件,可是有时候vc6它就会弹出Resource Compiler Error RC2170 的错误,可能是vc6一个bug,我个人对vc6还是很喜欢的,不过经常会有编译死掉或出错的问题,
- System.Data.SQLite.dll不能编译成AnyCPU问题的解决方案,以及它跨x86和x64的使用方法。
- 一个关于VS2008在其他未安装VS2008的电脑上无法运行编译的程序的问题 收藏
- 关于编译器编译顺序的一个小问题...
- VS2010编译过程中遇到的一个问题
- 一个有趣的Java编译问题
- 我把一个VC6的工程转换为VS2008的工程后,编译总是出现找不到而且不能升级vc90.pdb文件的问题,error C2471--解决办法
- c语言编译时的一个问题
- eclipse中一个ndk编译问题
- 编译libjpeg-turbo遇到的一个问题
- vs2008编译连接出现的一个问题
- ubuntu10.10编译TQ2440的x86-qtopia-2.2.0具体问题总结及原因分析
- UIPOWER《简易版DirectUI的构建》源代码编译过程中的问题
- [整理]ubuntu10.10编译TQ2440的x86-qtopia-2.2.0编译问题解决精简版