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

Linux arm64 support? #529

Open
rydan313 opened this issue May 21, 2024 · 3 comments
Open

Linux arm64 support? #529

rydan313 opened this issue May 21, 2024 · 3 comments

Comments

@rydan313
Copy link

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.

@rydan313
Copy link
Author

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
Copy link

dinamic commented Jun 7, 2024

@rydan313 I've got Macbook Pro with M1 on it. It uses arm64 as well.

Darwin mbp-pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

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.

=====================================================================
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
=====================================================================

@dinamic
Copy link

dinamic commented Jun 11, 2024

@rydan313 I hope this worked for you. Let me know if there's something I could improve in the gist. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants