-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
static-build (manually, dockerfile with intl) not working #236
Comments
Edit: Building locally works with
i.e. with -buildmode=pie removed and -static-pie changed to -static. |
edit: with certain extension selections it actually seems necessary to pass -lstdc++ to LD_FLAGS (yes, to build frankenphp). |
That's weird because we use this Dockerfile in our CI and it's green. |
Yep, I figured it out why. When the pgsql extension is used, it links these parts into the embed api, when it's not, you need to link any program using the embed api with -libstdc++. The same thing happens with openssl, which requires lib zlib. When the extension zlib is used, it statically links the zlib methods into the embed api, if the zlib extension isn't enabled you need to link any program that uses the embed api with -lz. I'm not really sure how we can force the linker to always statically link everything. I'm not even sure why it doesn't do it in the first place, or why adding an extension convinces the linker to do it. |
Wow, it gets even weirder. php-config does list -lstdc++ as a dependency with just intl active.
Results in
Moving -lstdc++ to the end fixes it. |
It's php's fault... Building php embed with extra-libs: creates |
Mystery solved, I guess. It's really just the order of the includes that are somehow wrong in so many places. Now to figure out why |
For what it's worth, I found that php 8.2 works with opcache without disabling JIT. |
@DubbleClick do you think you can open a PR upstream for that? |
I've fixed it in #203, but the PR does a little bit of everything and I should probably split it up into different PRs. The --with-libs option also needs a few fixes before it works in SPC, but it's essential to get jpeg/webp support in gd or imagick |
I was trying to test frankenphp with ldap and c++ extensions (which were only compilable on musl-libc based systems before) but ran into error messages, so I attempted building from the spc/main branch, but ran into the same problem. So I tried to run the dockerfile and lo and behold, it also errors out, albeit with different problems.
The local errors somewhat make sense:
Local:
Docker:
Questions:
a) did you run into the same -fPIE error messages before or is that maybe specific to RHEL distros?
b) did you run into the same
*** Warning: Linking the shared library libphp.la against the *** static library /opt/static-php-cli/buildroot/lib/libldap.a is not portable!
message at some point and if so, how did you fix it?c) did you try compiling static frankenphp on non-alpine before?
d) it's the intl extension (icu lib) causing docker to fail compiling, but I see intl listed in the extensions it would build by default.
The text was updated successfully, but these errors were encountered: