Skip to content

Linux arm64 support? #529

Open
Open

Description

@rydan313

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.

Activity

  1. rydan313 commented on May 26, 2024

    @rydan313
    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.

  2. dinamic commented on Jun 7, 2024

    @dinamic

    @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
    =====================================================================
    
  3. dinamic commented on Jun 11, 2024

    @dinamic

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions