Closed abirchall closed 4 years ago
Please update your composer
installation as follow :
$ composer self-update
Issue : previously, we used hhvm to run composer ( hhvm $(which composer) require ...
), but recently, hhvm became unable to run composer as composer uses php references, a change was made to composer so that it executes hhvm --version
to retrieve HHVM version and check it against composer.json instead of relying on HHVM_VERSION
constant when its running under hhvm.
It looks like his composer is already up to date? Perhaps you have php
aliased/symlinked to point at hhvm
?
If you do have it aliased you don't want to change that, you can also run it explicitly with php like /usr/bin/php /usr/local/bin/composer require facebook/xhp-lib
i don't think that's the case.
you are running this with PHP and not HHVM.
under hhvm ( see : https://github.com/composer/composer/blob/79a300eaac89be9a4b05cd992930f343ba4f084d/src/Composer/DependencyResolver/Problem.php#L111 and https://github.com/composer/composer/blob/ff246e3e85cc972d3c66c3b66aa233415cc5ed89/src/Composer/DependencyResolver/Rule.php#L174 )composer will sometimes say that if there are other unresolvable dependency issues. I'm not sure of the exact case.
That said, I can't reproduce this on a clean checkout.
Thanks for the fast responses!
run it explicitly with php like
/usr/bin/php /usr/local/bin/composer require facebook/xhp-lib
This results in the same behavior.
run
composer self-update
It's already up to date:
abirchall-fb[abdev](master): composer self-update
You are already using composer version 1.9.2 (stable channel).
Could you paste your full composer.json and composer.lock?
The contents are in my first post; it's a clean composer.json
(with no requirements yet) and there is no lock file yet as I've yet to install anything.
How did you install hhvm?
Using Homebrew: brew install hhvm
.
I also installed composer via Homebrew.
Is this on an FB-managed machine?
It's on my FB work laptop (MacBook).
which hhvm
and which hh_single_compile
say?brew doctor
report any problems?hhvm --php -r 'echo HHVM_VERSION."\n";'
?(FB chef doesn't like homebrew being in /usr/local, but HHVM's packages aren't relocatable)
Is homebrew installing in it's default location - /usr/local/ - or somewhere else? what do which hhvm and which hh_single_compile say?
abirchall-fb[abdev](master): which hhvm; which hh_single_compile; which composer; which php
/usr/local/bin/hhvm
/usr/local/bin/hh_single_compile
/usr/local/bin/composer
/usr/bin/php
abirchall-fb[abdev](master): ls -la /usr/local/bin/hhvm /usr/local/bin/composer /usr/bin/php /usr/local/bin/hh_single_compile
-rwxr-xr-x 1 root wheel 11169664 May 4 2019 /usr/bin/php
lrwxr-xr-x 1 abirchall wheel 37 Jan 31 01:43 /usr/local/bin/composer -> ../Cellar/composer/1.9.2/bin/composer
lrwxr-xr-x 1 abirchall admin 35 Jan 12 01:30 /usr/local/bin/hhvm -> ../Cellar/hhvm-4.39/4.39.0/bin/hhvm
lrwxr-xr-x 1 abirchall admin 48 Jan 12 01:30 /usr/local/bin/hh_single_compile -> ../Cellar/hhvm-4.39/4.39.0/bin/hh_single_compile
what's the output of
hhvm --php -r 'echo HHVM_VERSION."\n";'
?
This may be a hint in the right direction...
abirchall-fb[abdev](master): hhvm --php -r 'echo HHVM_VERSION."\n";'
Failed to initialize central HHBC repository:
Failed to initialize schema in /Users/abirchall/.hhvm.hhbc(rw-r--r-- root:group does not exist):
Assertion failure: /tmp/hhvm-4.39-20200107-19145-1nyzk4l/hhvm-4.39.0/hphp/runtime/vm/repo.cpp:652: auto HPHP::Repo::initCentral()::(anonymous class)::operator()() const: assertion `false' failed.
Failed to initialize central HHBC repository:
Failed to initialize schema in /Users/abirchall/.hhvm.hhbc(rw-r--r-- root:group does not exist):
-------------------------------Assertion Message--------------------------------
Failed to initialize central HHBC repository:
Failed to initialize schema in /Users/abirchall/.hhvm.hhbc(rw-r--r-- root:group does not exist):
-------------------------------Assertion Failure--------------------------------
/tmp/hhvm-4.39-20200107-19145-1nyzk4l/hhvm-4.39.0/hphp/runtime/vm/repo.cpp:652: auto HPHP::Repo::initCentral()::(anonymous class)::operator()() const: assertion `false' failed.
Core dumped: Abort trap: 6
Stack trace in /tmp/stacktrace.87134.log
Abort trap: 6
But if I use sudo, it's fine:
abirchall-fb[abdev](master): sudo hhvm --php -r 'echo HHVM_VERSION."\n";'
4.39.0
Interesting, /Users/abirchall/.hhvm.hhbc
was owned by root:
abirchall-fb[abdev](master): ls /Users/abirchall/.hhvm.hhbc
-rw-r--r-- 1 root 1876110778 3694592 Jan 31 23:29 /Users/abirchall/.hhvm.hhbc
I removed it and it was re-generated (owned by my user) when I ran hhvm --php -r 'echo HHVM_VERSION."\n";'
:
abirchall-fb[abdev](master): ls /Users/abirchall/.hhvm.hhbc
-rw-r--r-- 1 abirchall 1876110778 3694592 Jan 31 23:31 /Users/abirchall/.hhvm.hhbc
... and then after this composer worked:
abirchall-fb[abdev](master): composer require facebook/xhp-lib
Using version ^3.0 for facebook/xhp-lib
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
- Installing hhvm/hsl (v4.40.0): Downloading (100%)
- Installing hhvm/type-assert (v3.7.3): Downloading (100%)
- Installing facebook/xhp-lib (v3.0.1): Downloading (100%)
Writing lock file
Generating autoload files
Will leave this open in case there's anything we should do to try to catch and mitigate this.
Closing; this probably belong as an issue against facebook/hhvm to send a PR improving composer's error handling in this case, or an issue against composer itself. Composer is probably 'more correct', but more likely to be seen by the right people on facebook/hhvm
See the following console output. Any ideas? hhvm docs appear to say the latest version of composer will auto-detect whether to run with php or hhvm, could that be broken?