Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#29 closed defect (released)

PHP bindings produce incorrect module.

Reported by: Malcolm Baldridge Owned by: Olly Betts
Priority: high Milestone:
Component: Xapian-bindings Version: 0.8.0
Severity: major Keywords:
Cc: Blocked By:
Blocking: Operating System: Linux

Description

Using SWIG-1.3.21 release, with xapian 0.8.0 release for PHP 4.3.6 (release) built as an Apache 1 module on a glibc-2.3.2/Linux 2.4 system. gcc-3.2.2 is the compiler.

After xapian-bindings are configured, the php4 module is improperly built as a vital symbol is not exported, namely, get_module(). This is gated by a #define COMPILE_DL_XAPIAN, which is not setup anywhere.

It seems to be defined in the config.h file, but nowhere is that file included into the resulting xapian_wrap.cpp file.

My fix, which may be improper, is simple: patch util.i to define the symbol, since it *IS* being built as a stand-alone module. It calls phpize, etc.

Cheers, Lord Apollyon

Offered patch:

--- util.i~ 2004-04-30 10:05:53.000000000 +0000 +++ util.i 2004-04-30 10:05:53.000000000 +0000 @@ -22,6 +22,9 @@

  • USA
  • -----END-LICENCE----- */

+ +#define COMPILE_DL_XAPIAN 1 +

%}

%pragma(php4) phpinfo="

Change History (5)

comment:1 by Olly Betts, 21 years ago

Status: newassigned

With SWIG 1.3.19 I get these lines in xapian_wrap.cpp:

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

And config_vars.mk contains:

CPPFLAGS = -DHAVE_CONFIG_H

Do you have either of these with SWIG 1.3.21?

comment:2 by Malcolm Baldridge, 21 years ago

/xapian-bindings-0.8.0$ find -name "*config_vars*" /xapian-bindings-0.8.0$ updatedb /xapian-bindings-0.8.0$ locate config_vars /xapian-bindings-0.8.0$

Where is config_vars.mk supposed to be? Is this file meant to be in the SWIG distro?

Note, the above xapian-bindings is configured and BUILT! (There's a php4/xapian directory populated with configured and built components.)

As for the HAVE_CONFIG_H stuff, I get the following hits when I grep:

/xapian-bindings-0.8.0/php4/xapian$ grep CONFIG *.cpp /xapian-bindings-0.8.0/php4/xapian$ [nada!] /xapian-bindings-0.8.0/php4/xapian$ grep HAVE_CONFIG_H * Makefile:CPPFLAGS = -DHAVE_CONFIG_H config.log:CPPFLAGS=' -DHAVE_CONFIG_H' config.log:DEFS='-DHAVE_CONFIG_H' configure:CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H" configure:DEFS=-DHAVE_CONFIG_H configure.in:CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"

Is there a certain way I should have built SWIG? I pretty much let it configure with explicit PHP support, disabling the Ruby/python/etc stuff I knew the system didn't have installed.

=MB=

comment:3 by Olly Betts, 21 years ago

Where is config_vars.mk supposed to be? Is this file meant to be in the SWIG distro?

Note, the above xapian-bindings is configured and BUILT! (There's a php4/xapian directory populated with configured and built components.)

For me, config_vars.mk is generated in php4/xapian (by phpize I assume). It looks like SWIG and/or PHP has changed since the versions I've been using.

I'll try installing newer versions and see if can reproduce this.

comment:4 by Olly Betts, 21 years ago

Resolution: fixed
Status: assignedclosed

With newer versions of PHP and SWIG I see the same problem as you. In order to work with both older and newer versions, I've modified util.i to define COMPILE_DL_XAPIAN if it hasn't already been defined. With the older versions, this does nothing; with newer versions, it does the same as your patch.

comment:5 by Olly Betts, 20 years ago

Operating System: Linux
Resolution: fixedreleased

Fixed in 0.8.1

Note: See TracTickets for help on using tickets.