ID:               26462
 User updated by:  jdolecek at NetBSD dot org
 Reported By:      jdolecek at NetBSD dot org
-Status:           Feedback
+Status:           Open
 Bug Type:         BC math related
 Operating System: NetBSD 1.6ZF
 PHP Version:      4.3.4
 Assigned To:      sniper
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2003-12-01 03:49:13] [EMAIL PROTECTED]

What two patches? There's exactly 1 (one) file I gave.
Anyway, this works just fine for me..

What libtool, autoconf and automake versions you're using?
Is the phpize you're using from PHP 4.3.4 ?



------------------------------------------------------------------------

[2003-12-01 03:26:16] jdolecek at NetBSD dot org

Sorry about not providing the steps at first.
Here it is:

1. tar xzf php-4.3.4.tar.bz2 php-4.3.4/ext/bcmath
2. cd php-4.3.4/ext/bcmath
3. patch < patch1; patch < patch2
4. phpize
5. ./configure --enable-bcmath
6. gmake

patch1 and patch2 are your two patches.

These steps get me reliably to the same compilation failure, as pasted
in previous feedback.

------------------------------------------------------------------------

[2003-11-30 03:36:26] [EMAIL PROTECTED]

Exactly HOW is the configure run? Give the full process, not just some
part of it..


------------------------------------------------------------------------

[2003-11-29 08:59:44] jdolecek at NetBSD dot org

No, compile still fails with:

cc
-I/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src
-I. -I/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath
-DPHP_ATOM_INC
-I/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/include
-I/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/main
-I/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath
-I/usr/obj/pkgsrc/math/php4-bcmath/work/.buildlink/include/php
-I/usr/obj/pkgsrc/math/php4-bcmath/work/.buildlink/include/php/main
-I/usr/obj/pkgsrc/math/php4-bcmath/work/.buildlink/include/php/Zend
-I/usr/obj/pkgsrc/math/php4-bcmath/work/.buildlink/include/php/TSRM
-I/usr/obj/pkgsrc/math/php4-bcmath/work/.buildlink/include
-DHAVE_CONFIG_H -O2 -pipe
-I/usr/obj/pkgsrc/math/php4-bcmath/work/.buildlink/include -c
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c
 -fPIC -DPIC -o libbcmath/src/.libs/init.o
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:
In function `bc_init_numbers':
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:105:
error: `_zero_' undeclared (first use in this function)
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:105:
error: (Each undeclared identifier is reported only once
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:105:
error: for each function it appears in.)
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:105:
error: invalid lvalue in assignment
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:106:
error: `_one_' undeclared (first use in this function)
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:106:
error: invalid lvalue in assignment
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:107:
error: invalid type argument of `->'
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:108:
error: `_two_' undeclared (first use in this function)
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:108:
error: invalid lvalue in assignment
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:109:
error: invalid type argument of `->'
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:
In function `bc_init_num':
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:128:
error: `_zero_' undeclared (first use in this function)
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath/libbcmath/src/init.c:128:
warning: passing arg 1 of `bc_copy_num' makes pointer from integer
without a cast
*** Error code 1

Stop.
make: stopped in
/usr/obj/pkgsrc/math/php4-bcmath/work/php-4.3.4/ext/bcmath
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/math/php4-bcmath
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/math/php4-bcmath

I believe this is caused by libbcmath/init.c picking up 'wrong'
config.h.

------------------------------------------------------------------------

[2003-11-29 08:36:58] [EMAIL PROTECTED]

Fixed in CVS, here's the patch:

http://www.php.net/~jani/patches/bug26462.patch


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/26462

-- 
Edit this bug report at http://bugs.php.net/?id=26462&edit=1

Reply via email to