gcc -L -l 找不到静态库?

kingjo002 2013-03-06 07:08:25
[root@localhost src]# gcc -Wall -g -o httpsclient https-client.c -I../toolkit/openssl/include -Wl,-Bstatic -L../toolkit/openssl -lssl -lcrypto -ldl
https-client.c:259:2: warning: no newline at end of file
/usr/bin/ld: skipping incompatible ../toolkit/openssl/libssl.a when searching for -lssl
/usr/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status
[root@localhost src]# gcc -Wall -g -o httpsclient https-client.c -I../toolkit/openssl/include -static -L../toolkit/openssl -lssl -lcrypto -ldl
https-client.c:259:2: warning: no newline at end of file
/usr/bin/ld: skipping incompatible ../toolkit/openssl/libssl.a when searching for -lssl
/usr/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status
[root@localhost src]# gcc -Wall -g -o httpsclient https-client.c -I../toolkit/openssl/include -static -L. -lssl -lcrypto -ldl
https-client.c:259:2: warning: no newline at end of file
/usr/bin/ld: skipping incompatible ./libssl.a when searching for -lssl
/usr/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status
[root@localhost src]# gcc -Wall -g -o httpsclient https-client.c -I../toolkit/openssl/include -L. -lssl -lcrypto -ldl
https-client.c:259:2: warning: no newline at end of file
/usr/bin/ld: skipping incompatible ./libssl.a when searching for -lssl
/usr/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status

可以用全路径是能找到libssl.a的 可是用-L -l这种方式应该是可以的 之前放在openssl找不到 又放到程序目录也找不到 不明白这样为什么找到静态库 请指教...
...全文
608 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingjo002 2013-03-08
  • 打赏
  • 举报
回复
ldconfig 可以配置这个
ForestDB 2013-03-07
  • 打赏
  • 举报
回复
你的-L路径下有ssl的库?
金刚葫芦娃 2013-03-07
  • 打赏
  • 举报
回复
ldconfig
「已注销」 2013-03-07
  • 打赏
  • 举报
回复
安装静态库了吗? fedora下是 yum install openssl-static
kingjo002 2013-03-06
  • 打赏
  • 举报
回复
找到一篇http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=1786166 可能就是这个原因
kingjo002 2013-03-06
  • 打赏
  • 举报
回复
是不是连接器配置文件的问题找不到 虽然问题是解决了(可以用写全路径解决)但是还是想知道是什么原因
kingjo002 2013-03-06
  • 打赏
  • 举报
回复
不是啊 make install的openssl 写全路径是可以用的 就是-L -l 这样的方式不行 不知道是编译器还是环境的问题
qq120848369 2013-03-06
  • 打赏
  • 举报
回复
目测你的.a根本不是在这个机器上编译的,不兼容。

69,381

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