0

我正在将libcurl用于运行 linux 的am-1808 [我需要使用我的 c 程序发送电子邮件],我已经为 arm 成功编译了 libcurl,并且示例应用程序被成功编译,但是当我在 arm-board 上运行这个应用程序时,我得到以下输出。

* About to connect() to smtp.gmail.com port 587 (#0)
*   Trying 74.125.127.108... * 0x12008 is at send pipe head!
* Connected to smtp.gmail.com (74.125.127.108) port 587 (#0)
< 220 mx.google.com ESMTP pf8sm6421301pbc.44
> EHLO am180x-evm
< 250-mx.google.com at your service, [115.186.161.64]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-STARTTLS
< 250 ENHANCEDSTATUSCODES
> STARTTLS
< 220 2.0.0 Ready to start TLS
> QUIT

然后它仍然卡在那里,我的电脑上相同程序的输出是,

* About to connect() to smtp.gmail.com port 587 (#0)
*   Trying 74.125.127.108...
* Connected to smtp.gmail.com (74.125.127.108) port 587 (#0)
* Connected to smtp.gmail.com (74.125.127.108) port 587 (#0)
< 220 mx.google.com ESMTP ns5sm15912240pbb.26
> EHLO ubuntu
< 250-mx.google.com at your service, [115.186.161.64]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-STARTTLS
< 250 ENHANCEDSTATUSCODES
> STARTTLS
< 220 2.0.0 Ready to start TLS
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* SSL connection using ECDHE-RSA-RC4-SHA
* Server certificate:
*    subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=smtp.gmail.com
*    start date: 2011-11-18 01:57:17 GMT
*    expire date: 2012-11-18 02:07:17 GMT
*    issuer: C=US; O=Google Inc; CN=Google Internet Authority
*    SSL certificate verify ok.
> EHLO ubuntu
< 250-mx.google.com at your service, [115.186.161.64]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-AUTH LOGIN PLAIN XOAUTH
< 250 ENHANCEDSTATUSCODES
> AUTH LOGIN dXNhbWF5YXNlZW45MEBnbWFpbC5jb20=
< 334 UGFzc3dvcmQ6
> dXNhenJwMjY=
< 235 2.7.0 Accepted
> MAIL FROM:<my_email@gmail.com>
< 250 2.1.0 OK ns5sm15912240pbb.26
> RCPT TO:<my_email@yahoo.com>
< 250 2.1.5 OK ns5sm15912240pbb.26
> DATA
< 354  Go ahead ns5sm15912240pbb.26
< 250 2.0.0 OK 1342605604 ns5sm15912240pbb.26
* Connection #0 to host smtp.gmail.com left intact
> QUIT
< 221 2.0.0 closing connection ns5sm15912240pbb.26
* Closing connection #0

证书有一些问题,我尝试在配置 lib-curl 时设置 ca-bundle,但没有帮助。这是我配置 libcurl 的命令。

./configure --host=arm-none-linux-gnueabi --build=i686-linux CFLAGS='-Os' --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt --with-ssl=/usr/bin/openssl --enable-smtp

知道如何解决这个问题吗?

问候

乌萨马

4

1 回答 1

1

lib-curl需要openssl来启用 https、ssl 等,现在我在我的系统上安装了 openssl,但它是为 x64 处理器编译的,所以我为 arm 交叉编译了 open-ssl,然后我再次交叉编译了 lib-curl arm,现在示例应用程序工作正常并发送电子邮件。

open-ssl 的配置参数是:

./config os/compiler:arm-none-linux-gnueabi-gcc

lib-curl 的配置参数为:

./configure --host=arm-none-linux-gnueabi --build=i686-linux CFLAGS='-Os' --enable-smtp --with-ssl 

如果您仍然收到证书错误,请将其添加到配置参数中。

--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt

PS:在 arm 上运行应用程序之前,不要忘记将 include 和 lib 文件从您的 pc 复制到 arm。

于 2012-07-25T08:40:17.173 回答