随笔-124  评论-194  文章-0  trackbacks-0

曾试过用VS2005编译各种版本openssl都会到最后用perl测试说LOADDLL失败,不得其解,可是用下面的方法即可安装成功,考虑是不是人家是用VC6编译的:

更新于08年11月7日:

下面的PPM用不了了,参看这个:http://theoryx5.uwinnipeg.ca/ppms/

C:\Documents and Settings\Administrator>ppm install http://theoryx5.uwinnipeg.ca/ppms/Net_SSLeay.pm.ppd


或者


add this repository to your list (perl 5.8):
ppm> rep add RKOBES
http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58
then search:
ppm> search SSLeay
Searching in Active Repositories
 1. Crypt-SSLeay [0.51] OpenSSL glue that provides LWP https support
 2. Crypt-SSLeay [0.51]
 3. Net_SSLeay.pm [1.25] Perl extension for using OpenSSL
ppm>install Net_SSLeay.pm

在解压目录下,运行perl test.pl可以成功。

这是在perlorg上问的贴,可以参考:

http://perlchina.sun126.com/cgi-bin/ccb/topic_view.cgi?forum=4&article_id=0004061125003921&publishtime_id=0004061125003921&page=40


更新于2008年1月6日:
最近,又再次试图自己安装OPENSSL+SSLeay,用了SSLeay里README.WIN32说的方法:

3. Windows XP SP2 CAUTION: this is not working yet
   ActivePerl 5.8.8.820
   Visual Studio Express 2005
   Microsoft Platform SDK SVR2003R2
   OpenSSL 0.9.8e source openssl-0.9.8e.tar.gz
   Dynamic linking to SSL DLLs

- Install all packages in the order listed above (make sure you follow the
   instructions on the download page about adding the appropriate paths to the
   Projects and Solutions section of the Options dialog box, and updating
   corewin_express.vsprops file)
- Start a build shell with Start->All Programs->Microsoft Windows SDK->CMD Shell
- cd openssl-0.9.8e
- perl Configure VC-WIN32 --prefix=c:/OpenSSL
- ms\do_masm
- nmake -f ms\ntdll.mak
- nmake -f ms\ntdll.mak install
   (if you have trouble getting to this stage, consult INSTALL.W32)
- cd Net-SSLeay-xxxx
- perl Makefile.PL
- nmake
- copy c:\OpenSSL\bin\*.dll blib\arch\auto\Net\SSLeay\
- nmake test
  CAUTION: nmake test fails at this stage. Any suggestions?? This may be
   relevant: http://www.itwriting.com/blog/?postid=261&replyto=2542
- nmake install


应该说基本成功了,这次也最后同样遇到了LOADDLL失败,好像是R2604错误,这是引用msvcr80.dll出的问题,顺着方法里提到的URL看一下这里,介绍了微软为了解决DLL HELL问题引入了SIDE BY SIDE的DLL存在方式,我把我看了这篇文章的理解说明如下:
微软现在使用MANIFEST资源文件注入到DLL中的方法来解决DLL的依赖问题,在这个文件中以XML方式说明了本DLL将会引用到的其它系统DLL的详尽版本,这个文件由链接器自动生成。其机关在此:
可以到C:\WINDOWS\WinSxS看一下,这里共存了相同名字不同版本的DLL。
特别是POLICIES目录中MSVCR80目录中相关XML有一句:
<bindingRedirect oldVersion="8.0.41204.256-8.0.50608.0" newVersion="8.0.50727.762"/>
这就是说凡是有DLL中引用了之前老版本都会被重定位到最新版本。

VC2005编译出来的SSLeay.dll引用的是8.0.50608.0的,我们要把链接器产生的MANIFEST文件注入到DLL中:

mt /manifest SSLeay.dll.manifest /outputresource:SSLeay.dll;#2

这样至少可以通过NETSSLEAY的自测了。


但是,凡事都有个但是,真FAINT,当我用IO::Socket::SSL包时,报找不到randomize函数,是不是因为SSLeay太新了的缘故,此事还无解。所以为了用这个包,还是用前述的PPM方式安装会比较好,那个方法我已经验证过,装和用都没问题。

posted on 2006-11-26 11:35 我爱佳娃 阅读(2293) 评论(0)  编辑  收藏 所属分类: Perl

只有注册用户登录后才能发表评论。


网站导航: