Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

V8 6.7+ cannot be compiled on ARM/ARM64 #261

Closed
ignisf opened this issue Jul 6, 2018 · 11 comments
Closed

V8 6.7+ cannot be compiled on ARM/ARM64 #261

ignisf opened this issue Jul 6, 2018 · 11 comments

Comments

@ignisf
Copy link
Collaborator

ignisf commented Jul 6, 2018

Upstream issue: https://bugs.chromium.org/p/v8/issues/detail?id=6458 go star it :)

@thalyssra
Copy link

Is this due to the GN change? because it should build on both. An upstream issue link?

@ignisf
Copy link
Collaborator Author

ignisf commented Jul 7, 2018

@thalyssra, have not dug down enough to find out. The build fails due to missing gn binary for ARM.

@ignisf
Copy link
Collaborator Author

ignisf commented Jul 7, 2018

Also, when I tried to crosscompile for ARM, the CFLAGS included -march=x86-64 so I stopped it. This warrants more investigation but at this point I cannot spare the time. I would appreciate any hints ❤

@ignisf
Copy link
Collaborator Author

ignisf commented Jul 10, 2018

@thalyssra, I've linked the upstream issue above.

@thalyssra
Copy link

Let me poke someone I know who knows a bit more, I know he was looking into this a long time ago.

@steev
Copy link

steev commented Oct 12, 2018

@ignisf so, there were some upstream changes to gn (which is good!);

I'm not sure how easy it would be to script to replace, however, you should be able to do the following to build a working binary.

git clone https://gn.googlesource.com/gn
python build/gen.py --no-sysroot
ninja -C out
./out/gn_unittests # to run the unit tests and verify they pass

The resulting binary out/gn could then be replaced in whatever location the build scripts are looking for it.

I've only tested the build itself on arm64, I haven't tried to build libv8.

@ignisf
Copy link
Collaborator Author

ignisf commented Oct 12, 2018

Hello @steev, thank you for the ping

@Taiki-San
Copy link

Taiki-San commented Jan 28, 2019

Hi, I managed to build v8 version 6.7.288 on ARM64 (natively on Amazon's Graviton). Is there a way to contribute the binaries?

For the record, the patches were quite involved:

  • infra/mb/mb_config.pyl had to be patched for arm64.release not to cross compile (achieved by replacing the target_cpu of simulate_arm64);
  • gn had to be replaced/rebuilt to work on ARM64;
  • clang had to be replaced with version 7, which is not in the repos yet;
  • A clang plugin (libFindBadConstructs.so) had to be recompiled based on this code and built manually using the following line clang++ *.cpp -c -I /home/ubuntu/clang+llvm-7.0.1-aarch64-linux-gnu/include/ -fPIC -Wall -std=c++14 -fno-rtti -fno-omit-frame-pointer and clang -shared *.o -o libFindBadConstructs.so;
  • We ran into issues right and left with the build system so I ended up calling ninja and the few commands before manually.

At long last however, we finally managed to get those .a!
A script implementing this logic within the context of our project is available here, but is likely very brittle.

@hypersleep
Copy link

hypersleep commented Aug 7, 2020

Hi everyone! I also managed to compile v8 for this gem for fully working rails application on AWS's Graviton c6g instance.

As said before the main problem is that binaries (clang, gn & ninja) that gonna be used to compile v8 libraries have been built for x86 architecture. i've just tried to recompile them and substitute with original ones.

I've consolidated all my work in Dockerfile in this repo: https://github.com/hypersleep/rails-on-arm That gives you fully-functional ruby on rails app with mini_racer on board.

Hope it helps everybody! I think this process should to be fixed soon on gem build level or in v8 build system due to rising popularity of ARM servers.

@niko-zvt
Copy link

niko-zvt commented Nov 2, 2023

Hi everybody. Are there any updates on this issue? I came across this when assembling a mini_racer for M2 Pro. The solution from @hypersleep didn't help, the vanilla version is not building. Added an error message to the discussion.

@lloeki
Copy link
Contributor

lloeki commented Dec 4, 2023

Closing as this issue is completely sidestepped in libv8-node, which does have aarch64-linux and arm64-darwin builds.

Also there is no chance in freezing hell this v8 version ever supports Apple Silicon, and we're not going to update this gem's v8 version.

@lloeki lloeki closed this as completed Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants