32位程序转64位记录

来源:互联网 发布:苹果手机信号软件 编辑:程序博客网 时间:2024/05/01 01:45

工作中要将原来的32位程序编译到64位系统下运行,现记录工作事项:

查看linux是32位的还是64位的,可用file /sbin/init 或者 file /bin/ls,uname -a,getconf LONG_BIT

一般i386是的32,x86_64就是64

查看库文件或执行文件是32还是64,可以用命令:file 库或执行文件

显示ELF 32-bit和ELF 64-bit

查看静态库用file命令就不行了,可以用objdump -a查看

1、安装64位unbantu(16.10LTS)

问题1:在虚拟机上设置安装64位unbantu,启动时提示

This host supports Intel VT-x, but Intel VT-x is disabled

处理:重启系统到bios中,将英特尔虚拟化技术(VT-x)设置为可用

问题2:安装后能ping,但xshell不能访问:

处理:是没有安装ssh服务,用sudo apt-get install openssh-server安装后可以连接

默认没有安装vim,用sudo apt-get install vim安装

在zigsun用户名用vim不能保存文件,sudo su后到root用户就可以


2、编译

问题1:在64位系统下默认编译的是64位的程序,用-m32会出错,

提示:/usr/include/features.h:367:25: fatal error: sys/cdefs.h: 没有那个文件或目录

处理:要增加安装以下2个库

sudo apt-get install build-essential module-assistant

sudo apt-get install gcc-multilib g++-multilib

问题2:编译ace库时,加不加-m64,都显示下面的错误:

g++: error: /usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/crti.o: No such file or directory
g++: error: /usr/lib/gcc/i686-linux-gnu/4.7/crtbeginS.o: No such file or directory
g++: error: /usr/lib/gcc/i686-linux-gnu/4.7/crtendS.o: No such file or directory
g++: error: /usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/crtn.o: No such file or directory

编译ace库有一个连接,可以参考:

http://www.cnblogs.com/liangxiaxu/archive/2013/03/07/2948417.html

问题3:编译ace库之前要先编译openssl库,编译openssl时提示,libcrypto.a与64位不兼容,

将build_pc下的全部内容删除后,make是可以通过了,但make install提示/usr/lib/pod2man的68行有错,改用手动copy


但连接ace库时提示libssl.a错误relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC



0 0
原创粉丝点击