Edit report at http://bugs.php.net/bug.php?id=43214&edit=1
ID: 43214 Updated by: fel...@php.net Reported by: koalay at gmail dot com Summary: PHP won't build with PostgreSQL < 7.4 -Status: No Feedback +Status: Closed Type: Bug Package: PostgreSQL related Operating System: Linux PHP Version: 5.2.4 -Assigned To: +Assigned To: felipe New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed. (Bug #51617) Previous Comments: ------------------------------------------------------------------------ [2010-04-20 20:33:26] wdierkes at 5dollarwhitebox dot org This is not resolved entirely. As of 5.2.13 PHP will build against PQSQL < 7.4 but it does not function properly: [wdier...@esx02-bjd-el3-i386 wdierkes]$ php -v PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_pgsql.so' - /usr/lib/php/modules/pdo_pgsql.so: undefined symbol: PQfreemem in Unknown on line 0 PHP 5.2.13 (cli) (built: Apr 8 2010 16:08:42) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies RELATED: http://bugs.php.net/search.php?search_for=pqfreemem&boolean=0&limit=30&order_by=&direction=DESC&cmd=display&status=All&bug_type=All&php_os=&phpver=&assign=&author_email=&bug_age=0&bug_updated=0 The issue was partially fixed in ext/pgsql/pgsql.c but the same fix was not applied to pdo_pgsql. The following should resolve it: --- php-5.2.13/ext/pdo_pgsql/pgsql_driver.c.orig 2010-01-12 06:46:54.000000000 -0600 +++ php-5.2.13/ext/pdo_pgsql/pgsql_driver.c 2010-04-20 13:23:09.000000000 -0500 @@ -40,6 +40,10 @@ #include "php_pdo_pgsql_int.h" #include "zend_exceptions.h" +#ifndef HAVE_PQFREEMEM +#define PQfreemem free +#endif + static char * _pdo_pgsql_trim_message(const char *message, int persistent) { register int i = strlen(message)-1; --- php-5.2.13/ext/pdo_pgsql/pgsql_statement.c.orig 2010-01-03 03:23:27.000000000 -0600 +++ php-5.2.13/ext/pdo_pgsql/pgsql_statement.c 2010-04-20 13:23:32.000000000 -0500 @@ -44,6 +44,10 @@ #define TEXTOID 25 #define OIDOID 26 +#ifndef HAVE_PQFREEMEM +#define PQfreemem free +#endif + static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; ------------------------------------------------------------------------ [2007-11-19 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-11-11 18:50:04] j...@php.net IIRC, this is fixed in 5.2.5 so please try it out. ------------------------------------------------------------------------ [2007-11-07 18:30:13] koalay at gmail dot com Description: ------------ I believe this is almost the same bug as Bug #33813. PHP-5.2.4 won't build with PostgreSQL < 7.4. The reason for this is that the ext/pgsql/pgsql.c use the PQfreemem function which is only available in PostgreSQL 7.4 or later. Reproduce code: --------------- Build with --with-pgsql=[DIR] Expected result: ---------------- It builds normally. Actual result: -------------- ... ext/pgsql/.libs/pgsql.o(.text+0x591a): In function `zif_pg_escape_bytea': /var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:3641: undefined reference to `PQfreemem' ext/pgsql/.libs/pgsql.o(.text+0x599c): In function `zif_pg_unescape_bytea': /var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:3766: undefined reference to `PQfreemem' ext/pgsql/.libs/pgsql.o(.text+0x6122): In function `zif_pg_get_notify': /var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:4379: undefined reference to `PQfreemem' ext/pgsql/.libs/pgsql.o(.text+0x7daf): In function `php_pgsql_convert': /var/software/LAMP/php-5.2.4/ext/pgsql/pgsql.c:5185: undefined reference to `PQfreemem' collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1 (error exit) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=43214&edit=1