You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to migrate to Amazon Graviton processors based on arm64. But I'm running into issues compiling this library when following the instructions at https://github.com/phpv8/v8js/blob/php8/README.Linux.md#compile-v8-56-and-newer-using-gn . I've done it successfully multiple times with x64 over the years but simply replacing with arm64 doesn't work and it seems there is very limited support from the v8 project itself to compile their library for this architecture. For instance the third instruction at https://v8.dev/docs/compile-arm64 indicates an option '--gcc-toolchain' that doesn't exist.
Do we have updated instructions on compiling this for this particular architecture? Are there any reports of anyone successfully doing this? I've tried versions 12.0.267.14, 8.9.255 (my current working x64 version), and 8.0.426.30.
I was able to get this to work on arm64. I was completely unable to build the v8 library on an arm64 machine though. I was forced to cross-compile from an x64 machine. When doing so the script that builds the gn arguments unfortunately sets the target_cpu to x64 while the v8_target_cpu is set correctly to arm64. I didn't catch this until trying to figure out why the v8js library wouldn't configure. So you have to manually edit the generated files to use the correct architecture. I also had to modify the unit tests in the v8 library because there's some compilation failure specific to arm64. Essentially I just commented out every test that referenced a removed class and then every function those tests referenced. Then I just copied over my newly compiled v8 library to the arm64 machine and completed the rest of the steps there. Seems to be working.
This was performed on the latest 12.0 release which at the moment of this writing is 12.0.267.27. I performed this on Ubuntu 24.04.
No tests are failing, one is being skipped - because it's a non-zts build and pthreads is not available. If you need pthreads, you could base off php:8.3-zts-bookworm.
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 32
---------------------------------------------------------------------
Number of tests : 181 180
Tests skipped : 1 ( 0.6%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 0 ( 0.0%) ( 0.0%)
Tests passed : 180 ( 99.4%) (100.0%)
---------------------------------------------------------------------
Time taken : 6 seconds
=====================================================================
Activity
rydan313 commentedon May 26, 2024
I was able to get this to work on arm64. I was completely unable to build the v8 library on an arm64 machine though. I was forced to cross-compile from an x64 machine. When doing so the script that builds the gn arguments unfortunately sets the target_cpu to x64 while the v8_target_cpu is set correctly to arm64. I didn't catch this until trying to figure out why the v8js library wouldn't configure. So you have to manually edit the generated files to use the correct architecture. I also had to modify the unit tests in the v8 library because there's some compilation failure specific to arm64. Essentially I just commented out every test that referenced a removed class and then every function those tests referenced. Then I just copied over my newly compiled v8 library to the arm64 machine and completed the rest of the steps there. Seems to be working.
This was performed on the latest 12.0 release which at the moment of this writing is 12.0.267.27. I performed this on Ubuntu 24.04.
dinamic commentedon Jun 7, 2024
@rydan313 I've got Macbook Pro with M1 on it. It uses arm64 as well.
Here's a gist that works for me with libnode available in the package manager. Feel free to look around and check if it works for you as well:
No tests are failing, one is being skipped - because it's a non-zts build and pthreads is not available. If you need pthreads, you could base off
php:8.3-zts-bookworm.dinamic commentedon Jun 11, 2024
@rydan313 I hope this worked for you. Let me know if there's something I could improve in the gist. 🙂
Split include and lib directory variables