Build instructions for Ubuntu 18.04 (and other systems)

  107116
September 15, 2019 18:49 nikita.ppv@gmail.com (Nikita Popov)
Hi,

Our build instructions in
https://github.com/php/php-src#building-php-source-code are currently a bit
bare... they show the basic "./buildconf && ./configure && make" cycle, but
everyone who actually tries this will quickly find out that there is a lot
more to building PHP...

Every time I compile PHP on a new system, I have to go through a pretty
long cycle of ./configure --xxx, wait until there is an error, "sudo apt
install libxxx-dev" and so on.

It would be great if someone could write up the required "apt get" and
"./configure" line to get a "reasonably large" build of PHP on a popular
Linux distro like Ubuntu 18.04, so this can be included in the README.
Something similar for MacOS would probably also be useful, where things are
even more complicated.

Bonus points for also including how to set up MySQL and Postgres in a way
that you can run mysqli/pdo_mysql and pgsql/pdo_pgsql tests. I think I lose
a couple of hours every time I try to get this working.

Anyone interested in doing this?

Regards,
Nikita
  107120
September 15, 2019 20:42 d.takken@xs4all.nl (Dik Takken)
On 15-09-19 20:49, Nikita Popov wrote:
> > Anyone interested in doing this? >
Hi Nikita, May I suggest to provide instructions to build using Docker? This has a number of advantages: * Same instructions will work on Linux, MacOS and Windows * No need to install build dependencies on your host * Spin up a MySQL container by running 'docker run mysql:version' I took this route a while ago when I needed to setup a dev environment and it works nicely. I could do a write-up of this route if desired. Part of the instructions could be cast into a Docker image that can be published on Github and Docker Hub. This image could even have the command to run the tests baked into the image itself. Then, anyone can just run docker run php-tests:7.4 to build the sources and run the tests. For development you can mount your local git clone in the container. Regards, Dik Takken
  107121
September 15, 2019 20:53 carusogabriel34@gmail.com (Gabriel Caruso)
Hello Dik

On Sun, Sep 15, 2019, 22:42 Dik Takken takken@xs4all.nl> wrote:

> On 15-09-19 20:49, Nikita Popov wrote: > > > > Anyone interested in doing this? > > > > Hi Nikita, > > May I suggest to provide instructions to build using Docker? This has a > number of advantages: > > * Same instructions will work on Linux, MacOS and Windows > * No need to install build dependencies on your host > * Spin up a MySQL container by running 'docker run mysql:version' > > I took this route a while ago when I needed to setup a dev environment > and it works nicely. I could do a write-up of this route if desired. > > Part of the instructions could be cast into a Docker image that can be > published on Github and Docker Hub. This image could even have the > command to run the tests baked into the image itself. Then, anyone can > just run > > docker run php-tests:7.4 > > to build the sources and run the tests. For development you can mount > your local git clone in the container. > > Regards, > Dik Takken > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
The main problem with Docker and php-src is that we need to touch the OS in order to make sure the new features and bugfixes will be compatible. Docker create a layer on top of that, right? Best regards,
> >
  107123
September 15, 2019 21:21 d.takken@xs4all.nl (Dik Takken)
On 15-09-19 22:53, Gabriel Caruso wrote:
> > > The main problem with Docker and php-src is that we need to touch the OS in > order to make sure the new features and bugfixes will be compatible. > > Docker create a layer on top of that, right? >
Correct. Honestly I was not considering the use case of testing interactions with OS-specific features as one might do using a CI/CD setup. Providing instructions that will work for every supported target environment is not an easy thing to do. I was thinking about the use case of local development where the developer needs to build the sources on whatever OS he / she happens to be using. Then, Docker makes much more sense as it provides a single consistent environment that will work the same way for anyone.
  107124
September 15, 2019 21:43 marandall@php.net (Mark Randall)
On 15/09/2019 21:53, Gabriel Caruso wrote:
> The main problem with Docker and php-src is that we need to touch the OS in > order to make sure the new features and bugfixes will be compatible.
What in particular needs to be adjusted at OS level to make testing work? If there's a list we can probably find a way around it, at least when running containerised. Are you referring to installing shared libraries on the host? -- Mark Randall
  107122
