Thursday, February 19, 2009

[搬移]Build PHP's Extensions with VS 2005

http://sskaje.spaces.live.com/blog/cns!CD0E835D6C568521!1030.entry
June 16, 2008


习惯了编译ImageMagick的PHP API,经常遇到编译错误
不过这些错误也就只有在VC6下才会有
而且,VC6,实在太老了
索性,迁移吧

看了看php官方文档,确认用vs05编译可行
然后,03的虚拟机花了3个小时装了VS05,打了sp1
再装了Intel C++ Compiler
接下来,先编译ImageMagick,没问题,一切正常,编译比较顺利
不过想用Intel C++ Compiler编译的时候,发现错误实在太多了
应该是intel的东西对语法要求比较严格吧

嗯,把php的编译环境搭好,先编译resolv.lib,很轻松,dsw直接转sln就可以编译了
然后,配好win32build,加好环境变量
又把扩展的相关文件拷过去了
基本还是vc6下的一套东西

编译,不行,出错
C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\sys/stat.inl(49) : error C
2466: cannot allocate an array of constant size 0
C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\sys/utime.inl(39) : error
C2466: cannot allocate an array of constant size 0
这种错误
无语
没见过
上网查,baidu甭想了
google,没有明确的东西
但是看到了php 的bug report里有个 http://bugs.php.net/bug.php?id=39130
定位到了main/config.w32.h

/* vs.net 2005 has a 64-bit time_t. This will likely break
* 3rdParty libs that were built with older compilers; switch
* back to 32-bit */
#define _USE_32BIT_TIME_T 1
#define HAVE_STDLIB_H 1

看到了块注释的部分,嗯,把这个第一行注释掉就行了

然后,imagick,magickwand顺利编译
eaccelerator的,还得在svn里吧fnmatch的.c和.h都拷过来才能编译

No comments:

Post a Comment