The tutorial that I followed can be found here. It's very good but it assumes too much and has no trouleshooting section. I am attempting to amend that situation here. Once it's more detailed I'll make a wiki revision.
What I used:
- Windows SDK 6.1
- Microsoft Visual Studio Express 2008
- Wampserver (Apache 2.4 PHP 5.4.16)
c:\php-sdk \bin \phpdev \vc6 \vc8 \vc9 \x64 \x86 \deps \php-5.4.16 \build \ext \main \netware \pear \Release_TS \sapi \scripts \tests \TSRM \win32 \Zend
Start:
- Start cmd.exe
- cd C:\php-sdk\phpdev\vc9\x86\php-5.4.16
- start buildconf
Running buildconf:
Error: Script engine not found
c:\php-sdk\phpdev\vc9\x86\php-5.2.16>buildconf
Input Error: There is no script engine for file extension ".js".
Now run 'cscript /nologo configure.js --help'
Solution:
on Windows 7 this problem occurs because a text editor or IDE is the default program for running .js files. To fix this reset it by typing the following in cmd.exe terminal.
assoc .js = JSFILE
Error: Compiler is not in path
c:\php-sdk\phpdev\vc9\x86\php-5.4.16>configure --with-mp
Saving configure options to config.nice.bat
Checking for cl.exe ...
ERROR: MS C++ compiler is required
Solution:
Add to path variable
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
Error: The program can't start because the mspd80.dll is missing
Solution:
Add to environmental variable PATH
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
Error: Bison.exe or flex.exe missing
Solution:
Add the location of the php-sdk / bin directory
C:\php-sdk\bin
Extending PHP statically:
If you are compiling PHP and statically compiling some non-core extensions then these errors might occur.
"C:\php-sdk\phpdev\php-X.X.x>configure --enable-hello=shared
Unknown option --enable-hello; please try configure.js --help for a list of valid options"
When I run configure.js --help, I do not see --enable-hello as an option.
The config file for windows needs to be named: config.win32. or Create a file in the root of the extensions directory
follow this example:
c:\php-sdk \bin \phpdev \vc6 \vc8 \vc9 \x64 \x86 \deps \php-5.4.16 \build \ext \[my extension] config.w32 \[another extension] config.w32
An example of the contents of the config.w32 file:
// $Id$ // vim:ft=javascript ARG_WITH("example", "for example support", "no"); ARG_ENABLE("example-debug", "for debugging support in example", "no") ARG_WITH("example-extra", "for extra functionality in example", "no") if (PHP_EXAMPLE != "no") { if (CHECK_LIB("libexample.lib", "example", PHP_EXAMPLE) && CHECK_HEADER_ADD_INCLUDE("example.h", "CFLAGS_EXAMPLE", PHP_EXAMPLE + "\\include")) { if (PHP_EXAMPLE_DEBUG != "no") { AC_DEFINE('USE_EXAMPLE_DEBUG', 1, 'Debug support in example'); } if (PHP_EXAMPLE_EXTRA != "no" && CHECK_LIB("libexample-extra.lib", "example", PHP_EXAMPLE) && CHECK_HEADER_ADD_INCLUDE("example-extra.h", "CFLAGS_EXAMPLE", PHP_EXAMPLE + ";" + PHP_PHP_BUILD + "\\include") { AC_DEFINE('HAVE_EXAMPLEEXTRA', 1, 'Extra functionality in example'); HAVE_EXTRA = 1; } else { WARNING( "extra example functionality not enabled, lib not found" ); } EXTENSION("example", "example.c"); if (HAVE_EXTRA == 1) { ADD_SOURCES("example-extra.c"); } } else { WARNING( "example not enabled; libraries not found" ); } }
A simpler form without all the frameworks options
// $Id$ // vim:ft=javascript ARG_ENABLE("counter", "for counter support", "no"); if (PHP_COUNTER != "no") { EXTENSION("counter", "counter.c"); ADD_SOURCE("counter-util.c"); }
re-run the configure.js --help should display the extension as an option.
--
Running nmake:
cgi_main.c
c:\php-sdk\phpdev\vc9\x86\php-5.4.16\zend\zend_config.w32.h(29) : fatal error C1
083: Cannot open include file: 'malloc.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin
\cl.exe"' : return code '0x2'
Stop.
Solution:
Make sure that it is not a missing environment variable
"C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
Error:
wsyslog.c
win32\wsyslog.c(60) : fatal error C1083: Cannot open include file: 'wsyslog.h':
No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.exe"' : return code '0x2'
Stop.
Solution:
run buildconf
run configure
That's it. At this point the compile went as it should.
No comments:
Post a Comment