September 15, 2019 21:12 smalyshev@gmail.com (Stanislav Malyshev)
Hi!

> May I suggest to provide instructions to build using Docker? This has a > number of advantages: > > * Same instructions will work on Linux, MacOS and Windows > * No need to install build dependencies on your host > * Spin up a MySQL container by running 'docker run mysql:version'
This is certainly a good idea to have Docker build instructions as an option, but would not be good as the only or primary option. There are lots of situations where installing the whole docket setup on a host is either hard or an overkill for just building PHP. But as an option it's good.
> I took this route a while ago when I needed to setup a dev environment > and it works nicely. I could do a write-up of this route if desired.
I think having good docker-based build instructions would certainly be appreciated.
> Part of the instructions could be cast into a Docker image that can be > published on Github and Docker Hub. This image could even have the > command to run the tests baked into the image itself. Then, anyone can > just run > > docker run php-tests:7.4 > > to build the sources and run the tests. For development you can mount > your local git clone in the container.
Sounds like a nice idea. -- Stas Malyshev smalyshev@gmail.com
  107125
September 15, 2019 22:00 aegir@aegir.sexy (Aegir Leet)
Not super familiar with building PHP, but this should be a reasonable
starting point, tested on a fresh install of Ubuntu 18.04.3:

apt install -y autoconf gcc bison re2c libxml2-dev libssl-dev
libsqlite3-dev libcurl4-openssl-dev libpng-dev libwebp-dev libjpeg-dev
vflib3-dev libc-client-dev libkrb5-dev libonig-dev libreadline-dev
libsodium-dev libargon2-0-dev libzip-dev ./buildconf ./configure
--enable-fpm --with-openssl --with-kerberos --with-imap-ssl
--with-pcre-jit --with-zlib --enable-bcmath --with-curl --enable-exif
--enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype
--with-gettext --with-imap --enable-intl --enable-mbstring --with-mysqli
--enable-pcntl --with-pdo-mysql --with-readline --enable-sockets
--with-sodium --with-password-argon2 --with-zip --enable-zts


On 15.09.2019 20:49, Nikita Popov wrote:
> Hi, > > Our build instructions in > https://github.com/php/php-src#building-php-source-code are currently a bit > bare... they show the basic "./buildconf && ./configure && make" cycle, but > everyone who actually tries this will quickly find out that there is a lot > more to building PHP... > > Every time I compile PHP on a new system, I have to go through a pretty > long cycle of ./configure --xxx, wait until there is an error, "sudo apt > install libxxx-dev" and so on. > > It would be great if someone could write up the required "apt get" and > "./configure" line to get a "reasonably large" build of PHP on a popular > Linux distro like Ubuntu 18.04, so this can be included in the README. > Something similar for MacOS would probably also be useful, where things are > even more complicated. > > Bonus points for also including how to set up MySQL and Postgres in a way > that you can run mysqli/pdo_mysql and pgsql/pdo_pgsql tests. I think I lose > a couple of hours every time I try to get this working. > > Anyone interested in doing this? > > Regards, > Nikita >
  107225
September 18, 2019 23:12 bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=)
Den 2019-09-15 kl. 20:49, skrev Nikita Popov:

> Hi, > > Our build instructions in > https://github.com/php/php-src#building-php-source-code are currently a bit > bare... they show the basic "./buildconf && ./configure && make" cycle, but > everyone who actually tries this will quickly find out that there is a lot > more to building PHP... > > Every time I compile PHP on a new system, I have to go through a pretty > long cycle of ./configure --xxx, wait until there is an error, "sudo apt > install libxxx-dev" and so on. > > It would be great if someone could write up the required "apt get" and > "./configure" line to get a "reasonably large" build of PHP on a popular > Linux distro like Ubuntu 18.04, so this can be included in the README. > Something similar for MacOS would probably also be useful, where things are > even more complicated. > > Bonus points for also including how to set up MySQL and Postgres in a way > that you can run mysqli/pdo_mysql and pgsql/pdo_pgsql tests. I think I lose > a couple of hours every time I try to get this working. > > Anyone interested in doing this? > > Regards, > Nikita
Hi, If it's not done already I could take a swing a bit later in early October for a Centos 7.7 distro. r//Björn L