linux 编译 curl 出错

2015-11-12 22:43:09 +08:00
 yunhui
编译 curl make 死活不通过,唉
执行参数如下,谢谢各位帮忙看看
```
这一步一切正常
root@debian:~/curl-7.45.0# ./configure --with-ssl
```
![图片描述][1]

make

```
一顿编译之后 ...... 然后出错了
../lib/.libs/libcurl.so: undefined reference to `SSLv2_client_method'
../lib/.libs/libcurl.so: undefined reference to `SSL_CTX_set_alpn_protos'
../lib/.libs/libcurl.so: undefined reference to `SSL_get0_alpn_selected'
collect2: error: ld returned 1 exit status
make[2]: *** [curl] Error 1
make[2]: Leaving directory `/root/curl-7.45.0/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/curl-7.45.0/src'
make: *** [all-recursive] Error 1

```

![图片描述][2]

openssl 也是编译的,参数如下

```
./config shared zlib
已经编译成功

root@debian:~/curl-7.45.0# openssl version
OpenSSL 1.0.2d 9 Jul 2015
root@debian:~/curl-7.45.0#
```

[1]: http://segmentfault.com/img/bVqTxQ
[2]: http://segmentfault.com/img/bVqTyo
10876 次点击
所在节点    Linux
45 条回复
hyq
2015-11-13 00:35:49 +08:00
你如果用的 centos ,静态库和动态库放的路径是 /usr/lib ,但是系统配置的库路径在 /usr/lib64 。不知道是不是这个原因
hyq
2015-11-13 00:36:50 +08:00
刚才看漏了,是 debian 啊。。
yunhui
2015-11-13 00:48:16 +08:00
@hyq 要不我也顺便也看看是不是这个关系
yunhui
2015-11-13 00:48:58 +08:00
@yunhui 明显不是,哈哈
msg7086
2015-11-13 01:00:31 +08:00
https://packages.debian.org/stretch/curl

dep: libcurl3-gnutls (= 7.45.0-1+b1)

你看官方都用 gnutls 口味了。

PS: 能不能给个编译 curl 的理由?
yunhui
2015-11-13 01:16:21 +08:00
@msg7086 呃呃呃,需求要 openssl~~~~
abscon
2015-11-13 08:27:24 +08:00
我也想知道楼主为何要亲自编译 curl 。这比编译失败的原因要重要得多
yunhui
2015-11-13 10:29:38 +08:00
@abscon 主要是需要 openssl ,顺手撸了 curl , apt-get 的 curl 会自动下载 openssl
abscon
2015-11-13 10:50:34 +08:00
@yunhui 我觉得这么常见的需求 debian 应该有现成的包提供,比如 libcurl4-openssl-dev ?
yunhui
2015-11-13 11:33:29 +08:00
@abscon 版本太低了。。
wdlth
2015-11-13 13:21:54 +08:00
@hardware 可以不安装库到系统里面,静态编译进程序就可以了。
abscon
2015-11-13 13:31:13 +08:00
@yunhui 7.45 的版本,怎么就低了……
你认为那个 4 是 curl 的版本?我觉得你最好花时间了解一下自己用的操作系统的包管理,否则很容易浪费时间。
julyclyde
2015-11-13 14:33:04 +08:00
新人要先学基础,别那编译软件这种破事练手,浪费时间也学不到什么东西
yunhui
2015-11-13 14:46:06 +08:00
@abscon apt-get 的 curl 版本是 7.25 openssl 是 2013 年的
yunhui
2015-11-13 14:46:47 +08:00
@julyclyde 没招,必须编译, apt-get 的 openssl 是 2013 年的
Felldeadbird
2015-11-13 14:46:58 +08:00
--with-ssl 要指明你的 openssl 编译地址。
如:我的安装在 /opt/openssl 加上去就 OK 了。
顺便吐槽一下这 CURL 和 OPENSSL 。 编译过程不能再当前目录进行,必须在别的目录。
abscon
2015-11-13 15:47:21 +08:00
@yunhui “系统是最小化安装的,什么基础工具包都没有,我一步一路[-哔-]过来的, openssl 系统一开始都没有的,我自己编译的”
------------------------------------
好吧,看到这里我明白了你的乐趣所在。别用 Debian 了,向你推荐 Gentoo 和 Linux From Scratch 。另外 FreeBSD ports 也不错的,你可以指定 curl 是用 GNU TLS , WolfSSL 还是 OpenSSL 。
yunhui
2015-11-13 16:15:07 +08:00
@abscon 其实主要是 apt-get 下载的 curl 会带上的 openssl1.01e 2013 版本太低了
abscon
2015-11-13 16:34:27 +08:00
@yunhui 你用的 Debian wheezy ? 换 jessie 或者 stretch 或者 sid 都可以有更高的版本啊。

比如 sid 的是 1.0.2d
yunhui
2015-11-13 16:45:06 +08:00
@abscon 现在的需求就是 debian7 这样,所以死这里了 唉

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/235779

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX