Skip to content

Commit 2ad6208

Browse files
committed
fix: emit an empty archive for header-only modules
v8_heap_base_headers compiles to nothing, so ar failed with "No such file or directory" after an otherwise complete build. The iOS runtime links the archive by name -- what ships today is an 8-byte empty archive, because the original script's `|| echo` hid the same failure and left a stale placeholder behind. Writing the empty archive deliberately keeps a genuinely missing module loud while tolerating the header-only one.
1 parent 761edd7 commit 2ad6208

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

scripts/matrix/build-ios.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,20 @@ DIST="$ROOT_DIR/dist/ios-$VARIANT"
111111
cd "$V8_DIR"
112112

113113
archive_lib() {
114-
local name="$1" objects="$2"
114+
local name="$1" objects="$2" first
115115
# shellcheck disable=SC2086 -- $objects is a deliberate glob list
116+
first=$(ls $objects 2>/dev/null | head -1 || true)
117+
if [ -z "$first" ]; then
118+
# v8_heap_base_headers is header-only and compiles to nothing. The
119+
# runtime still links the archive by name, so write an empty one --
120+
# what ships today is an 8-byte archive for exactly this reason.
121+
echo "note: $name has no objects, writing an empty archive"
122+
# macOS ar refuses to create a memberless archive, so write the magic
123+
# directly -- this is byte-identical to what ships today.
124+
printf '!<arch>\n' > "$DIST/lib/$name.a"
125+
return
126+
fi
127+
# shellcheck disable=SC2086
116128
ar r "$DIST/lib/$name.a" $objects
117129
strip -S -x "$DIST/lib/$name.a" 2>/dev/null || true
118130
}

0 commit comments

Comments
 (0)