Topic: Building PHP 5.3.1-1 source RPM on Redhat 4

I have a RHEL4U8 machine with mysql 5.1.42 and httpd (apache) 2.2.14.
I need to rebuild php from source due to a version mismatch with apache.
It appears the spec file for the php-5.3.1-1.remi.src.rpm is for RedHat 5.

This syntax in the spec file causes an error...
%if %{?rhel}%{?fedora} > 4
%define with_enchant 1
%else
%define with_enchant 0
%endif

error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: Group field must be present in package: (main package)
error: License field must be present in package: (main package)

I got around it by commenting it out and explicitely setting with_enchant to 0.

It then came back with a missing dependency...
error: Failed build dependencies:
        libtool-ltdl-devel is needed by php-5.3.1-1.i386

This is a RedHat 5 rpm that obsoleted the RedHat 4 libtool rpm.

Lastly; it fails in building with an "undeclared" error...

/usr/src/redhat/BUILD/php-5.3.1/ext/date/lib/parse_tz.c:702: error: `timezonedb_system' undeclared (first use in this function)

Any suggestions would be appreciated

Re: Building PHP 5.3.1-1 source RPM on Redhat 4

I always use the same src.rpm for all distro.

You just need to define %rhel macro during build

rpmbuild ... --define "rhel 4" ... 

+

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Building PHP 5.3.1-1 source RPM on Redhat 4

Remi,

Thank you very much.
You still may have a problem with your spec file.

$ rpmbuild -bb --define "rhel 4" php-5.3.1-remi.spec
error: Failed build dependencies:
        libtool-ltdl-devel is needed by php-5.3.1-1.i386

This package was introduced in RHEL5 and obsoleted the libtool and libtool-libs packages (I think).

One other problem I ran into is that I'm using the MySQL rpms straight from Sun's download site.
I know; I know.  I should be using your mysql packages.

Anyway; it seems there are two libraries in /usr/lib/mysql; libmysqlclient.a and libz.a (and their corresponding .la files).
It seems that all the symbols/.o files in libz.a are also included in libmysqlclient.a and were causing multiply defined symbol errors. e.g. ...

/usr/lib/mysql/libz.a(zutil.o)(.text+0x68): In function `zcfree':
/export/home/my/tmp-200912021745-5.1.42-732/rpm/BUILD/mysql-5.1.42/zlib/zutil.c:313: multiple definition of `zcfree'
/usr/lib/mysql/libmysqlclient.a(zutil.o)(.text+0x68):/export/home/my/tmp-200912021745-5.1.42-732/rpm/BUILD/mysql-5.1.42/zlib/zutil.c:313: first defined here

My solution for this was to rename the libz.a file to __libz.a and redo the build.
This at least allowed me to compile and create the rpm's from source.
I haven't installed/tried it them yet.

Was this the right thing to do and if so; is there a way to tell rpmbuild to ignore a library from the command line?
I know; the right thing to do would be to use your mysql packages (which doesn't include libz.a). ;-)

Is there a way to tell rpmbuild

Re: Building PHP 5.3.1-1 source RPM on Redhat 4

> libtool-ltdl-devel is needed by php-5.3.1-1.i386
I will check/change this for my next build

> Anyway; it seems there are two libraries in /usr/lib/mysql; libmysqlclient.a and libz.a (and their corresponding .la files).
That's one of the reason why I hate the Sun packages...

+

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Building PHP 5.3.1-1 source RPM on Redhat 4

Remi,

Just to confirm.

I should be OK with commenting out the libtool-ltdl-devel reference?
(As long as I had the RHEL4 libtool and libtool-libs packages).

There's no way to tell rpmbuild to ignore /usr/lib/mysql/libz.a from the command line and that renaming it in the /usr/lib/mysql directory was an acceptable workaround?

I do appreciate the time and effort.

Thanks

Re: Building PHP 5.3.1-1 source RPM on Redhat 4

> I should be OK with commenting out the libtool-ltdl-devel reference?
Yes.

> renaming it in the /usr/lib/mysql directory was an acceptable workaround?
It seems ok (this file could even be deleted, a static lib have no interest in most case)

+

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi