zswself 发表于 2006-8-21 14:26:25

Openssl 编译

各位大侠,怎样编译openssl库啊?

我从网上找到一篇文章,http://www.ucdot.org/article.pl?sid=03/10/23/2249235&mode=thread。
按照这篇文章打上补丁,编译出错。

文章内容如下:
Firstly,download the patches from:

http://ftp.snapgear.org/pub/patches/openssl-0.9.7c.diff
http://ftp.snapgear.org/pub/patches/openssl-0.9.7c_linux_include.diff
http://ftp.snapgear.org/pub/patches/openssl-0.9.7c_makefile.diff


The patch is in 3 parts.

Installing openssl:

    cd lib
    tar zxvf ~/tmp/openssl-0.9.7c.tar.gz
    mv openssl-0.9.7c libssl
    cd libssl
    patch -p1 < ~/tmp/openssl.diff

The kernel needs to be patched because the way we set up our include
paths means that the openssl components in the kernel conflict with the ones in the openssl directory.

    cd linux-2.4.x/include/openssl
    patch -p0 < ~/tmp/openssl_linux_include.diff

Also you may want to use the openssl application.This small patch
fixes the makefile in that directory.

    cd user/openssl
    patch -p0 < openssl_makefile.diff

You should be able to compile and build everything now :-)


我用make lib_only编译的结果如下:
make: Leaving directory `/uClinux-dist/lib/libssl/crypto'
make: Leaving directory `/uClinux-dist/lib/libssl'
+ arm-elf-gcc -nodefaultlibs -O2 -g -fomit-frame-pointer -fno-builtin -DEMBED -I/uClinux-dist/lib/uClibc/include -I/uClinux-dist -Dlinux -D__linux__ -D__uClinux__ -Dunix -I/uClinux-dist/linux-2.4.x/include -Wl,-elf2flt -s -shared -o libcrypto.so.0.9.7 -Wl,-S,-soname=libcrypto.so.0 -Wl,--whole-archive libcrypto.a -Wl,--no-whole-archive -L/uClinux-dist/lib/uClibc/lib -lc -lgcc
libcrypto.so.0.9.7.elf2flt: In function `__uClibc_start_main':
libcrypto.so.0.9.7.elf2flt(.text+0x9759c): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** Error 1
make: Leaving directory `/uClinux-dist/lib/libssl'
make: *** Error 2
make: Leaving directory `/uClinux-dist/lib'
make: *** Error 2


有人成功添加ssl库吗?

limingth 发表于 2006-8-21 22:40:31

貌似很常见的问题,可就是不知道怎么搞定了, :cry:

lumit-support-1 发表于 2006-8-22 23:27:06

如果 DISABLE_SHARED_SSL=1 没有添加报的错和你的是一样的
把它添加在config.arch里面就可以了
你再试一下吧

zswself 发表于 2006-8-23 08:43:19

多谢lumit-support-1。将DISABLE_SHARED_SSL=1添加到config.arch之
后,编译确实通过。

但是根据http://www.ucdot.org/article.pl?sid=03/10/23/2249235&mode=thread所述,
这一句是可不要的,除非是不想共享的openssl库。原文是这样的:

BTW if you don't want shared openssl libs add the following to your
config.arch at the top level:

    DISABLE_SHARED_SSL=1

为什么不加这一句不行呢?

lumit-support-1 发表于 2006-8-23 23:18:01

uClinux下用的是静态库,编译成动态库不行
ld连的也是静态库,如果是动态的链接的时候就会报错了啊

zswself 发表于 2006-8-24 10:01:35

多谢lumit-support-1大侠。
页: [1]
查看完整版本: Openssl 编译