|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-11-29 07:34 UTC] jdolecek at NetBSD dot org
Description:
------------
NetBSD pkgsrc compiles modules individually, using phpize et.al. bcmath config.m4 doesn't have correct paths, so some includes are not properly found and compile fails. Furthermore, it still insists on number.c being present, which is apparently not needed (it used to be needed in past, I guess).
Note some care needs to be taken for the include
paths, since some files include "config.h", which
need to pick up the proper one - bcmath configure
or libbcmath one - appropriately.
Compile ends up with something along:
In file included from /usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/php_bcmath.h:26,
from /usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/bcmath.c:30:
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/bcmath.h:56:35: ext/bcmath/php_bcmath.h: No such file or directory
Following patch fixes the problem:
--- config.m4.orig 2002-03-07 15:18:01.000000000 +0100
+++ config.m4 2003-08-31 18:24:27.000000000 +0200
@@ -7,11 +7,11 @@
if test "$PHP_BCMATH" != "no"; then
AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
- PHP_NEW_EXTENSION(bcmath, bcmath.c number.c \
+ PHP_NEW_EXTENSION(bcmath, bcmath.c \
libbcmath/src/add.c libbcmath/src/div.c libbcmath/src/init.c libbcmath/src/neg.c libbcmath/src/outofmem.c libbcmath/src/raisemod.c libbcmath/src/rt.c libbcmath/src/sub.c \
libbcmath/src/compare.c libbcmath/src/divmod.c libbcmath/src/int2num.c libbcmath/src/num2long.c libbcmath/src/output.c libbcmath/src/recmul.c \
libbcmath/src/sqrt.c libbcmath/src/zero.c libbcmath/src/debug.c libbcmath/src/doaddsub.c libbcmath/src/nearzero.c libbcmath/src/num2str.c libbcmath/src/raise.c \
libbcmath/src/rmzero.c libbcmath/src/str2num.c,
- $ext_shared,,-I@ext_srcdir@/libbcmath/src)
+ $ext_shared,,-I@ext_srcdir@ -I@ext_srcdir@/../.. -I@ext_srcdir@/libbcmath/src)
PHP_ADD_BUILD_DIR($ext_builddir/libbcmath/src)
fi
The patch is also available on NetBSD CVSweb server:
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/math/php4-bcmath/patches/patch-aa?rev=1.2&content-type=text/plain
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
I split your patch into two files, so that there would we one patch per patched file. Yes, phpize is from PHP 4.3.4. libtool 1.4 autoconf 2.57 automake 1.7.6 Note: all other php4 modules build fine, so it's only problem with bcmath. Perhaps 'your' libfool magically strips some -I directives? Can you paste your compile line for libcmath/src/init.c? The problem happens due to init.c not picking .../ext/bcmath/config.h before including php_bcmath.h. Due to this, the #ifdef WITH_BCMATH block won't be included. Thus, BCG() macro is not defined and obviously the compile fails due to 'missing' _zero_ et.al. I'm not sure why it works for you - this is obviously wrong and shouldn't work anywhere. Anyway, adding #include "../../config.h" just before #include "../../php_bcmath.h" in bcmath.h fixed the compile problem, thus this updated patch to bcmath.h works fine: --- bcmath.h.orig 2002-11-22 10:27:08.000000000 +0100 +++ bcmath.h 2003-12-01 13:10:05.000000000 +0100 @@ -52,8 +52,9 @@ in the case of leading zeros generated. */ } bc_struct; -#include <php.h> -#include <ext/bcmath/php_bcmath.h> +#include "php.h" +#include "../../config.h" +#include "../../php_bcmath.h" Note the file should really use #include <php.h>, because php.h comes from installed PHP headers, not local bcmath module stuff. So I propose this patch as 'final': --- libbcmath/src/bcmath.h.orig 2002-11-22 10:27:08.000000000 +0100 +++ libbcmath/src/bcmath.h 2003-12-01 13:16:46.000000000 +0100 @@ -53,7 +53,8 @@ } bc_struct; #include <php.h> -#include <ext/bcmath/php_bcmath.h> +#include "../../config.h" +#include "../../php_bcmath.h" /* The base used in storing the numbers in n_value above. With this patch (and the config.m4 fix to not include number.c), the module compiles fine for me.