Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

when will glfw be included in the binary builds?#191

Answeredbyhenderkes
odarcan asked this question inQ&A
Discussion options

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.
When will they be included?

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

@crazywhalecc

You must be logged in to vote

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

Comment options

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.

You must be logged in to vote
8 replies
@crazywhalecc
Comment options

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.

@odarcan
Comment options

There has to be a way,
I have a php installed with glfw, and it starts 3d programs written in php, instantly and I think it has potential to be a new cross-os game platform thing, the php code of the program could be written once and distributed to many operating systems,since you have already made it for mac and win, what remains is linux, then I can keep nagging for whatever else is missing.

bundling the php code with different executables for different operating systems could be automated on a website for example

@crazywhalecc

@odarcan
Comment options

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?
Can you make one that works for latest Mint users?
or one for latest Ubuntu users?

@odarcan
Comment options

@crazywhalecc

also: so this is a linux / opengl problem, correct? not a php problem ?

@crazywhalecc
Comment options

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.

Comment options

linux build reference : Off-screen Rendering.

https://docs.mesa3d.org/osmesa.html
https://stackoverflow.com/questions/10209663/statically-linked-opengl-library-on-windows

You must be logged in to vote
0 replies
Comment options

thanks,
If "mesa3d" was used, would it work?
@jingjingxyk@crazywhalecc

You must be logged in to vote
4 replies
@crazywhalecc
Comment options

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?

@odarcan
Comment options

With glfw I found that writing 3d games can be incredibly easy,
I would like to be able to distribute it to others without having them install the glfw library or php (if they dont have it already), also there is the problem of having correct version of php, these would all hinder easy distribution.

For starters, I would like a binary that can run on linux mint, my distro.
but main thing is the glfw part, can it be included for mint?


I also have an idea for making apps in php, in Android.
Can you make binaries for android?
if yes I will explain more.

@odarcan
Comment options

Do you have an email address?

@crazywhalecc
Comment options

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.deb software. When you publish, you can write automatic build processes for multiple distributions and use them by different people. You need to download different versions of php files.

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.

Comment options

@crazywhalecc
https://www.glfw.org/

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Answer selected byhenderkes
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
4 participants
@odarcan@jingjingxyk@henderkes@crazywhalecc

[8]ページ先頭

©2009-2025 Movatter.jp