asdf-community/asdf-php

Rewrite to be based on php-build

smorimoto opened this issue ยท 17 comments

There is no benefit on our side to managing this too complex shell nightmare, and it should be managed centrally if possible.

Better yet, why not install php precompiled? That would make the plugin so much easier to use (no need to install build dependencies and wait for php to compile etc.)

Side rant: I can't believe it's 2021 and we still haven't shaken this "compile everything" idea in general oss. Right now, right this very second, there's millions of compiles of the same thing happening all over the world.

I don't mind. PR is always welcome.

Perhaps supporting both initially is the way to go. How about we transition to php-build but we cache the builds of individual versions somewhere online? So when someone wants to install a specific version, we:

  • Check if we have the build for this architecture cached already and if we do, just pull that and be done
  • If we don't have it cached, do the build via php-build and upload the artifacts to the build cache for the next person to benefit

Then the obvious question is, where can we host the builds for free?

What do you think?

The biggest issue is how to distribute the cache as you mentioned. Also, I'm not really familiar with PHP, but are they really relocatable? At this point, I don't have a clear ETA for php-build migration, so if you want to work on it, I recommend that you start by migrating to it first.

Sadly I'm not familiar with PHP either. My only contribution was the comment about avoiding compilation if possible but in retrospect it's not really useful.

In fact, there is no incentive to host the cache at all, and implementing something to make sure the cache is safe is quite a hassle. And we need to minimize the dependencies that it requires, and I don't want to do that. I won't stop if someone does it in another plugin, but I absolutely don't want to distribute third-party caches to users through this plugin.

I looked into this a bit. IMHO this codebase is way better organized, and actually supports a greater set of options than php-build. I'd vote for not moving over to use php-build.

The advantage of using php-build is that it can support more versions. Our current code only targets the latest version and does not support older versions. (There are some versions that can be built, but we can't say that they are officially supported.)

True, although there are some tradeoffs to consider. The downside is there are a lot of compilation options which are not supported in php-build (--with-gmp for instance). For me, this would be really problematic. Additionally, php-build doesn't seem to fix into the asdf super cleanly (the default assumption is you are using phpenv, although there could be an easy way around that.

We could expand the PHP version matrix in this github workflow to cover more PHP versions, although we still wouldn't have the larger test suite available to us and there would still be duplicated efforts.

The downside is there are a lot of compilation options which are not supported in php-build (--with-gmp for instance).

I don't think so: https://github.com/php-build/php-build/blob/master/man/php-build.1.ronn#environment

Somehow I had to come back to the PHP world. I've read some PR, but I'm sure what we need now is to rewrite the php-build based plugin. Does anyone want to tackle it?

Better yet, why not install php precompiled? That would make the plugin so much easier to use (no need to install build dependencies and wait for php to compile etc.)

Side rant: I can't believe it's 2021 and we still haven't shaken this "compile everything" idea in general oss. Right now, right this very second, there's millions of compiles of the same thing happening all over the world.

If you want to provide precompiled PHP, you have to also provide precompiled versions of many libraries used by PHP, for example OpenSSL, icu and others since PHP depends on them and user's system can have variety of versions (especially major versions).

There are currently not enough main maintainers for this plugin, so it would be nice if someone could do it. Furthermore, if anyone would like to replace this with a php-build-based implementation, I'd be happy to help.

There are currently not enough main maintainers for this plugin, so it would be nice if someone could do it. Furthermore, if anyone would like to replace this with a php-build-based implementation, I'd be happy to help.

I did some investigation, I still have CI broken for example (https://github.com/Tarik02/asdf-php). However this works for my local machine (Arch) it does not work on latest ubuntu machines. As I discovered, the problem is that ubuntu includes libxml which itself uses libicu (which I built together with php) of different version.

So, now I see the only approach is to build most of dependencies before building PHP and use them, e.g. whole prefix with dependencies for it. I'm gonna do more investigation about this.

For arch, it builds (assuming you have the needed dependencies) most verions like 5.6.40, 7.0.33, 7.1.33, 7.4, 8.1.10 and they work as expected. But for ubuntu it's completely broken.

Ok so, I just read this thread after mentioning you elsewhere @smorimoto. I think moving to php-build make sense as that is actively maintained and will drastically reduce the amount of maintenance required to keep this up to date.

As far as @moljac024's argument against building from source: I understand the frustration but the alternative requires quite a bit of work to streamline. Either way you go about it, it comes with it's own downsides. At least building from source keeps things relatively straight forward as most operating systems have or had access to the dependencies at some point in time.

there are a lot of deprecated packages required by php <= 7. No easy way to work with them.