bnoordhuis / v8-cmake

The V8 JavaScript engine, but built with CMake instead of GN - WIP
BSD 3-Clause "New" or "Revised" License
189 stars 54 forks source link

Fixes issue where linux arm64 is not defined #71

Closed JerrySievert closed 1 year ago

JerrySievert commented 1 year ago

Adds arch64 to the list of arm64 devices.

Previously, arm64 was only defined as arm64, which only matches modern macOS on apple silicon.

As it turns out, there other arm64 devices besides apple silicon, and being able to compile against them is actually kind of nice. This PR adds detection for aarch64, which is also considered arm64 and allows v8 to compile and run.

also fixes #70

bnoordhuis commented 1 year ago

Thanks, Jerry! I'm open to testing aarch64/arm64 on CI if there is a way to do it that isn't excruciatingly slow.

JerrySievert commented 1 year ago

I ran 2 jobs on 2 physical devices: raspberry pi 4 with ssd and 8gb ram, and orange pi 5+ with ssd and 16gb ram. the raspberry pi took ~18 hours to build (!!) whereas the orange pi did it in about an hour. conversely, my MacBook manages it much quicker (arm64).

I'm not sure if GitHub Actions allow for runs on apple silicon, but I would hope that if they have any aarch64 that they'd be more like the orange pi than the raspberry pi.

bnoordhuis commented 1 year ago

For libuv, we cross-compile with -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc and then run the test suite under qemu-aarch64-static:

https://github.com/libuv/libuv/blob/2f87d5c114dd628d611766a3347a11f77799f06c/.github/workflows/CI-unix.yml#L97-L148

For v8-cmake, I'd already be pretty happy if cross-compiling works. It's not like we have much of a test suite anyway, just a smoke test.