惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - Luis Yang

博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 qmake生成VS的vcproj/sln工程文件 R语言爬取动态网页之环境准备 R实现pm2.5地图数据展示 install_github无法安装 Rwebdriver包的解决方法 关于R语言中set.seed() R语言开发环境搭建 博文阅读密码验证 - 博客园 psql连接 PostgreSQL 不输入密码的方法 shell中的cat和文件分界符(<<EOF) sqlplus -S选项说明 oracle中常见set指令 nohup详解
centos64位编译32位程序
Luis Yang · 2018-09-04 · via 博客园 - Luis Yang

test.c

#include <stdio.h>
int main()
{
        printf("sizeof long is %d\n",sizeof(long));
        return 0;
}

64位编译

[swdn@dev desktop]$ gcc test.c
[swdn@dev desktop]$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
[swdn@dev desktop]$

32位编译

[swdn@dev desktop]$ gcc -m32 test.c

错误1:缺少32位头文件

解决方法:

[swdn@dev desktop]$ yum install glibc.i686

错误2:再次编译,发现编译成功,链接失败,提示如下错误

解决方法:

先查看64位文件版本

[swdn@dev desktop]$ yum list libgcc
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
已安装的软件包
libgcc.x86_64                                                                      4.8.2-8.el6                                                                        @hop5  

由于yum提供的32版本低于64位的版本,使用yum install libgcc.i686会安装失败,因此需自己下载32位版本进行安装

下载地址:https://pkgs.org/download/libgcc

安装libgcc.i686

[swdn@dev desktop]$ sudo rpm -ivh libgcc-4.8.5-28.el7.i686.rpm

安装完成后重新编译程序

[swdn@dev desktop]$ gcc -m32 test.c
[swdn@dev desktop]$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
[swdn@dev desktop]$ a.out
sizeof long is 4
[swdn@dev desktop]$

显示已经可以编译32位程序了。