Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork337
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi I assume your builds dont have php-glfw in them yet, I tried to run some code that uses that extension, I got some errors. thanks! hmm it says it has glfw in it but cannot be linked statically? what does that mean I have the extension added to my regular php and it works, Id like to get yours working too |
BetaWas this translation helpful?Give feedback.
All reactions
I took a look at this and it has an insane dependency tree that, among others, also includes the whole massive X11 system. The only feasible solution for this is to link against systen glfw dynamically, which can be done with SPC_TARGET="musl -dynamic" for Alpine or SPC_LIBC=glibc for glibc systems like Debian, Ubuntu, Mint, RHEL or anything in between. You need to add glfw ext to the project yourself and use PKG_CONFIG_PATH=/usr/lib(64)/pkgconfig bin/spc build ...
But you do not end up with a portable binary. Every user will then need to have the correct glfw version installed to even run your php binary for anything.
Replies: 6 comments 12 replies
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
glfw depends on OpenGL(required) and X11(alternative in Linux). These libraries cannot be compiled statically, or it's very difficult. On macOS platform, we can dynamically link the system framework and ship it with no pain, just not use the old version of macOS. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I mentioned a similar idea in#58, which is to compile with glibc-gcc under Linux and statically link all other libraries except glibc. The advantage of compiling in this way is that you can distribute and use it under a system that uses gnu-libc as libc, and supports dynamic loading of external extensions. But this also imposes requirements on the system environment, and is of little help to extensions such as glfw that use system libraries. |
BetaWas this translation helpful?Give feedback.
All reactions
-
There has to be a way, bundling the php code with different executables for different operating systems could be automated on a website for example |
BetaWas this translation helpful?Give feedback.
All reactions
-
Can you write down the exact problem with details, so I can share it around with people who may come up with a solution? Is your problem that your solution imposes requirements on the system environment? Then can you for example make one that works for me for example? |
BetaWas this translation helpful?Give feedback.
All reactions
-
also: so this is a linux / opengl problem, correct? not a php problem ? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Exactly. php-glfw extension and php itself can be easily statically compiled. Many of the extensions I completed before that took a lot of time to implement were also due to this: static compilation of dependent libraries is troublesome. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
linux build reference : Off-screen Rendering. https://docs.mesa3d.org/osmesa.html |
BetaWas this translation helpful?Give feedback.
All reactions
-
thanks, |
BetaWas this translation helpful?Give feedback.
All reactions
-
Compiling mesa3d is another big problem. It uses meson for building, which I'm not very familiar with. For now I have a question: Do you need just a standalone php file or a php binary distribution that is portable to almost any Linux? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
With glfw I found that writing 3d games can be incredibly easy, For starters, I would like a binary that can run on linux mint, my distro. I also have an idea for making apps in php, in Android. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Do you have an email address? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I understand. It doesn't sound like a scenario that completely requires static compilation. What is more needed is a system-level PHP migration solution. This idea I mentioned in#58 is basically to build a standalone PHP binary that can rely on some system libraries. But unfortunately, even so, trying to statically link these huge system-level underlying UI libraries is tantamount to packaging half of the operating system into a PHP binary, which is very unrealistic. If you want to implement transplantation to different platforms or distributions, there is an idea to consider: making a PHP distribution just like making In short: If your main consideration is binary portability, all cases that rely on static compilation are the most convenient for portability, but some libraries (such as X11, mesa3d, OpenGL, etc. that glfw depends on) are almost difficult to compile statically. If you are only running under a specific distribution (for example, only Ubuntu with the Xorg desktop environment), then you can compile it under Ubuntu in the same environment, and then distribute the php binary with glfw and let it use the system's dynamic library. |
BetaWas this translation helpful?Give feedback.
All reactions
-
BetaWas this translation helpful?Give feedback.
All reactions
-
Looks like almost-statically linked binaries for Linux and macOS is possible to add glfw in the php-cli or micro.sfx. But yet I haven't tried it. Alternatively, the latest static-php-cli can build shared extension too (portable so file), that may also help glfw extension build for Linux. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I took a look at this and it has an insane dependency tree that, among others, also includes the whole massive X11 system. The only feasible solution for this is to link against systen glfw dynamically, which can be done with SPC_TARGET="musl -dynamic" for Alpine or SPC_LIBC=glibc for glibc systems like Debian, Ubuntu, Mint, RHEL or anything in between. You need to add glfw ext to the project yourself and use PKG_CONFIG_PATH=/usr/lib(64)/pkgconfig bin/spc build ... But you do not end up with a portable binary. Every user will then need to have the correct glfw version installed to even run your php binary for anything. |
BetaWas this translation helpful?Give feedback.