Skip to content

[BridgeJS] wasm-ld: error: import module mismatch for symbol #657

Closed

Description

@sliemeobn

The @_extern symbols generated by BridgeJS are subject to the same behavior like these: #628 #631

swift issue: swiftlang/swift#87320

That means currently BridgeJS cannot be used in libraries, because linking the final wasm binary (especially in embedded) will cause errors like this one.

wasm-ld: error: import module mismatch for symbol: $e14BrowserInterop36bjs_JSWindow_getComputedStyle_extern33_A850048D7CA460B221AE34673489EEABLLys5Int32VAE_AEtF
>>> defined as env in /Users/simon/dev/elementary-swift/elementary-ui/Examples/Basic/.build/wasm32-unknown-wasip1/release/App.build/AnimationsView.swift.o
>>> defined as BrowserInterop in /Users/simon/dev/elementary-swift/elementary-ui/Examples/Basic/.build/wasm32-unknown-wasip1/release/BrowserInterop.build/BridgeJS.swift.o

wasm-ld: error: import module mismatch for symbol: $e14BrowserInterop28bjs_JSPerformance_now_extern33_A850048D7CA460B221AE34673489EEABLLySds5Int32VF
>>> defined as env in /Users/simon/dev/elementary-swift/elementary-ui/Examples/Basic/.build/wasm32-unknown-wasip1/release/App.build/AnimationsView.swift.o
>>> defined as BrowserInterop in /Users/simon/dev/elementary-swift/elementary-ui/Examples/Basic/.build/wasm32-unknown-wasip1/release/BrowserInterop.build/BridgeJS.swift.o

Activity

  1. kateinoigakukun commented on Feb 19, 2026

    @kateinoigakukun
    Member

    This is super unfortunate but let me apply workarounds until we get the toolchain fix

  2. Amzd commented on Feb 21, 2026

    @Amzd
    Contributor

    This same issue (I think) is now occurring with different symbols:

    wasm-ld: error: import module mismatch for symbol: $e13JavaScriptKit24_swift_js_pop_i32_extern33_CB7C5BA5E873B811AE222EBA15BCEA61LLs5Int32VyF
    
    wasm-ld: error: import module mismatch for symbol: $e13JavaScriptKit015_swift_js_make_E7_stringys5Int32VSPys5UInt8VGSg_ADtF
    
    wasm-ld: error: import module mismatch for symbol: $e13JavaScriptKit33_swift_js_init_memory_with_resultyySPys5UInt8VGSg_s5Int32VtF
    
    wasm-ld: error: import module mismatch for symbol: $e13JavaScriptKit38_swift_js_get_optional_double_presences5Int32VyF
    
    wasm-ld: error: import module mismatch for symbol: $e13JavaScriptKit35_swift_js_get_optional_double_valueSdyF
    
    wasm-ld: error: import module mismatch for symbol: $e13JavaScriptKit29_swift_js_get_optional_strings5Int32VyF
    
  3. kateinoigakukun commented on Feb 21, 2026

    @kateinoigakukun
    Member

    @Amzd Take 2 #670 🙏

  4. kateinoigakukun commented on Feb 21, 2026

    @kateinoigakukun
    Member
  5. Amzd commented on Feb 21, 2026

    @Amzd
    Contributor

    You are fantastic!

  6. sliemeobn commented on Feb 21, 2026

    @sliemeobn
    ContributorAuthor

    @kateinoigakukun it pains me to say this, but this is still not working in ElementaryUI with 0.46.2

    I published my WIP branch here:
    elementary-swift/elementary-ui#76

    I still get a lot of errors like this:

    wasm-ld: error: import module mismatch for symbol: $e14BrowserInterop019make_swift_closure_ab3_14aB11Sd_y_extern33_A850048D7CA460B221AE34673489EEABLLys5Int32VSv_SPys5UInt8VGs6UInt32VtF
    >>> defined as env in /Users/simon/dev/elementary-swift/elementary-ui/Examples/Basic/.build/wasm32-unknown-wasip1/release/App.build/AnimationsView.swift.o
    >>> defined as bjs in /Users/simon/dev/elementary-swift/elementary-ui/Examples/Basic/.build/wasm32-unknown-wasip1/release/BrowserInterop.build/BridgeJS.swift.o
    
  7. kateinoigakukun commented on Feb 21, 2026

    @kateinoigakukun
    Member

    Unfortunately, we don't have workaround for Embedded build mode because it always serialize everything into swiftmodule and emit code in the client's object files.

  8. sliemeobn commented on Feb 21, 2026

    @sliemeobn
    ContributorAuthor

    I don't quite understand why the other symbols work. Like the built-in BridgeJS funcs for example? 🤔

  9. kateinoigakukun commented on Feb 22, 2026

    @kateinoigakukun
    Member

    Hmm, good point. I'll keep focusing on landing the root cause fix but let me know if you could find a workaround

  10. sliemeobn commented on Mar 3, 2026

    @sliemeobn
    ContributorAuthor

    just to summarize:
    BridgeJS does not (and most likely will never) work for Embedded Swift on 6.2

    this issue seems resolved with the latest 6.3 and main snapshots (with @kateinoigakukun 's fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions