静态php编译加扩展错误

z

我想打包一个含这些扩展的静态php https://www.workerman.net/download
这里的没有mongodb和imagick

bin/spc build --build-cli "apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,mongodb,imagick"

按照 https://github.com/crazywhalecc/static-php-cli 的步骤
执行编译命令 的时候提示

[11:05:24] [CRIT] Build failed with SPC\exception\RuntimeException: Command run failed with code[2]: cd '/www/static-php/static-php-cli/source/openssl' && CFLAGS='' CC='x86_64-linux-musl-gcc -static -idirafter /www/static-php/static-php-cli/buildroot/include -idirafter /usr/include/  -idirafter /usr/include/x86_64-linux-gnu/ '  ./Configure no-shared zlib --prefix=/ --libdir=lib -static --with-zlib-include=/www/static-php/static-php-cli/buildroot/include --with-zlib-lib=/www/static-php/static-php-cli/buildroot/lib no-legacy linux-x86_64 1>/dev/null 2>&1
[11:05:24] [CRIT] Please check with --debug option to see more details.

加--debug 显示这个 AI 提示要安装 sudo yum install openssl-devel 也已经安装了, 还是一样的错误

[DEBU] Running command with direct output: cd '/www/static-php/static-php-cli/source/openssl' && CFLAGS='' CC='x86_64-linux-musl-gcc -static -idirafter /www/static-php/static-php-cli/buildroot/include -idirafter /usr/include/  -idirafter /usr/include/x86_64-linux-gnu/ '  ./Configure no-shared zlib --prefix=/ --libdir=lib -static --with-zlib-include=/www/static-php/static-php-cli/buildroot/include --with-zlib-lib=/www/static-php/static-php-cli/buildroot/lib no-legacy linux-x86_64
Can't locate IPC/Cmd.pm in @INC (@INC contains: /www/static-php/static-php-cli/source/openssl/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /www/static-php/static-php-cli/source/openssl/external/perl/Text-Template-1.56/lib) at /www/static-php/static-php-cli/source/openssl/util/perl/OpenSSL/config.pm line 19.
BEGIN failed--compilation aborted at /www/static-php/static-php-cli/source/openssl/util/perl/OpenSSL/config.pm line 19.
Compilation failed in require at ./Configure line 23.
BEGIN failed--compilation aborted at ./Configure line 23.

   SPC\exception\RuntimeException 

  Command run failed with code[2]: cd '/www/static-php/static-php-cli/source/openssl' && CFLAGS='' CC='x86_64-linux-musl-gcc -static -idirafter /www/static-php/static-php-cli/buildroot/include -idirafter /usr/include/  -idirafter /usr/include/x86_64-linux-gnu/ '  ./Configure no-shared zlib --prefix=/ --libdir=lib -static --with-zlib-include=/www/static-php/static-php-cli/buildroot/include --with-zlib-lib=/www/static-php/static-php-cli/buildroot/lib no-legacy linux-x86_64

  at src/globals/functions.php:89
     85▕         logger()->debug('Running command with direct output: ' . $cmd);
     86▕     }
     87▕     $ret = passthru($cmd, $code);
     88▕     if ($code !== 0) {
  ➜  89▕         throw new \SPC\exception\RuntimeException('Command run failed with code[' . $code . ']: ' . $cmd, $code);
     90▕     }
     91▕     return $ret;
     92▕ }
     93▕ 

  1   src/SPC/util/UnixShell.php:44

  2   src/SPC/builder/linux/library/openssl.php:73
      SPC\util\UnixShell::exec()

[11:11:28] [CRIT] You can report this exception to static-php-cli GitHub repo.
548 3 0
3个回答

z

编译扩展的时候报错了, 有人遇到这个问题吗
截图
截图

  • 深蓝 2023-11-12

    使用github的actions试下看。

  • tanhongbin 2023-11-13

    咋说呢 这个静态 的技术 感觉 还是不太成熟,我每次用都是报错,就很迷

  • caylof 2023-11-13

    github action 我构建也报错,好像是关于 docker 什么的,有成功过的吗

  • 深蓝 2023-11-13

    我使用actions构建的,能正常构建,但是感觉打的包要比官方包要大好多,拓展也没多几个。

  • tanhongbin 2023-11-13

    反正很迷 actions 构建 现在报错呀

  • z 2023-11-13

    @深蓝 , 不知道是不是环境哪里的问题;也是报错@tanhongbin

  • 深蓝 2023-11-13

    应该是拓展的问题。

  • W 2024-03-24

    楼上有没有加了pgsql扩展编译成功的>=php8.1版本的php静态文件发一个给我,或者发到群里面

W

大佬解决了吗我也遇到了

  • 暂无评论
crazywhalecc

有关static-php编译出现问题的如果方便都最好提个 Issue,很有可能与编译环境有关。也可以at我。

  • tanhongbin 2024-03-27

    大佬 你也整一个群吧 有需要兄弟们就自己进群了,这样还能交流一下静态,我们生产环境使用有4个月了,嘎嘎稳定,给你点赞

  • W 2024-03-27

    @tanhonhbin 兄弟你的php静态文件加了pgsql和event扩展吗?能否分享一个到群里,或者给我947162821@qq.com

  • tanhongbin 2024-03-27

    pgsql 我没加 event加了 我看看能否成功给你加上pgsql哈

  • tanhongbin 2024-03-27

    大佬的 github actions 构建 又出现 ERROR: failed to solve: process "/bin/sh -c composer install --no-dev --classmap-authoritative" did not complete successfully: exit code: 2
    Unable to find image 'cwcc-spc-x86_64:latest' locally
    docker: Error response from daemon: pull access denied for cwcc-spc-x86_64, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
    See 'docker run --help'.
    Error: Process completed with exit code 125 这个错误了 就是docker需要登录

  • W 2024-03-27

    @tanhonhbin 感谢大佬,成功了发一个群里或者给我947162821@qq.com

  • tanhongbin 2024-03-28

    我也等 大佬回答呢哈哈,现在拉取新的代码 执行actions 打包 不管啥扩展都报错 ,估计是大佬的代码现在有点问题吧

  • W 2024-03-29

    那先等等,稳定了再试试

  • tanhongbin 2024-03-29

    我今天差不多能帮你打包一个,我基本搞明白了,我再自己构建打包呢

  • W 2024-03-29

    大佬,牛的

🔝