主题 : 求助:openssl静态库编译 运行时却需要动态库 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 58759
精华: 0
发帖: 20
金钱: 100 两
威望: 20 点
贡献值: 0 点
综合积分: 40 分
注册时间: 2011-11-13
最后登录: 2012-03-18
楼主  发表于: 2011-12-12 21:58

 求助:openssl静态库编译 运行时却需要动态库

系统环境:ubuntu 11.04   tiny6410: 2.6.38
软件环境:
openssl-1.0.0e
arm-linux-gcc 4.5.1
问题描述:
使用交叉编译链编出来的openssl库只能生成静态库,完成的程序在编译里使用-static选项连接静态库。
在tiny6410上运行时提示:
error while loading shared libraries: libssl.so.1.0.0
通过ldd命令查看发布需要openssl的两个静态库

    libssl.so.1.0.0 => not found
    libcrypto.so.1.0.0 => not found

谢谢朋友们给点提示,非常感谢。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2011-12-12 22:17
通过ldd命令查看发布需要openssl的两个静态库

    libssl.so.1.0.0 => not found
    libcrypto.so.1.0.0 => not found

从这个看,交叉编译生成了openssl库的动态链接库, 而且你的可执行程序也是用这两个动态库文件动态链接的。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 58759
精华: 0
发帖: 20
金钱: 100 两
威望: 20 点
贡献值: 0 点
综合积分: 40 分
注册时间: 2011-11-13
最后登录: 2012-03-18
2楼  发表于: 2011-12-12 22:24
谢谢回复,找到原因了,我链接错了库。链到x86的动态库了,因为x86的用了pkg-config,让人防不胜防呀
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2011-12-12 22:54

 回 2楼(安静的发狂者) 的帖子

这个恐怕不是根本原因。ARM的可执行档在编译时不可能链接x86的库,交叉编译器会报错的。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 58759
精华: 0
发帖: 20
金钱: 100 两
威望: 20 点
贡献值: 0 点
综合积分: 40 分
注册时间: 2011-11-13
最后登录: 2012-03-18
4楼  发表于: 2011-12-12 23:27
谢谢提示,我再找找原因,
我强制指定库名后,编译通过程序工作正常