Skip to content

Link the iOS archive without ForceLoad - #22

Merged
jcant0n merged 1 commit into
mainfrom
ios-without-forceload
Aug 8, 2026
Merged

Link the iOS archive without ForceLoad#22
jcant0n merged 1 commit into
mainfrom
ios-without-forceload

Conversation

@jcant0n

@jcant0n jcant0n commented Aug 8, 2026

Copy link
Copy Markdown
Member

The first run that reached the linker died on duplicate symbols:

duplicate symbol '_WebPInitUpsamplersNEON'
duplicate symbol '_jpeg_destroy_decompress'
duplicate symbol '_jsimd_ycc_extrgb_convert_neon'

all of them twice inside libCesiumNativeC.a itself. The merge in CesiumC takes every .a it finds, and two pairs among them overlap by design: libjpeg.a and libturbojpeg.a are two APIs over one core, and libwebpdecoder.a is a subset of libwebp.a.

ForceLoad is what turns that into an error — it pulls every member into the link whether or not anything references it, so both copies arrive. Ordinary linking takes the first definition and moves on, which is what browser-wasm has always done with the same archive and the same overlap.

What ForceLoad was protecting against does not go away

The linker keeps only members something references, and a symbol reached solely through a P/Invoke can be dropped. The smoke leg is what makes turning this off safe rather than hopeful: it reads the built executable and fails if cesium_async_system_create is not among its defined symbols — exactly the failure this could cause.

That check was written before this problem existed, for a different reason. It is the reason this can be a one-line change rather than a guess.

Good news in the same run

The macos-latest move worked: Xcode 26.6, and the build got all the way to clang++. So the targets file is putting the archive on the link line — the half of phase 4 that had never been exercised.

The duplication itself is worth removing in CesiumC, since it also makes a 61 MB archive bigger than it needs to be and any consumer passing -force_load hits the same wall. Separate change, needs a release cycle, tracked.

The first run that got as far as the linker died on duplicate symbols:

  duplicate symbol '_WebPInitUpsamplersNEON'
  duplicate symbol '_jpeg_destroy_decompress'
  duplicate symbol '_jsimd_ycc_extrgb_convert_neon'

all of them twice inside libCesiumNativeC.a itself. The merge in CesiumC
takes every .a it finds, and two pairs among them overlap by design:
libjpeg.a and libturbojpeg.a are two APIs over one core, and
libwebpdecoder.a is a subset of libwebp.a. So each of those objects is in
the archive twice.

ForceLoad is what turns that into an error. It pulls every member into
the link whether or not anything references it, so both copies arrive.
Ordinary linking takes the first definition and moves on, which is what
browser-wasm has always done with the same archive and the same overlap.

What ForceLoad was protecting against is real and does not go away: the
linker keeps only members something references, and a symbol reached
solely through a P/Invoke can be dropped. The smoke leg is what makes
turning it off safe rather than hopeful -- it reads the built executable
and fails if cesium_async_system_create is not among its defined symbols,
which is exactly the failure this could cause.

The duplication itself is worth removing in CesiumC, since it also makes
the archive bigger than it needs to be. That is a separate change and
needs a release cycle; this one does not.
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

API gate: additive

Every symbol that existed still exists, unchanged. Nothing that compiled before stops compiling.

Target framework Added Removed
net10.0-ios +0 -0
net10.0 +0 -0

Enum and constant values are part of the measured surface: a renumbering keeps compiling and sends the wrong number to the driver, so it counts as a removal.

@jcant0n
jcant0n merged commit 030f65b into main Aug 8, 2026
4 checks passed
@jcant0n
jcant0n deleted the ios-without-forceload branch August 8, 2026 22:31
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.

1 participant