如何跨版本编译PHP扩展?
如何编译一个适用于每个版本的 PHP 以及每个版本的 Linux 的 PHP 扩展?
How to compile a PHP extension that will work on every version of PHP as well as every version of Linux?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要为每个平台编译一次(Windows 库不能在 GNU/Linux 上运行,就像 64 位库不能在 32 位环境中运行一样)。如果这就是您想要做的,那么答案是:这是不可能的。
You'll need to compile it once for every platform (a Windows library won't run on GNU/Linux, just as well as a 64-bit library won't run in a 32-bit environment). If this is what you are trying to do, the answer is: it's impossible.
您将无法创建“与一切兼容”的二进制包。
为了实现最大的兼容性,我建议您使用
package.xml
文件将文件打包在 tarball 中,就像分发 PECL 包一样。这将允许某人在任何地方轻松编译/安装该包。You won't be able to create a "compatible with everything" binary package.
To allow for maximum compatibility I'd recommend that you package the file in a tarball with a
package.xml
file in the same way that PECL packages are distributed. This would allow someone to easily compile/install the package anywhere.这是不可能的——在 java 中甚至不可能
That's not possible - its not even possible in java
我问过类似的问题,并得到了一个非常明智的建议:
如何构建在多个 PHP 版本中运行的 PHP 扩展?
I have asked a similar question and was given a very sensible suggestion:
How to build a PHP extension that runs in many PHP versions?