libCurlopensslZlib的ARM移植 下载本文

内容发布更新时间 : 2024/5/2 7:36:11星期一 下面是文章的全部内容请认真阅读。

libCurlopensslZlib的ARM移植

libCurl/openssl/Zlib的ARM移植 收藏

本人使用环境

Host linux(from ubuntu): jeos[just enougth OS] 交叉编译器:

/opt/timesys/toolchains/armv5l-linux/bin/armv5l-linux-gcc target Processor: ARM926EJ-S rev 5 (v5l) Hardware:

Atmel AT91SAM9260-EK 先开始libCurl 的移植过程:

下载curl-7.20.0.tar.bz2解压至本目录,开始configure,由于之前一直发现配置不过,出现多次错误,这里直接给出正确的配置:

cd curl-7.20.0 && ./configure --prefix=/win/530/curl/build --build=i686-linux --host=arm-linux

CC=/opt/timesys/toolchains/armv5l-linux/bin/armv5l-linux-gcc CFLAGS='-Os' --enable-debug --enable-optimize --enable-static

--disable-ftp --without-zlib --disable-rtsp --disable-dict

--disable-proxy --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-ipv6 --enable-http -enable-crypto-auth --without-gnutls --without-nss --without-ca-bundle --with-random=/dev/urandom export LDFLAGS=\

-L/opt/timesys/toolchains/armv5l-linux/lib\configure碰到的错误:

1.checking for \for file existence when cross compiling google后发现答案:

http://www.hiawatha-webserver.org/forum/topic/137

按照回答,由于是在主机上配置、编译,所以配置期间没找到 适合于目标系统的随机数生成器,具体在/dev/urandom下面,但是我找了下,确实是有的: [root@openssl]# ls -al /dev/urandom

crw-rw-rw- 1 root root 1, 9 Jan 12 17:12 /dev/urandom [root@openssl]# file /dev/urandom /dev/urandom: character special 引用回答的原文:

#You may need to provide a parameter like

'--with-random=/dev/urandom' to configure as it cannot detect

the presence of a random number generating device for a target system.

2.checking for curl_socklen_t data type... unknown configure: error: cannot find data type for curl_socklen_t. 在网上找了多次,没找到解决方法。因为之前编译的时候使用到库一直没指定连接库,因为这个是有编译器自己自动连接的,最后灵机一动,想想给加上链接库试试:

LDFLAGS=\没想到无奈的问题解决了。 configure编译后的信息如下

#configure: Configured to build curl/libcurl: # curl version: 7.20.0

# Host setup: arm-unknown-linux-gnu # Install prefix: /win/530/curl # Compiler:

/opt/timesys/toolchains/armv5l-linux/bin/armv5l-linux-gcc # SSL support: enabled (OpenSSL) # SSH support: no (--with-libssh2) # zlib support: enabled

# krb4 support: no (--with-krb4*) # GSSAPI support: no (--with-gssapi)

# SPNEGO support: no (--with-spnego) # c-ares support: no (--enable-ares) # ipv6 support: no (--enable-ipv6) # IDN support: no (--with-libidn) # Build libcurl: Shared=yes, Static=yes # Built-in manual: enabled

# Verbose errors: enabled (--disable-verbose) # SSPI support: no (--enable-sspi) # ca cert bundle: no # ca cert path: no

# LDAP support: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)

# LDAPS support: no (--enable-ldaps) # RTSP support: enabled

# Protocols: DICT FILE HTTP HTTPS RTSP 编译安装

make clean &&make && make install openssl

下载openssl-0.9.8m.tar.gz解压至本目录,开始configure: ./config --prefix=/win/530/curl/openssl/build

os/compiler:/opt/timesys/toolchains/armv5l-linux/bin/armv5l-linux-gcc

最开始使用:

CC=/opt/timesys/toolchains/armv5l-linux/bin/armv5l-linux-gcc CFLAGS='-Os' export LDFLAGS=\-L/opt/timesys/toolchains/armv5l-linux/lib\

打死也编译不过去,本想改改config/Configure的,但是真的没法下手:写的太混乱了。比明朝晚期的朝廷还要O__O\后来找到一篇文章

http://wifihack.net/blog/tag/arm/

原来CC需要用os/compiler去指定的!晕倒,最开始在INSTALL里面看到这个选项还不以为然…… 但是按照这个方法也不行:

/opt/timesys/toolchains/armv5l-linux/bin/armv5l-linux-gcc -I. -I.. -I../include -DOPENSSL_THREADS -march=pentium -c -o cryptlib.o cryptlib.c

cryptlib.c:1: error: bad value (pentium) for -march= switch 方法也挺简单的,起因是-march=pentium这个编译开关: 搜索Makefile,删掉这个信息即可。当然主要是这行: CFLAG= -DOPENSSL_THREADS -march=pentium 前面的都好像没用处,去掉不去掉都可以。 按照博主的说明,当然最后需要修改 AR= ar $(ARFLAGS) r