Skip to content

Conversation

carson-katri
Copy link

This enables v8 to be cross compiled for iOS.

OS=ios can be set in the environment before running make build-v8, and the correct extra args will be added.

@bcardarella
Copy link

Are we going to require additional flags for all of the Apple operating systems? Then also for Android, Windows, etc... ?

In other words, is adding each one by one the best approach or is there a more flexible one we should consider?

@carson-katri
Copy link
Author

The OS can be set to anything. I'm unsure what EXTRA_ARGS would be required for other platforms. It could be adjusted so EXTRA_ARGS is pulled from the environment if present too.

Copy link
Member

@krichprollsch krichprollsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is wrong: I'm testing this branch against our current release build, but it doesn't work.

See https://github.com/lightpanda-io/zig-v8-fork/actions/runs/17858246544/job/50782218176?pr=97

downloading https://chrome-infra-packages.appspot.com/dl/gn/gn/macos-arm64/+/latest into tools/gn.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    35  100    35    0     0    269      0 --:--:-- --:--:-- --:--:--   271
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of tools/gn.zip or
        tools/gn.zip.zip, and cannot find tools/gn.zip.ZIP, period.
Archive:  tools/gn.zip
get-v8
+- run exe get-v8
   +- compile exe get-v8 Debug native
      +- run /bin/bash
         +- run /bin/bash failure
error: the following command exited with error code 9:
cd v8 && /bin/bash get_tools.sh

Build Summary: 2/7 steps succeeded; 1 failed
get-v8 transitive failure
+- run exe get-v8 transitive failure
   +- compile exe get-v8 Debug native transitive failure
      +- run /bin/bash transitive failure
         +- run /bin/bash failure

error: the following build command failed with exit code 1:
/Users/runner/.cache/zig/o/41b2e58e23f54e6061b8f9707a8d50e3/build /Users/runner/work/_temp/783d9ed5-a004-4bfc-9cbe-2be4b29959e1/zig-aarch64-macos-0.15.1/zig /Users/runner/work/_temp/783d9ed5-a004-4bfc-9cbe-2be4b29959e1/zig-aarch64-macos-0.15.1/lib /Users/runner/work/zig-v8-fork/zig-v8-fork /Users/runner/.cache/zig /Users/runner/.cache/zig --seed 0xf79dda71 -Z6f21bfb0cd071259 get-v8
Error: Process completed with exit code 1.

@krichprollsch
Copy link
Member

krichprollsch commented Sep 19, 2025

In fact I'm not sure it relates to your PR 🤔

@bcardarella
Copy link

Unfortunately Carson is out for the next two weeks. I can have Isaac take a look but likely it may need to wait as Carson is the Swift expert on our team

@krichprollsch
Copy link
Member

Unfortunately Carson is out for the next two weeks. I can have Isaac take a look but likely it may need to wait as Carson is the Swift expert on our team

not a problem, we can wait until Carson is back 👍

esac
: "${OS:=unset}"
case "$OS" in
unset)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I got what's wrong: we set the OS w/ macos. I worked before b/c the OS was ignored until this change.

Suggested change
unset)
macos) OS="mac" ;;
unset)

@krichprollsch
Copy link
Member

krichprollsch commented Sep 19, 2025

So the zig build get-v8 is working now, but when trying to build an ios version on a macos ci server, it fails.
I suppose we need something more than jsut macos to make it work?
I would like to have a building script working for ios is possible to ensure we don't break it in the future.

ERROR at //build/config/apple/mobile_config.gni:103:3: Assertion failed.
  assert(filter_include([ target_environment ], _target_environments) != [],
  ^-----
target_environment must be in ["simulator", "device", "catalyst"]: 
See //build/config/ios/ios_sdk.gni:5:1: whence it was imported.
import("//build/config/apple/mobile_config.gni")
build-v8
^----------------------------------------------
+- run exe build-v8
See //build/toolchain/ios/BUILD.gn:5:1: whence it was imported.
   +- compile exe build-v8 ReleaseSafe native
import("//build/config/ios/ios_sdk.gni")
      +- run /bin/bash failure
^--------------------------------------
error: the following command exited with error code 1:
See //build/config/BUILDCONFIG.gn:573:5: which caused the file to be included.
cd v8 && /bin/bash build_v8.sh /Users/runner/work/zig-v8-fork/zig-v8-fork/src release

Build Summary: 0/4 steps succeeded; 1 failed
build-v8 transitive failure
+- run exe build-v8 transitive failure
   +- compile exe build-v8 ReleaseSafe native transitive failure
      +- run /bin/bash failure

error: the following build command failed with exit code 1:
/Users/runner/.cache/zig/o/41b2e58e23f54e6061b8f9707a8d50e3/build /Users/runner/work/_temp/e2f12e67-622e-45a3-8e27-5b11f7a2ac49/zig-aarch64-macos-0.15.1/zig /Users/runner/work/_temp/e2f12e67-622e-45a3-8e27-5b11f7a2ac49/zig-aarch64-macos-0.15.1/lib /Users/runner/work/zig-v8-fork/zig-v8-fork /Users/runner/.cache/zig /Users/runner/.cache/zig --seed 0x471b6248 -Z5e0cefb92602fdf8 -Doptimize=ReleaseSafe build-v8
    target(_target_type, target_name) {
    ^----------------------------------
Error: Process completed with exit code 1.

Here is the log: https://github.com/lightpanda-io/zig-v8-fork/actions/runs/17859485614/job/50786267288
Here is the the ci script I'm using:

build-aarch64-ios:
env:
OS: ios
ARCH: aarch64
runs-on: macos-latest
steps:
- uses: mlugg/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- run: OS=macos zig build get-v8 # We force the OS to macos here b/c ios is not supported by get-v8
- run: zig build -Doptimize=ReleaseSafe build-v8
- run: mv v8/out/${{ env.OS }}/release/obj/zig/libc_v8.a libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a
- name: Upload the build
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a
(similar to macos instead setting OS=ios.

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

Successfully merging this pull request may close these issues.

3 participants