Skip to content

wasm-ld must be passed -mwasm64 to compile for wasm64 #11209

@190n

Description

@190n

Zig Version

0.10.0-dev.1374+d78b8c10b

Steps to Reproduce

  • Attempt to compile a project for 64-bit WebAssembly (here is the build.zig I was using; it worked fine on wasm32). I was specifically building with zig build -Drelease-small, but the issue occurs in any build mode.

Expected Behavior

My project is compiled successfully.

Actual Behavior

The project fails to build, because the linker needs to be passed -mwasm64:

wasm-ld: error: /home/ben/code/ts/huffman/src/zig/zig-cache/o/c754579dda9f05ba11809c375dbe68cb/huffman.o: must specify -mwasm64 to process wasm64 object files
error: LLDReportedFailure
huffman...The following command exited with error code 1:
/usr/bin/zig build-lib /home/ben/code/ts/huffman/src/zig/src/huffman.zig -OReleaseSmall --cache-dir /home/ben/code/ts/huffman/src/zig/zig-cache --global-cache-dir /home/ben/.cache/zig --name huffman -dynamic -target wasm64-freestanding -mcpu generic --enable-cache 
error: the following build command failed with exit code 1:
/home/ben/code/ts/huffman/src/zig/zig-cache/o/1c2e1659aef04e64d9f58a247278e6da/build /usr/bin/zig /home/ben/code/ts/huffman/src/zig /home/ben/code/ts/huffman/src/zig/zig-cache /home/ben/.cache/zig -Drelease-small

For reference, my system's wasm-ld comes from LLD 13.0.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.frontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions