构建php_perl.dll失败

时间:2011-10-11 15:39:39

标签: php perl build compiler-errors pecl

我正在尝试构建php_perl.dll并且遇到错误,但是我对构建这些扩展的理解是有限的(显然)。所以我需要编译,或者,或者指向我预先构建的php_perl.dll,它将与PHP 5.2.17一起使用。 http://pecl4win.php.net网站已经死了,我在http://pecl.php.net/package/perl找不到的东西也没什么用。

我已经安装了Perl(尝试64位然后是x86),PHP(安装了XAMPP)和Visual Studio 6. Windows 7 64位。 PERL_HOME设置为c:\ perl。

此命令

msdev perl.dsp /MAKE "perl - Win32 Release_TS"

导致102个错误,如下所示:

--------------------Configuration: perl - Win32 Release_TS--------------------
Compiling...
php_perl.c
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 'win32_accept'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ';'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2146: syntax error : missing ')' before identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ','
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ')'
...
C:\Perl\lib\CORE\sys/socket.h(98) : error C2059: syntax error : ')'
C:\Perl\lib\CORE\win32.h(420) : error C2079: 'Wservent' uses undefined struct 'servent'
C:\Perl\lib\CORE\iperlsys.h(1143) : error C2143: syntax error : missing ')' before '*'
C:\Perl\lib\CORE\iperlsys.h(1143) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.

php_perl.dll - 102 error(s), 0 warning(s)

关于我做错了什么想法?

1 个答案:

答案 0 :(得分:0)

这个问题没有答案?

我刚刚通过稍微修改新的1.0.1 php_perl.c源代码(第31行)解决了Windows 5.3.13上的编译错误:

旧:

#  define _WINSOCK2API_           /* using winsock.h instead of winsock2.h */

新:

#  ifndef _WINSOCK2API_
#       include <winsock2.h>
#  endif

对于编译,请按照本页的教程(http:/ /www.crazyws.fr/tutos/compiler-php-et-ses-extensions-sur-windows-SJ5GT.html),对不起法语。< / p>

基本上安装Visual Studio 2008 Express WITH SP1(否则会发生构建错误),然后卸载任何2008 Runtime,然后安装Windows SDK 6.1(2008 Server)来编译VC9版本。我还使用了ActiveState的Perl安装(版本5.8.0,ActivePerl-5.8.0.805-MSWin32-x86.msi,未经其他版本测试)。

然后从http:/ /windows.php.net/downloads/php-sdk/下载php sdk和deps,php源码,来自http:/ /pecl.php.net/package/perl的扩展源代码,解压缩如教程中所述的目录,如上所述修改php_perl.c。

然后打开Windows SDK的CMD shell并输入:

setenv /xp /x86 /release
cd <root_directory>
bin\phpsdk_setvars.bat
cd <php_src>
buildconf --force
configure --help
configure --with-perl=shared --with-extra-includes="<perl_lib_CORE_directory>" --with-extra-libs="<perl_lib_CORE_directory>"
nmake php_perl.dll

我在Windows 7 Pro 64位上编译了我的dll并在我的WampServer安装上测试了它。扩展源代码中的.phpt文件对于如何使用它非常不言自明。

有关信息,该文件的另一个版本也可用于此github repo上的php 5.4(https:/ /github.com/do-aki/php-ext-perl)。

很抱歉答案很长,但有关在Windows上安装的扩展程序的README文件已经过时,而且我找不到支持,我觉得很蹩脚。

此致