Skip to content

Remove BUILD_LIBS_NATIVE_BROWSER - #137811

Merged
MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:remove-build-libs-native-browser
Nov 19, 2026
Merged

MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:remove-build-libs-native-browser

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Did we now remove enough of the Mono Browser infra that we can start doing things that break it? The STATIC_LIB_DESTINATION hack around BUILD_LIBS_NATIVE_BROWSER would need to be propagated in places for native AOT. I'd prefer just deleting it.

Build browser native support unconditionally and use the normal native library layout. Resolve relative Rollup output paths against the CMake build root and align the standalone Rollup default.

Build browser native support unconditionally and use the normal native library layout. Resolve relative Rollup output paths against the CMake build root and align the standalone Rollup default.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: a4f8b2ff-3151-4b4a-9fae-3da83e333b32
Copilot-Session: 93c6c88d-0396-4e5b-a4da-92892d730c12
@MichalStrehovsky MichalStrehovsky added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Nov 18, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Expanded Mono build paths and shared npm/Rollup prerequisites require maintainer confirmation of legacy support expectations and browser CoreCLR/NativeAOT packaging validation, with no builds run.

No open issues 🎉

What changed in this PR

Simplifies browser native-library builds by removing BUILD_LIBS_NATIVE_BROWSER and adopting the standard native-library layout, avoiding propagation of the special-case layout into NativeAOT support.

Changes:

  • Includes browser native support whenever the target is browser, without the extra build flag.
  • Resolves relative Rollup destinations against the CMake build root and aligns the standalone default.
  • Updates live-build handling of browser native archives.
File Description
src/​native/​rollup.config.defines.js Removes /lib from the default Rollup output path.
src/​native/​libs/​Common/​JavaScript/​CMakeLists.txt Resolves the Rollup destination against the CMake build root.
src/​native/​libs/​CMakeLists.txt Removes flag-based browser gating and defaults the destination to ..
src/​coreclr/​CMakeLists.txt Removes the obsolete flag from CoreCLR’s native-library side-build.
eng/​native.wasm.targets Stops passing the obsolete CMake flag.
eng/​liveBuilds.targets Updates browser archive selection for live-build assets.

Review effort: Balanced

@pavelsavara

Copy link
Copy Markdown
Member

Did we now remove enough of the Mono Browser infra that we can start doing things that break it?

I think this is not a Mono hack, but statically linked corerun hack. Does corerun work after this ?

@pavelsavara

Copy link
Copy Markdown
Member

cc @jkoritzinsky

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

I think this is not a Mono hack, but statically linked corerun hack. Does corerun work after this ?

How do I validate? We wouldn't see failing Browser legs in the CI if this broke corerun?

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

Here's what AI says:

The flag started as a CoreCLR-versus-Mono switch. The special layout came later, from coupling JavaScript generation to the native-library install destination—not from an inherent static-linking requirement.

BUILD_LIBS_NATIVE_BROWSER appeared in #119683, the CoreCLR JavaScript-host skeleton. It enabled the new System.Native.Browser and System.Runtime.InteropServices.JavaScript.Native implementations without enabling them for Mono. The original CoreCLR call site explicitly wondered whether Mono should eventually use them too.

The layout rule arrived in #120666. That change reused STATIC_LIB_DESTINATION for three things: installing .a files, generating Rollup’s JavaScript outputs, and locating those JavaScript files for the browserhost linker. That explains the absolute path: . as a CMake install destination is relative to the install prefix, whereas Rollup runs from src/native. Simply passing . through both would not identify the same directory. The old . behavior was retained for Mono; the author explicitly noted that this CMake root also serves Mono.

I found no documented requirement for the directory to be named lib, or for those archives intrinsically to be binplaced under obj. My reading is that this was staging plumbing caused by overloading one variable with install-time and build-time meanings.

For your removal specifically, corerun already supplies ${CMAKE_BINARY_DIR}/libs-native, so it bypasses the /lib fallback you’re deleting. Corerun does depend on the browser support library and generated JS, but that is separate from requiring this particular default layout.

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

/ba-g the failures are timeout/infra errors in non-WASM legs

@MichalStrehovsky
MichalStrehovsky enabled auto-merge (squash) November 19, 2026 12:56
@MichalStrehovsky
MichalStrehovsky merged commit 3415b09 into dotnet:main Nov 19, 2026
118 of 127 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the remove-build-libs-native-browser branch November 19, 2026 12:57
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants