Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling php_excel and LibXL on Windows

I'm trying to build PHP on Windows together with a popular C library for Excel manipulation, LibXL. This library has a native PHP object-based extension called php_excel. I'm attempting to build the latter as a shared DLL on Windows, rather than statically compiling it into PHP for distribution.

My starting point for compilation is the PHP buidling for Windows wiki entry and I'm using Visual Studio 2008 and the Windows SDK 6.1 as recommended. For the purposes of further paths in this explanation, my reference directory is c:\php-sdk\php53dev\vc9\x86\. References to the PHP snapshot are shown as the folder php5.3-x where x is the snapshot build datetime.

After the extraction of the PHP snapshot, I'm adding bin\libxl.dll, include_c\* and lib\libxl.lib to the respective folders in deps.

I then extract the php_excel extension into php5.3-x\ext\excel-0.9.1.

Running buildconf and configure --help reveals that the extension is being seen. I'm then running:

configure --disable-all --enable-cli --with-excel=shared --disable-zts --disable-isapi --disable-nsapi
nmake

To achieve a VC9 non-thread-safe build of the DLL.

On nmake, I'm coming up against syntax errors for every header file in LibXL:

c:\php-sdk\php53dev\vc9\x86\deps\include\enum.h(4) : error C2061: syntax error: identifier 'libxl'
c:\php-sdk\php53dev\vc9\x86\deps\include\enum.h(4) : error C2059: syntax error: ';'
...

and syntax errors in the excel.c source for php_excel:

ext\excel-0.9.1\excel.c(33) : error C2146: syntax error : missing ')' before identifier 'f'
ext\excel-0.9.1\excel.c(33) : error C2061: syntax error : identifier 'f'
ext\excel-0.9.1\excel.c(33) : error C2059: syntax error : ';'
ext\excel-0.9.1\excel.c(33) : error C2059: syntax error : ')'
...

Here, for example, are these two sections from the respective files:

enum.h

#ifndef ENUM_CPP_H
#define ENUM_CPP_H

namespace libxl { # line 4
    ...
}

excel.c

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "libxl.h"
#include <stdlib.h>

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/date/php_date.h"
#include "php_excel.h"
#include "zend_exceptions.h"

static long xlFormatBorder(FormatHandle f) # line 33
{
    return 1;
}

I don't see syntax errors but assume I am missing an obvious step somewhere?

like image 295
Will Croft Avatar asked Jan 29 '26 07:01

Will Croft


1 Answers

I made the build and pulled a request to fix the build. See the bins here http://www.php.net/~pierre/

like image 51
Pierre Avatar answered Jan 30 '26 22:01

Pierre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!