Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Narrowed down problem with lang/php5: (13 Items)
   
Narrowed down problem with lang/php5  
I've narrowed down the problem I'm having with building php5.
I might note that I'm fairly sure that the CONFIGURATION_ARG that is setting this off is --enable-xml, however the 
problem is unrelated to xml.  

While running bmake, configure fails at line 20055 with the error:
cc: unknown option '-R/usr/pkg/lib'

That is, the -R option does not work with the 3.3.5 gcc compiler.
The interrogation of the option occurs at line 3083.
This interrogation determines incorrectly that the -R option is supported.

I spent a number of hours trying to find out why. 
I was unsuccessful, but then I tried something that helped.
I cd'd to the work/php* directory, and ran configure directly.

This time the script correctly interrogated the compiler and found that it does not support -R.

This is a very disturbing result.   I means that the shell is working in a very subtly different way when called via the
 Makefile, then when run directly.   I have no idea how to fix the fundamental problem here.

There is a somewhat easy workaround for now.   The configure script can be modified to always find that -R is not 
supported, and then the build will complete properly.

This brings up another related issue.  The reason I felt compelled to update php at this juncture is has to do with a 
more general problem.
I was creating some php code using the xml_* interface, when I discovered that the libexpat delivered with QNX 6.3.2 is 
quite old.
In fact it did not support a very basic feature that I wanted to use.

This libexpat was located in /usr/lib, so in order to get a more updated version, I had to rearrange CS_LIBPATH so that 
/usr/pkg/lib is searched before /usr/lib.   

The point here is that there are a log of older open source packages/libs/pgms being delivered with the latest QNX.  I 
think that before the next release it would be nice if someone reviewed this and made some intelligent decisions.   One 
possibility is to consolidate all the open source programs and libraries (that can be) under /usr/pkg.  This would make 
the issue of updating with newer versions much simpler for users.

That's my 2cents.
Re: Narrowed down problem with lang/php5  
I guess I should update this report.   Even with the change I mentioned, the build script for php5 continues to have 
problems.
I don't have a handle on what is going wrong, but the problem has to do with find libraries in /usr/pkg/lib, for example
, libpng.a, libjpeg.a, and libz.a.

I'll continue trying to solve this.
Re: Narrowed down problem with lang/php5  
> I guess I should update this report.   Even with the change I mentioned, the 
> build script for php5 continues to have problems.
> I don't have a handle on what is going wrong, but the problem has to do with 
> find libraries in /usr/pkg/lib, for example, libpng.a, libjpeg.a, and libz.a.
> 
> I'll continue trying to solve this.

This sounds like you haven't setup your CS_LIBPATH as described in "Setup your Environment".

What is "getconf CS_LIBPATH" looks like on your machine?
Re: Narrowed down problem with lang/php5  
> This sounds like you haven't setup your CS_LIBPATH as described in "Setup your
>  Environment".
> 
> What is "getconf CS_LIBPATH" looks like on your machine?

Xiaodan,

I can see why you might think this.   In my /etc/profile I add :/usr/pkg/lib to the existing CS_LIBPATH.
I've verified that is working directly by printing out $(getconf CS_LIBPATH), and I've built and run about 40 other 
packages.

In the configure script, this isn't even an issue.  The script will check for the existance of /usr/pkg/lib/ibpng.a or 
something similar, and indicate a failure even though it is easy to see that the library is there. 
I checked the script itself by printing out what it is looking for.   I even repeated the test in a small script, which 
works.   I can't be sure, but the fact that the configure script has over 100,000 lines might be related.

If you want, I will send you the CONFIGURE_ARGS that I've set if you want to try to recreate this.

I continued work on this last night, and found some normal type problems, and more exceptional ones.

For example, there was a minor problem that QNX's makedev() has 3 parameters, while some code was expecting only 2.   
This was easy to fix.

On the other hand, when the script finally got around to testing whether mysql was properly installed, I found something
 that seems very quite rotten.   By default, the php package wants to find mysql libraries in /usr/local/mysql/lib.   
This can be overridden by --with-mysql=/usr/pkg, but this causes the php build to look for /usr/pkg/mysql/lib.   But 
pkgsrc did not install mysql this way.   Instead, using its normal way of doing things, it installed them in /usr/pkg/
lib/mysql.  I got around this by copying /usr/pkg/lib/mysql/* to /usr/pkg/mysql/lib.    So how does anyone else with any
 other OS get this to work?

Then I ran into what I think might be a problem specific to this release of QNX, as I did not find it the last time I 
built php.   When I finally got around to linking libphp5.la, there were some "missing routines" such as res_ninit(), 
res_nclose(), res_nsend() and one other.   I found that these were referenced in the file /usr/pkgsrc/lang/php5/work/php
*/ext/standard/dsn.c.   This file includes /usr/include/resolv.h, which references res_init(), etc, but not res_ninit().
   By searching through all /usr/include files, I found that the file /usr/include/bind/resolv.h does reference the 'n' 
versions as well as the non-n versions.   So far, so good.   I changed dsn.c to include bind/resolv.h instead of resolv.
h.
But then another problem cropped up.  bind/resolve.h was trying to include sys/bitypes.h.   But bitypes.h is not in sys,
 it's in bind/sys?

My conclusion to all this is that php5 is in a mess with respect to QNX.   I'm prepared to go back and work on this to 
try to figure out what all the problems are, and what patches are needed.    I would be interested to know if you know 
what the bind/resolv.h and res_n*() problems are about.

Post Deleted
Re: Narrowed down problem with lang/php5  
Sorry, ignore my last post.
Re: Narrowed down problem with lang/php5  
Okay,

I have gave this a try, and after correct 2 problems, I seems get it built.  (I haven't run the test yet, but thought 
just to let you know).

1) is the sys/dir.h need to be tested in configure, otherwise main/php_ini.c in not happy.

2) is the bind problem you've seen. For now, I just renamed libbind.a (both in /usr/lib, and in $QNX_TARGET/x86/usr/lib)
 so configure won't detect it. I am not sure, but I seems remember that library should not went out (it is a internal 
lib for other utils, to link with it, need some special -D on make line).

My build environment is a little different then yours, and I don't have mysql installed.

What CONFIGURATION_ARG you have been add to it?

-xtang
Re: Narrowed down problem with lang/php5  
> Okay,
> 
> I have gave this a try, and after correct 2 problems, I seems get it built.  (
> I haven't run the test yet, but thought just to let you know).
> 
> 1) is the sys/dir.h need to be tested in configure, otherwise main/php_ini.c 

I'd like to know what this means.   How do I get sys/dir.h to be tested in configure?   I recall some minor problem in 
main/php_ini.c, but not what is is.   I'm going to start over and document, so maybe I will understand then.

> in not happy.
> 
> 2) is the bind problem you've seen. For now, I just renamed libbind.a (both in
>  /usr/lib, and in $QNX_TARGET/x86/usr/lib) so configure won't detect it. I am 
> not sure, but I seems remember that library should not went out (it is a 
> internal lib for other utils, to link with it, need some special -D on make 
> line).

Well in that case I'll just rename it too to see if things turn out
better.



> My build environment is a little different then yours, and I don't have mysql 
> installed.Makefile:CONFIGURE_ARGS+=	--enable-discard-path
Makefile:CONFIGURE_ARGS+=	--enable-force-cgi-redirect
Makefile:CONFIGURE_ARGS+=	--enable-fastcgi
Makefile.php:CONFIGURE_ARGS+=	--with-config-file-path=${PKG_SYSCONFDIR:Q}
Makefile.php:CONFIGURE_ARGS+=	--with-regex=system
Makefile.php:#CONFIGURE_ARGS+=	--without-mysql
Makefile.php:CONFIGURE_ARGS+=	--without-sqlite
Makefile.php:#CONFIGURE_ARGS+=	--without-iconv
Makefile.php:#CONFIGURE_ARGS+=	--without-pear
Makefile.php:#CONFIGURE_ARGS+=	--disable-posix
Makefile.php:#CONFIGURE_ARGS+=	--disable-dom
Makefile.php:#CONFIGURE_ARGS+=	--disable-pdo
Makefile.php:#CONFIGURE_ARGS+=	--disable-json
Makefile.php:CONFIGURE_ARGS+=	--enable-xml
Makefile.php:#CONFIGURE_ARGS+=	--with-libxml-dir=${PREFIX:Q}
Makefile.php:CONFIGURE_ARGS+=	--with-libxml-dir=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-apxs2
Makefile.php:CONFIGURE_ARGS+=	--with-iconv-dir=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-iconv=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-mysql=/usr/pkg/lib/mysql
Makefile.php:CONFIGURE_ARGS+=	--with-mysqli=/usr/pkg/lib/mysql
Makefile.php:CONFIGURE_ARGS+=	--with-exif
Makefile.php:CONFIGURE_ARGS+=	--with-gd=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-zlib=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-jpeg-dir=/usr/pkg/lib
Makefile.php:CONFIGURE_ARGS+=	--enable-ipv6
Makefile.php:CONFIGURE_ARGS+=	--disable-ipv6
Makefile.php:CONFIGURE_ARGS+=	--with-openssl=${BUILDLINK_PREFIX.openssl}
Makefile.php:CONFIGURE_ARGS+=	--without-openssl
> 
> What CONFIGURATION_ARG you have been add to it?


Please note that some of these are commented out:




Re: Narrowed down problem with lang/php5  
> > Okay,
> > 
> > I have gave this a try, and after correct 2 problems, I seems get it built. 
>  (
> > I haven't run the test yet, but thought just to let you know).
> > 
> > 1) is the sys/dir.h need to be tested in configure, otherwise main/php_ini.c
>  
> 
> I'd like to know what this means.   How do I get sys/dir.h to be tested in 
> configure?   I recall some minor problem in main/php_ini.c, but not what is is
> .   I'm going to start over and document, so maybe I will understand then.

The perticular diff for configure looks like below. (basically in that head list, add sys/dir.h) I will try your config 
first. (but probably have to build mysql first).
 
@@ -16400,7 +16400,8 @@ utime.h \
 sys/utsname.h \
 sys/ipc.h \
 dlfcn.h \
-assert.h
+assert.h \
+sys/dir.h
Re: Narrowed down problem with lang/php5  
Please don't use these options yet.   Here are the fixed versions, along with a log of what was needed to compile php.  
 The install does not work yet, nor is mod_php generated for reasons  explained below.

New Configure Arguments, note that some are commented out.

Makefile:CONFIGURE_ARGS+=	--enable-discard-path
Makefile:CONFIGURE_ARGS+=	--enable-force-cgi-redirect
Makefile:CONFIGURE_ARGS+=	--enable-fastcgi
Makefile.php:CONFIGURE_ARGS+=	--with-config-file-path=${PKG_SYSCONFDIR:Q}
Makefile.php:CONFIGURE_ARGS+=	--with-regex=system
Makefile.php:#CONFIGURE_ARGS+=	--without-mysql
Makefile.php:CONFIGURE_ARGS+=	--without-sqlite
Makefile.php:#CONFIGURE_ARGS+=	--without-iconv
Makefile.php:#CONFIGURE_ARGS+=	--without-pear
Makefile.php:#CONFIGURE_ARGS+=	--disable-posix
Makefile.php:#CONFIGURE_ARGS+=	--disable-dom
Makefile.php:#CONFIGURE_ARGS+=	--disable-pdo
Makefile.php:#CONFIGURE_ARGS+=	--disable-json
Makefile.php:CONFIGURE_ARGS+=	--enable-xml
Makefile.php:#CONFIGURE_ARGS+=	--with-libxml-dir=${PREFIX:Q}
Makefile.php:CONFIGURE_ARGS+=	--with-libxml-dir=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-apxs2
Makefile.php:CONFIGURE_ARGS+=	--with-iconv-dir=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-iconv=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-mysql=/usr/pkg/lib/mysql
Makefile.php:CONFIGURE_ARGS+=	--with-mysqli=/usr/pkg/bin/mysql_config
Makefile.php:CONFIGURE_ARGS+=	--enable-exif
Makefile.php:CONFIGURE_ARGS+=	--with-gd=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-zlib=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--with-jpeg-dir=/usr/pkg
Makefile.php:CONFIGURE_ARGS+=	--enable-ipv6
Makefile.php:CONFIGURE_ARGS+=	--disable-ipv6
Makefile.php:CONFIGURE_ARGS+=	--with-openssl=${BUILDLINK_PREFIX.openssl}
Makefile.php:CONFIGURE_ARGS+=	--without-openssl

Steps that created php

1) rename libbind.a as suggested by Xiaodan

2) Run bmake in lang/php5 and after configure is created
	Modify configure script to use bash instead of ksh
	add sys/dir.h at line 16400 as suggested by Xiaodan

3) In /usr/pkgsrc/lang/php5/work/php-5.2.4/ext/mysql/php_mysql.c
	ushort is not defined on line 236, changed it to unsigned short

4) There appears to be a bug in <stdio.h>
If you put "#define _FILE_OFFSET_BITS 64" before <stdio.h>
then the is a conflicting types error for fseeko().
This can be fixed by inserting #define SQLITE_DISABLE_LFS in 
/usr/pkgsrc/lang/php5/work/php-5.2.4/ext/pdo_sqlite/sqlite/src/sqliteInt.h
at line 48

5) In /usr/pkgsrc/lang/php5/work/php-5.2.4/ext/posix/posix.c line 727
makedev() has only 2 arguments, insert a third value 0 as the first argument.

6) The link of libphp5.la indicates 
*** Warning: inter-library dependencies are not known to be supported.
*** All declared inter-library dependencies are being dropped.

*** Warning: libtool could not satisfy all declared inter-library
*** dependencies of module libphp5.  Therefore, libtool will create
*** a static module, that should work as long as the dlopening
*** application is linked with the -dlopen flag.

This is the first time I've run into this with pkgsrc, and it will
cause problems with mod_php running with Apache.   I've dealt with this before,
but I hope it can be resolved without hacks.  It is necessary to get rid of
this problem because otherwise libphp5.so will not be created, and it is
turned into mod_php.so which is needed by Apache.

I'd appreciate any assitance on why this is happening.
Something to do with the mysteries of libtool I think.
Re: Narrowed down problem with lang/php5  

Hi Mitchell:

I've set up a link to the status page that Rick set
up and added a 'reported issues' table to it.
Would you like to become an official member so you
can add your issues to this?  I don't want anything
to get missed.

Regards,

-seanb
Re: Narrowed down problem with lang/php5  
> Would you like to become an official member so you
> can add your issues to this? 

Sure I would.   I'd like to go back and be a little more thorough with my attempt before reporting anything.  
Re: Narrowed down problem with lang/php5  
On Tue, Oct 09, 2007 at 11:10:35AM -0400, Mitchell Schoenbrun wrote:
> > Would you like to become an official member so you
> > can add your issues to this? 
> 
> Sure I would.   I'd like to go back and be a little more thorough with
> my attempt before reporting anything.  

Done.  Let me know if you have any problems.

-seanb