Cannot compile any version of PHP I want on Lucid due to dependencies in apache2-prefork-dev

Bug #809400 reported by RedScourge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Background:

Like MANY server admins who use PHP and run some old code, I have two requirements that are not what the Ubuntu package team has deemed as they way they want to support out of the box:

- PHP 5.2.X branch on a Lucid server
- Compiled with PHP's original bundled GD library, so that I don't lose a pile of functions I need

The solution would normally be to compile your own version, right? Wrong, can't do it, because a few critical *-dev packages have stupid dependencies!

Compiling your own php5 to get around the insufficient decision the Ubuntu team made to replace PHP's bundled GD library with their own fails, unless you are compiling the version of PHP that came with your release of Ubuntu. Compiling your own replacement php5 package depends on apache2-prefork-dev depends on apache2.2-common and libaprutil1-dev, libaprutil1-dev in turn depends on libaprutil1, and libaprutil1 in turn depends on libdb4.7-dev, and libdb4.7-dev in turn depends on libdb4.7.

There is no good reason a -dev package should depend on it's non-dev equivalent. The reason I say this is that it means that one who needed and thus installed the 5.2.X branch of PHP on their system that normally comes with the 5.3.X branch, cannot possibly recompile a 5.2.X branch of PHP on their server.

My possible solutions appear to be as follows:

- Set up a Karmic server (comes with PHP 5.2.10) just to compile the .deb file I want, then install it on my production server

- Try to force installing the packages with the stupid dependencies and risk breaking my system just so I can compile a replacement package on the same server I am going to use it on (apt-get wont do this, and dpkg requires me to obtain the .deb files first, so after some browsing finally I can try with "dpkg --force-depends -i", so that is yet another annoyance!)

- Try to convince the Ubuntu package team to release packages for the PHP 5.2.X branch on Lucid, since the PHP group still actively supported this branch, and many sysadmins still actively depend on it, yet also want or need an up-to-date server.

Actual Problem:

Compiling your own php5 to get around the insufficient decision the Ubuntu team made to replace PHP's bundled GD library with their own fails, unless you are compiling the version of PHP that came with your release of Ubuntu.

I found out that the Ubuntu package team decided to replace PHP's GD library with the Ubuntu system library, yet alot of functions are missing from this version. I heard people discuss that another option would be if someone would compile an alternative version of GD we could have an alternative version of PHP that used this alternative version of GD. Apparently this never happened. I need a fully functioning installation of PHP 5.2.X, so apparently as the Ubuntu team has not provided it I have to provide it for myself, but again, this fails. Really, I only needed a version of the package php5_gd that uses PHP's bundled GD library instead of the system library, but that requires compiling all of PHP, which again, fails.

Steps to Reproduce Issue:

- Install Ubuntu LTS 10.04 (Lucid) fresh
- Apply all updates
- change /etc/apt/sources.list to Karmic, so you can install PHP 5.2.X since you maintain code that depends on features that were removed from the 5.3.X branch, but that Ubuntu apparently does not support
- Install PHP 5.2.10 from Karmic
- Change /etc/apt/sources.list back to Lucid, so nothing else is messed up
- Realize that the Ubuntu package team did not bundle PHP's GD library when they compiled the php5 package, and that the only solution if you want a properly working PHP with all GD functions is to compile a replacement
- Compile fails due to retarded dependencies in libaprutil1-dev and apache2-prefork-dev and such
- Try to force installing a bunch of packages despite the stupid dependencies, hoping that they don't really need those dependencies anyway, potentially wrecking your live production webserver, just so you can have a chance at running a complete proper PHP package of the version that you need on the version of Ubuntu that you need

Revision history for this message
RedScourge (redscourge) wrote :
Download full text (5.0 KiB)

I managed to compile PHP finally, and all it took was several hours and countless steps. It's so simple your kids can do it!

Process (roughly, your mileage may vary, and i may have forgotten a step):

cd /tmp
apt-get source php5
apt-get install build-essential debhelper fakeroot
vi /etc/apt/sources.list
apt-get source php5
gunzip *.gz
ls
cd php5-5.2.10.dfsg.1/
vi debian/rules
#(remove ",/usr" where it talks about the GD library so it uses its bundled library instead of the system library, as is desired)
dpkg-buildpackage -rfakeroot
#(fails due to dependencies, start installing them)
apt-get install libaprutil1-dev
#(should fail due to existing version of libaprutil1 and libdb4.7, which you DONT want to remove
apt-get install bison chrpath flex freetds-dev libbz2-dev libcurl4-openssl-dev libedit-dev libfreetype6-dev libgcrypt11-dev libgd2-xpm-dev libgmp3-dev libjpeg62-dev libmhash-dev libncurses5-dev libpam0g-dev libpng12-dev libpspell-dev librecode-dev libsasl2-dev libsnmp-dev libsqlite0-dev libt1-dev libtidy-dev libwrap0-dev libxmltok1-dev libxml2-dev libxslt1-dev quilt re2c unixodbc-dev
wget http://launchpadlibrarian.net/59612230/libaprutil1-dev_1.3.9%2Bdfsg-1ubuntu1.1_amd64.deb
apt-get install libsqlite3-dev libpq-dev libmysqlclient-dev uuid-dev libpcrecpp0 libpcre3-dev
dpkg --force-depends -i libaprutil1-dev_1.3.9+dfsg-1ubuntu1.1_amd64.deb
wget http://launchpadlibrarian.net/59612303/apache2-prefork-dev_2.2.12-1ubuntu2.4_amd64.deb
dpkg --force-depends -i apache2-prefork-dev_2.2.12-1ubuntu2.4_amd64.deb
cd php5-5.2.10.dfsg.1/
dpkg-buildpackage -rfakeroot
#FINALLY COMPILED, PROCEED TO REMOVE ALL CRAP AND RESTORE SYSTEM TO PREVIOUS STATE
aptitude
#(USED APTITUDE TO FIX CONFLICTS)
#(NOW REMOVE ALL THOSE SHIT PACKAGES YOU HAD TO INSTALL TO COMPILE)
apt-get remove libpng12-dev libpq-dev libpspell-dev librecode-dev libsasl2-dev libsnmp-dev libsqlite0-dev libt1-dev libtidy-dev libwrap0-dev libxmltok1-dev libxml2-dev libxslt1-dev
apt-get remove libmysqlclient-dev libncurses5-dev libpam0g-dev libpcre3-dev
apt-get install lm-sensors
apt-get autoremove
apt-get install lm-sensors
apt-get remove libfreetype6-dev libgcrypt11-dev libgd2-xpm-dev libgmp3-dev libjpeg62-dev libkrb5-dev libldap2-dev libmhash-dev
apt-get autoremove
apt-get remove comerr-dev krb5-multidev libapr1-dev libaprutil1-dev libdb4.8-dev libexpat1-dev libgssrpc4 libkadm5clnt-mit7 libkadm5srv-mit7 libkdb5-4 libkrb5-dev
apt-get remove comerr-dev krb5-multidev libapr1-dev libdb4.8-dev libexpat1-dev libgssrpc4 libkadm5clnt-mit7 libkadm5srv-mit7 libkdb5-4 libkrb5-dev libldap2-dev
apt-get remove libmysqlclient-dev libpcre3-dev libpcrecpp0 libpq-dev libsqlite3-dev uuid-dev
apt-get remove libldap2-dev libmysqlclient-dev libpcre3-dev libpcrecpp0 libpq-dev libsqlite3-dev uuid-dev
apt-get remove libxml2-dev libxslt1-dev
apt-get remove libgd2-xpm-dev libgmp3-dev libjpeg62-dev libkrb5-dev libldap2-dev libmhash-dev (>= 0.8.8) libmysqlclient-dev libncurses5-dev libpam0g-dev
apt-get remove libgd2-xpm-dev libgmp3-dev libjpeg62-dev libkrb5-dev libldap2-dev libmhash-dev libmysqlclient-dev libncurses5-dev libpam0g-dev
apt-get remove install bison chrpath flex freetds-dev libbz2-dev libcurl4-openssl-de...

Read more...

affects: ubuntu → php5 (Ubuntu)
Revision history for this message
Ondřej Surý (ondrej) wrote :

Yay, that's a way to go. Insult all the people who could possibly help you.

I don't see any bug here. If you really don't have any other machine and you have to do the bad thing called "mixing production and development environment" then you can use debootstrap to create chroot to isolate the build environment. Or better you pbuilder or cowbuilder, which are specifically created to solve this problem.

Revision history for this message
Ondřej Surý (ondrej) wrote :

There's no bug in default Ubuntu, the mix'n'match you described isn't supported by any sane distribution.

