Page 1 of 1

Problem compiling Php 4.2.3 with java support on red hat 8.0

Posted: Sun Oct 20, 2002 1:05 am
by jbirchler
I get an error. I was able to compile 4.2.2 with java support on red hat 7.2. Any ideas?

Posted: Sun Oct 20, 2002 1:23 am
by volka
I get an error.
wow, at least it is a complete sentence ;)
please be more specific, i.e. by posting the error text

Posted: Sun Oct 20, 2002 3:30 am
by jbirchler
I figured this was a common problem, maybe even a bug, since I have successfully compiled php 4.2.2 with java on red hat 7.2 and on 10/1 version of Solaris 8 SPARC.

Here are the particulars:

OS: red hat 8.0 with latest patches from red hat network
Apache: 2.0.43 plain vanilla build using configure and make
JDK: 1.4.0_01B03 provided by sun

Here is my configure script:

rm -f config.cache
rm -f config.status
make clean
./configure i386-redhat-linux \
--prefix=/usr \
--enable-versioning \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--prefix=/usr \
--with-config-file-path=/etc \
--enable-force-cgi-redirect \
--enable-debug \
--enable-dbg=shared \
--with-dbg-profiler \
--enable-gd-native-ttf \
--enable-discard-path \
--enable-pic \
--enable-rpath \
--enable-inline-optimization \
--with-gnu-ld \
--with-curl \
--with-db3 \
--with-dom=/usr \
--with-exec-dir=/usr/bin \
--with-freetype-dir=/usr \
--with-gd \
--with-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-png \
--with-java=/opt/j2sdk1.4.0_01 \
--with-pspell=/usr/local \
--with-regex=system \
--with-ttf \
--with-xml \
--with-expat-dir=/usr \
--with-zlib \
--with-layout=GNU \
--enable-bcmath \
--enable-debugger \
--enable-ftp \
--enable-magic-quotes \
--disable-safe-mode \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-track-vars \
--enable-trans-sid \
--enable-yp \
--enable-wddx \
--with-oci8=/u01/app/oracle/product/8.1.7 \
--with-oracle=/u01/app/oracle/product/8.1.7 \
--with-kerberos=/usr/kerberos \
--with-ldap=shared,/usr \
--with-mysql=shared \
--with-unixODBC=shared,/usr \
--with-apxs2=/usr/local/apache2/bin/apxs

Here is the short version of what happens specific to the makefile found in ./ext/java:

[root@Linux-2 java]# make
make[1]: Entering directory `/home/admin/installs/source/php-4.2.3/ext/java'
/bin/sh /home/admin/installs/source/php-4.2.3/libtool --mode=compile gcc -I. -I/home/admin/installs/source/php-4.2.3/ext/java -I/home/admin/installs/source/php-4.2.3/main -I/home/admin/installs/source/php-4.2.3 -I/usr/local/apache2/include -I/home/admin/installs/source/php-4.2.3/Zend -I/usr/include/libxml2 -I/usr/include/freetype2/freetype -I/home/admin/installs/source/php-4.2.3/ext/mysql/libmysql -I/u01/app/oracle/product/8.1.7/rdbms/public -I/u01/app/oracle/product/8.1.7/rdbms/demo -I/usr/include -I/usr/local/include/pspell -I/opt/j2sdk1.4.0_01/include -I/opt/j2sdk1.4.0_01/include/linux -D_REENTRANT -I/home/admin/installs/source/php-4.2.3/TSRM -DTHREAD=1 -g -O2 -pthread -Wall -DZTS -prefer-pic -DJNI_12 -D_REENTRANT '-DJAVALIB="/opt/j2sdk1.4.0_01/./jre/lib/i386/libjava.so"' -c java.c && touch java.slo
gcc -I. -I/home/admin/installs/source/php-4.2.3/ext/java -I/home/admin/installs/source/php-4.2.3/main -I/home/admin/installs/source/php-4.2.3 -I/usr/local/apache2/include -I/home/admin/installs/source/php-4.2.3/Zend -I/usr/include/libxml2 -I/usr/include/freetype2/freetype -I/home/admin/installs/source/php-4.2.3/ext/mysql/libmysql -I/u01/app/oracle/product/8.1.7/rdbms/public -I/u01/app/oracle/product/8.1.7/rdbms/demo -I/usr/include -I/usr/local/include/pspell -I/opt/j2sdk1.4.0_01/include -I/opt/j2sdk1.4.0_01/include/linux -D_REENTRANT -I/home/admin/installs/source/php-4.2.3/TSRM -DTHREAD=1 -g -O2 -pthread -Wall -DZTS -DJNI_12 -D_REENTRANT -DJAVALIB=\"/opt/j2sdk1.4.0_01/./jre/lib/i386/libjava.so\" -c java.c -fPIC -DPIC -o java.lo
cc1: warning: changing search order for system directory "/usr/include"
cc1: warning: as it has already been specified as a non-system directory
In file included from java.c:44:
/usr/include/jni.h:6:1: warning: "JNIEXPORT" redefined
In file included from /opt/j2sdk1.4.0_01/include/jni.h:27,
from /usr/include/jni.h:5,
from java.c:44:
/opt/j2sdk1.4.0_01/include/linux/jni_md.h:11:1: warning: this is the location of the previous definition
In file included from java.c:44:
/usr/include/jni.h:7:1: warning: "JNICALL" redefined
In file included from /opt/j2sdk1.4.0_01/include/jni.h:27,
from /usr/include/jni.h:5,
from java.c:44:
/opt/j2sdk1.4.0_01/include/linux/jni_md.h:13:1: warning: this is the location of the previous definition
In file included from java.c:44:
/usr/include/jni.h:8:1: warning: "JNI_VERSION_1_2" redefined
In file included from /usr/include/jni.h:5,
from java.c:44:
/opt/j2sdk1.4.0_01/include/jni.h:1944:1: warning: this is the location of the previous definition
java.c: In function `jvm_create':
java.c:165: parse error before numeric constant
java.c:197: `JNI_CreateVM' undeclared (first use in this function)
java.c:197: (Each undeclared identifier is reported only once
java.c:197: for each function it appears in.)
java.c:197: parse error before numeric constant
java.c:198: `type name' declared as function returning a function
java.c:198: cast specifies function type
java.c: At top level:
java.c:663: parse error before numeric constant
java.c:667: `jenv' undeclared here (not in a function)
java.c:667: `jenv' undeclared here (not in a function)
java.c:667: parse error before "jvalue"
java.c:668: `result' undeclared here (not in a function)
java.c:669: parse error before '.' token
java.c:670: parse error before '.' token
java.c:671: parse error before '.' token
java.c:672: parse error before '(' token
java.c:673: parse error before '.' token
java.c:681: parse error before '.' token
java.c:682: parse error before '.' token
java.c:689: parse error before '.' token
java.c:690: parse error before '.' token
java.c:697: parse error before '.' token
java.c:698: parse error before '.' token
java.c:707: initializer element is not constant
java.c:709: parse error before "if"
java.c:715: warning: type defaults to `int' in declaration of `handle'
java.c:715: conflicting types for `handle'
java.c:706: previous declaration of `handle'
java.c:715: warning: initialization makes integer from pointer without a cast
java.c:715: initializer element is not constant
java.c:715: warning: data definition has no type or storage class
java.c:716: parse error before '.' token
java.c:717: parse error before '.' token
java.c:719: parse error before '(' token
java.c:719: warning: type defaults to `int' in declaration of `_zval_copy_ctor'
java.c:720: parse error before '->' token
java.c:720: parse error before '->' token
java.c:721: parse error before '(' token
java.c:734: conflicting types for `handle'
java.c:715: previous declaration of `handle'
java.c:734: `array' undeclared here (not in a function)
java.c:735: warning: type defaults to `int' in declaration of `result'
java.c:735: warning: initialization makes integer from pointer without a cast
java.c:735: initializer element is not constant
java.c:735: warning: data definition has no type or storage class
java.c:736: parse error before '(' token
java.c:744: redefinition of `handle'
java.c:734: `handle' previously defined here
java.c:744: `array' undeclared here (not in a function)
java.c:745: warning: type defaults to `int' in declaration of `result'
java.c:745: redefinition of `result'
java.c:735: `result' previously defined here
java.c:745: warning: initialization makes integer from pointer without a cast
java.c:745: initializer element is not constant
java.c:745: warning: data definition has no type or storage class
java.c:747: parse error before '(' token
java.c:756: redefinition of `handle'
java.c:744: `handle' previously defined here
java.c:756: `array' undeclared here (not in a function)
java.c:757: warning: type defaults to `int' in declaration of `result'
java.c:757: redefinition of `result'
java.c:745: `result' previously defined here
java.c:757: warning: initialization makes integer from pointer without a cast
java.c:757: initializer element is not constant
java.c:757: warning: data definition has no type or storage class
java.c:758: parse error before '(' token
java.c:758: parse error before '&' token
java.c:760: parse error before '(' token
java.c:768: warning: type defaults to `int' in declaration of `Java_net_php_reflect_setResultFromString'
java.c:768: warning: parameter names (without types) in function declaration
java.c:768: warning: data definition has no type or storage class
java.c:769: parse error before '.' token
java.c:777: warning: type defaults to `int' in declaration of `iniUpdated'
java.c:777: redefinition of `iniUpdated'
java.c:84: `iniUpdated' previously defined here
java.c:777: warning: data definition has no type or storage class
java.c:778: parse error before "zend_java_globals"
java.c:781: parse error before "zend_java_globals"
java.c:784: warning: type defaults to `int' in declaration of `local_php_reflect'
java.c:784: warning: initialization makes integer from pointer without a cast
java.c:784: initializer element is not constant
java.c:784: warning: data definition has no type or storage class
java.c:785: parse error before "zend_java_globals"
make[1]: *** [java.slo] Error 1
make[1]: Leaving directory `/home/admin/installs/source/php-4.2.3/ext/java'
make: *** [all-recursive] Error 1

If I take out the --with-java part, it works and I go on to do a make install with no problems, but I need the java support. Please let me know if you need anything else to diagnose this.

Thanks.

Posted: Sun Oct 20, 2002 11:09 pm
by volka

Posted: Mon Oct 21, 2002 11:17 am
by jbirchler
I checked the article. Actually, I tried all of this before I posted the message. Once again, I have done this before successfully on previous versions of red hat and php. Just to be sure, I verified everything in this article and got the same results. So, is it a bug? Has anyone actually done this using red hat 8.0 and php 4.2.3?

Posted: Wed Oct 23, 2002 8:46 pm
by jbirchler
Found the problem. The jni.h header file in /usr/include overrode the one in /usr/java/include. I renamed the jni.h in /usr/include and went on to complete my make, make install and so forth. Since my JDK install did not put the jni.h file into /usr/include, I'm thinking this a bug in red hat 8 or in the php makefile.