1.下载源码:
git clone https://github.com/openssl/openssl.git
2. 配置生成Makefile
./config no-asm shared --prefix=$(pwd)/__install CROSS_COMPILE=mipsel-linux-
去掉Makefile中的 -m64
3 交叉编译
make
出现while loading shared libraries: libmpfr.so.4: cannot open shared object file:错误
原因是由于没有找到libmpfr.so.4,但是其实工具链是有该库的
解决方法手动指定库路径:export LD_LIBRARY_PATH=/root/buildroot-gcc464/usr/lib
再次make
./libcrypto.so: warning: gethostbyname is obsolescent, use getnameinfo() instead.
./libcrypto.so: undefined reference to getcontext' ./libcrypto.so: undefined reference to
setcontext'
./libcrypto.so: undefined reference to `makecontext'
主要的原因是uclibc 本身这不支持这些接口
解决方法如下:
make clean
./config no-asm no-async shared --prefix=$(pwd)/__install CROSS_COMPILE=mipsel-linux-
去掉Makefile 中的 -m64
make && make install 编译通过。
root@vmuser-VirtualBox:~/openssl/__install# du -h
716K ./bin
1.6M ./include/openssl
1.6M ./include
16K ./lib/pkgconfig
20K ./lib/engines-1.1
8.5M ./lib
164K ./share/doc/openssl/html/man7
3.5M ./share/doc/openssl/html/man3
700K ./share/doc/openssl/html/man1
48K ./share/doc/openssl/html/man5
4.4M ./share/doc/openssl/html
4.4M ./share/doc/openssl
4.4M ./share/doc
212K ./share/man/man7
4.9M ./share/man/man3
808K ./share/man/man1
48K ./share/man/man5
5.9M ./share/man
11M ./share
4.0K ./ssl/private
20K ./ssl/misc
4.0K ./ssl/certs
64K ./ssl
21M .