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

Build micro error when using require #476

Closed
joelwurtz opened this issue Jun 10, 2024 · 7 comments
Closed

Build micro error when using require #476

joelwurtz opened this issue Jun 10, 2024 · 7 comments
Labels
bug Something isn't working kind/php-and-sapi Issues related to php source and SAPI

Comments

@joelwurtz
Copy link

Not sure what changed, but since a few days when we try to build micro and adding a phar to it does not work anymore, we go those kind of errors:

...

Warning: require(): Seek on self stream failed in phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/autoload_real.php on line 42

Warning: include(): Seek on self stream failed in phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php on line 576

Warning: include(): Seek on self stream failed in phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php on line 576

Warning: include(): Seek on self stream failed in phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php on line 576

Fatal error: Uncaught ErrorException: Warning: include(): Seek on self stream failed in phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php:576
Stack trace:
#0 phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php(576): include()
#1 phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('phar:///home/jo...')
#2 phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/symfony/error-handler/ErrorHandler.php(498): Composer\Autoload\ClassLoader->loadClass('Symfony\\Compone...')
#3 [internal function]: Symfony\Component\ErrorHandler\ErrorHandler->handleException(Object(ErrorException))
#4 {main}
  thrown in phar:///home/joelwurtz/Workspace/Oss/castor/castor.linux-amd64/vendor/composer/ClassLoader.php on line 576

I try using different versions of SPC, use specific version of PHP and even checkout specific version of phpmicro but we keep having this failure, not sure where it fails here.

Do you have some inputs on how to debug this so we can fix this error ?

@crazywhalecc crazywhalecc added bug Something isn't working kind/php-and-sapi Issues related to php source and SAPI labels Jun 10, 2024
@crazywhalecc
Copy link
Owner

If the problem only occurs with a recent build, it may be related to a major version upgrade of phpmicro. Could you provide a minimal reproducible phar or a process for building a phar?

@joelwurtz
Copy link
Author

joelwurtz commented Jun 10, 2024

With phar on this release : https://github.com/jolicode/castor/releases/tag/v0.17.1 i get the error

We execute those commands :

spc 'download' '--for-extensions=mbstring,phar,posix,tokenizer,pcntl,curl,filter,openssl' '--with-php=8.3'
spc 'build' 'mbstring,phar,posix,tokenizer,pcntl,curl,filter,openssl' '--build-micro' '--with-micro-fake-cli' '--arch=x86_64'
spc 'micro:combine' 'castor.linux-amd64.phar' '--output=castor.linux-amd64'

@crazywhalecc
Copy link
Owner

I just asked the author of phpmicro and debugged with him and found out that it should be a bug in phpmicro itself. We will fix it tomorrow.

@crazywhalecc
Copy link
Owner

phpmicro has fixed phar issue, remember cleaning buildroot and source, and bin/spc del-download micro && bin/spc download micro to download the latest micro repo to build.

@joelwurtz
Copy link
Author

Thanks a lot <3, and also thanks to the author of phpmicro for its quick reaction.

It seems to be working with last SPC version, however older versions still have the bug, (i think this fork https://github.com/static-php/phpmicro should be updated in order to make it work on older versions)

@crazywhalecc
Copy link
Owner

I've updated static-php fork repo 👏

@HallexCosta
Copy link

@crazywhalecc This new phpmicro update resolved the initial error, but now I'm getting a new error.
I followed the instructions to remove the buildroot and source folders bin/spc del-download micro && bin/spc download micro

However, when I try to run the binary with ./my-binary it shows the hyperf commands normally.image

Now if I try to run the server with the command ./my-binary start, it shows error logs
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kind/php-and-sapi Issues related to php source and SAPI
Projects
None yet
Development

No branches or pull requests

3 participants