Changed in php5 (Ubuntu):
status: New → Invalid
Revision history for this message
RedScourge (redscourge) wrote :

Sorry for being rude, but as you might imagine this whole situation was frustrating, and it was not the first time some little thing about Ubuntu LTS caused me much main and suffering. Not as much as RedHat but that's another story. Getting logged in and posting was even more frustrating as the site intentionally makes it hard to post bug reports to keep out the stupid people I guess, and it's even harder when under maintenance as it was at the time. I can see how one might get tired of frustrated users, but then again that is almost entirely who comes here.

You may call needing to run PHP 5.2.X with the PHP version of the GD library on a recent server distro not "sane", but I wouldn't call a server distribution that does not offer an option for PHP 5.2.X with its included GD library as an option particularly "sane" either. I guess we server admins think you OS developers are insane, and you OS developers think we server admins are insane. I can only imagine then what the customers think of us then when we tell them they need to pay over $20,000 to port all their legacy code to PHP 5.3.X if they want a server OS that is still eligible for security updates.

Anyways, what I am trying to say is unless someone in this situation such as myself is willing to do something that is apparently not "sane", they cannot run their PHP code on Ubuntu LTS distributions, and this is all because two mildly related dev packages incorrectly claim that they depend on their corresponding non-dev packages. I hear this was solved in PHP 5.3.X as there is a seperate version of PHP and/or GD library that uses PHP's version of the GD library, but again, 5.3.X is not an option here.

I read online about installing 5.2.X on Lucid, and heard that you can just mess with /etc/apt/sources.list to let you install PHP 5.2.X from Karmic onto Lucid, then lock those packages to the Karmic versions so that they do not update to the Lucid versions, and you're good to go. Unfortunately, PHP made their own GD library version and you guys did not want to use it due to security concerns, so instead I used a Karmic source package, made it use PHP's GD library instead of the Ubuntu system version, and tried to compile that as a solution, whereupon I ran into the previously mentioned dependency issues.

If you know of a better AND simpler way for the thousands of server admins like me who need to install the PHP 5.2.X and PHP GD library on Lucid, PLEASE let us know as it would benefit us all. I know you do not want people posting bug reports about this stuff, and we don't want to have to bang our heads on the desk this many times to just get it to work.

I realize this will all probably either fall on deaf ears, or be too long to read and ignored, and so not fixed. That's okay however, my main concern is that people doing Google searches about this same issue might find this bug report and thus learn how to solve the problem.

Revision history for this message
Ondřej Surý (ondrej) wrote :

> If you know of a better AND simpler way for the thousands of server
> admins like me who need to install the PHP 5.2.X and PHP GD library on
> Lucid, PLEASE let us know as it would benefit us all. I know you do not
> want people posting bug reports about this stuff, and we don't want to
> have to bang our heads on the desk this many times to just get it to
> work.

I already did, use the pbuilder or separate build machine.

There are too many options after that. I would recommend checking out the php5 packaging git repository available at: http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=summary and build the package using git-buildpackage. Some instructions are available at http://wiki.debian.org/PHP/GitUsage.

However there's a major problem and that's security. The latest 5.2.x available is 5.2.10 and you should really update it to 5.2.17 to get at least some security updates. It's not that big deal, but it takes some time. You will have to adjust the Debian patches (using quilt push && quilt refresh + some manual editing).

You also have the same problem with karmic php5 which is also obsolete and unmaintained.

If you need less generic help than that, send me an email, I'm sure we can arrange something.

Revision history for this message
RedScourge (redscourge) wrote :

Holy cow you're right, I definitely need to get to 5.2.17 somehow.

I've compiled PHP before with configure and make, but I'm not familiar at all with any of these other build tools you mention. I'm sure nobody wants to be teaching everyone how to do all this stuff or be doing it for them. Could you recommend any FAQ pages or wikis which would allow someone with absolutely rudimentary knowledge of compiling like myself to be able to learn how to compile packages that can properly be used with APT to satisfy dependencies?

I've heard there are the virtual packages one can use, but it strikes me that if I do not learn to compile PHP as close as possible to the Ubuntu way, I will not have the maximum level of compatibility.

Revision history for this message
Ondřej Surý (ondrej) wrote :

I am afraid you'll have to use the Google, I don't know of any FAQs or wikis apart from those I already sent you, so that's exactly what I would have to do.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.