#26462 [Fbk-Opn]: bcmath doesn't compile as module

2003-12-01 Thread jdolecek at NetBSD dot org
 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:

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.


Previous Comments:


[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




[2003-11-29 08:15:52] [EMAIL PROTECTED]

I'm working on this. (btw. The patch here is not ok..)




[2003-11-29 07:34:08] 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 

#26462 [Fbk-Opn]: bcmath doesn't compile as module

2003-12-01 Thread jdolecek at NetBSD dot org
 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.0 +0100
+++ bcmath.h2003-12-01 13:10:05.0 +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.0 +0100
+++ libbcmath/src/bcmath.h  2003-12-01 13:16:46.0 +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)