linux 下 openssl 编译和交叉编译

此随便记录一下编译openssl时遇到的各种问题以及解决办法。

点击此处下载 OpenSSL(version-1.0.1e)

linux 64位系统编译32位版本:

setarch i386 ./Configure linux-generic32 no-shared -m32
setarch i386 make
setarch i386 make install make test

 

交叉编译 (mips),步骤如下:

1.设置环境变量

export STAGING_DIR=/path/to/toolchain
export PATH=$PATH:/path/to/toolchain/bin

2.进入openssl根目录,执行config命令,设置参数--prefix, --cross-compile-prefix以及相关参数

.config --prefix=/path/to/you/defined/build-mips --cross-compile-prefix=mips-openwrt-linux-uclibc- no-shared no-asm no-apps

3. 编辑生成的Makefile文件:

   (a) 在x86_64(uname -m)系统上,将字符串"linux-x86_64"替换成“mips”, 删除所有的"-m64"选项

   (b) 在x86系统上,将字符串“linux-elf”替换成“mips”, 删除所有的"-march"选项

4. 执行编译(make)和安装(make install)

 

posted @ 2014-03-17 21:08  LovelyLife  阅读(4444)  评论(0编辑  收藏  举报