-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional GNU C Library support #376
Comments
Alternatively, we may try to link everything statically except libc, which is part of POSIX anyway and should always be available: https://stackoverflow.com/a/58565307/1352334 This seems to be called "mostly-static linking": https://docs.oracle.com/en/graalvm/jdk/17/docs/reference-manual/native-image/guides/build-static-executables/#build-a-statically-linked-or-mostly-statically-linked-native-executable |
This is a complex issue. To sum up, the reasons why we use musl by default are as follows:
If you want to dig deeper:
|
To put it jokingly, the existence of this project is also due to the confusion of Linux libc and the fact that most early projects did not like static compilation. It would be better if Linux has default library and it provides all possibilities(dynamic and static) and is stable. LinuxBuilder is also more complex than MacOSBuilder and WindowsBuilder. |
Just as an addition to the listed problems (espevially static glibc linking still requiring dynamic libraries, so what's even the point): I've dabbled in dynamic linking with glibc before and ran into huge issues with different distros. It would be a lot of work to keep it working and stable for them all. There would be an advantage, mainly loading of dynamic extensions on glibc systems, but it also eliminates a major benefit of the project (compile it once, use it anywhere). |
After #403 merged, I can make a set of env variables for building glibc version of static-php. But we also need |
In the meantime, I've opened php/php-src#13877 which got some traction already: php/php-src#13925 It's possible PHP's musl support will get substantially better over time. |
@dunglas Today I evaluated the possibility of linking static-php using glibc. Unfortunately, doing so comes at a huge loss of portability. The main problem is not compilation, but the version of glibc. Because if we do not restrict compilation on a specific distro, the compiled static-php may require a newer glibc version, which cannot be used for older versions of the distro. A very simple example is: the results built on Debian11 cannot be used on Debian10. The result is similar to many closed source software: different binaries for each major version.
|
Thank you very much for working on this. I agree that it's a big limitation. Let's close this issue then? |
I will write the compilation variables based on glibc on doc or blog later, but obviously this will not become official support. Let's close this. |
@dunglas An interesting thing you may want to know: I only need to build Docker for a specific old glibc environment (e.g. CentOS 7 with an old toolchain, this is using glibc 2.17 as minimal glibc version), and with a patched This may be an optional feature, as musl-libc does have a lot of issues that cannot be solved directly (I also encountered some problems with musl recently). It is true that this work may not be done as a default target, but the it shows that SPC is capable of building another results. If you or anyone are interested, I can reopen this issue and related pr in the future. |
Adding FFI support - solves a huge number of problems, as it provides direct access to the system. If we exaggerate a little, then the presence of this extension makes all other extensions for PHP unnecessary, as you can write them yourself if you wish (lol). So personally, I am interested in this issue. |
This would help a lot FrankenPHP, I'm definitely interested! |
Currently, Musl is used, but there are many known issues with Musl.
Would it be possible to add a flag to use the static glibc instead of Musl?
The text was updated successfully, but these errors were encountered: