Skip to content
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

如何自定义每个依赖库的编译选项,添加自己想要的其他库? #287

Closed
Endy-c opened this issue Dec 15, 2023 · 9 comments
Labels
kind/dependency Issues related to dependencies need response question Further information is requested

Comments

@Endy-c
Copy link

Endy-c commented Dec 15, 2023

No description provided.

@jingjingxyk
Copy link
Contributor

jingjingxyk commented Dec 15, 2023

关键就是修改这个文件 https://github.com/crazywhalecc/static-php-cli/blob/main/config/ext.json

修改 lib-depends 项 或者 lib-suggests 项

例子:

    "gd": {
        "type": "builtin",
        "arg-type": "custom",
        "arg-type-windows": "with",
        "lib-depends": [
            "zlib",
            "libpng"
        ],
        "ext-depends": [
            "zlib"
        ],
        "lib-suggests": [
            "libavif",
            "libwebp",
            "libjpeg",
            "freetype"
        ]
    },

@crazywhalecc crazywhalecc added question Further information is requested kind/dependency Issues related to dependencies labels Dec 15, 2023
@Endy-c
Copy link
Author

Endy-c commented Dec 18, 2023

我指的是这样的编译选项:CFLAGS='' CC='x86_64-linux-musl-gcc -static -idirafter /software/spc/buildroot/include -idirafter /usr/include/ -idirafter /usr/include/x86_64-linux-gnu/ ' ./Configure no-shared zlib --prefix=/ --libdir=lib -static --with-zlib-include=/software/spc/buildroot/include --with-zlib-lib=/software/spc/buildroot/lib no-legacy linux-x86_64

@Endy-c
Copy link
Author

Endy-c commented Dec 18, 2023

[15:27:06] [INFO] enabling gd without library libavif
[15:27:06] [INFO] enabling gd without library libwebp
[15:27:06] [INFO] enabling gd without library libjpeg
[15:27:06] [INFO] enabling gd without library freetype
指定了--with-libs=libwebp,但enable-gd的时候仍然是without library libwebp
这个编译选项没有找到在什么地方修改

@crazywhalecc
Copy link
Owner

指定了--with-libs=libwebp,但enable-gd的时候仍然是without library libwebp

只要编译 gd 扩展时包含了 --with-libs=libwebp,就会启用 webp 支持。我刚才试了下是这样的。不过你上面提到的 log 中显示 without library libwebp 确实是个问题,但仅限于显示,后面我会修复显示问题。

@Endy-c
Copy link
Author

Endy-c commented Dec 18, 2023

指定了--with-libs=libwebp,但enable-gd的时候仍然是without library libwebp

只要编译 gd 扩展时包含了 --with-libs=libwebp,就会启用 webp 支持。我刚才试了下是这样的。不过你上面提到的 log 中显示 without library libwebp 确实是个问题,但仅限于显示,后面我会修复显示问题。

我检查了日志里面EXEC里的./configure,编译选项里的确没有--with-webp,但是编出来的cli文件的确-i里有webp,很奇怪。另外把configure命令重新到php-src里执行,不能检测通过libevent_core

checking PHP version... PHP 8.x
checking for include/event2/event.h... found in /software/spc/buildroot
checking for libevent version... ok
checking for event_free in -levent_core... no
configure: error: event_free not found in event_core library, or the library is not installed

@Endy-c
Copy link
Author

Endy-c commented Dec 19, 2023

指定了--with-libs=libwebp,但enable-gd的时候仍然是without library libwebp

只要编译 gd 扩展时包含了 --with-libs=libwebp,就会启用 webp 支持。我刚才试了下是这样的。不过你上面提到的 log 中显示 without library libwebp 确实是个问题,但仅限于显示,后面我会修复显示问题。

我检查了日志里面EXEC里的./configure,编译选项里的确没有--with-webp,但是编出来的cli文件的确-i里有webp,很奇怪。另外把configure命令重新到php-src里执行,不能检测通过libevent_core

checking PHP version... PHP 8.x
checking for include/event2/event.h... found in /software/spc/buildroot
checking for libevent version... ok
checking for event_free in -levent_core... no
configure: error: event_free not found in event_core library, or the library is not installed

这个问题解决了,原因是putenv设置的环境变量没有用export等效设置到shell当中。
现在在shell下靠手动加了--with-webp编译选项,额外添加了libwebp.a lib libsharpyuv.a,成功编译了自己需要的静态cli和fpm。但是对项目结构还不熟悉,不知道在什么地方修改,没法提PR

@crazywhalecc
Copy link
Owner

crazywhalecc commented Dec 20, 2023

我刚才试了下这个 log 提示的问题,似乎最新的分支没有这个问题。而且目前除了还没有关闭的几个 Issue 涉及的扩展外,其他扩展应该都可以正常使用,不需要修改任何代码。

image

@Endy-c
Copy link
Author

Endy-c commented Dec 21, 2023 via email

@crazywhalecc
Copy link
Owner

crazywhalecc commented Dec 23, 2023

试了很多次 spc 二进制,似乎也都没有你提到的问题。

另外,关于这个 Issue 的标题,你可以参考刚才提交的对于 uv 扩展的支持和 redis 额外特性的支持修改了哪些文件,这是典型的扩展和依赖库添加的改动。#296 #295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/dependency Issues related to dependencies need response question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants