关于在64位linux下开发32位linux程序的一些问题

前几天在64位linux下开发跨平台的代码,包括32位和64位的版本都需要编译,在给g++加上-m32开关之后,g++报了一个错误:

gnu/stubs-32.h: No such file or directory compilation terminated. make: ***

在网上翻了一圈,情况就是64位linux缺省只安装了64位的头文件和Lib版本,需要增加32位的版本库,网上提到的安装方法一般是CentOs, Ubuntu之类的发行版,我用的是OpenSuse,最后在老外的网页上找到了一个比较全面的各个版本的安装说明:

You need 32bit embedded GNU C Library. This incldes development Libraries, header files, contains the symlinks, headers, and object files needed to compile and link programs which use the standard C library.

Fix for Debian Linux

Type the following command:
$ sudo apt-get install libc6-dev

Fix for Ubuntu Linux

Type the following command:
$ sudo apt-get install libc6-dev-i386

Fix for OpenSUSE / Novell Suse Linux (SLES)

Type the following command:
# zypper in glibc-devel-32bit

Fix for RHEL / Fedora / CentOS / Scientific Linux

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

 

安装了头文件,还要注意安装库文件,方法同上,包括以下库:

gcc-32bit gcc7-32bit libstdc++6-gcc7-32bit libstdc++6-gcc7-locale libstdc++6-locale

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值