Skip to content

Different libc.a for macOS arm64 and Linux x86_64 #23379

Closed
@eagleoflqj

Description

@eagleoflqj

I'm testing reproducibility by compiling on Linux and macOS fcitx-contrib/fcitx5-js#18. Everything works fine except for .wasm. A wasm2wat and diff produces below and more

317,326c317,326
<   (import "wasi_snapshot_preview1" "environ_sizes_get" (func (;139;) (type 1)))
<   (import "wasi_snapshot_preview1" "environ_get" (func (;140;) (type 1)))
<   (import "env" "__syscall_fcntl64" (func (;141;) (type 4)))
<   (import "env" "__syscall_ioctl" (func (;142;) (type 4)))
<   (import "env" "__syscall_openat" (func (;143;) (type 6)))
<   (import "wasi_snapshot_preview1" "fd_close" (func (;144;) (type 0)))
<   (import "wasi_snapshot_preview1" "fd_read" (func (;145;) (type 6)))
<   (import "wasi_snapshot_preview1" "fd_write" (func (;146;) (type 6)))
<   (import "env" "_tzset_js" (func (;147;) (type 8)))
<   (import "wasi_snapshot_preview1" "proc_exit" (func (;148;) (type 3)))
---
>   (import "wasi_snapshot_preview1" "proc_exit" (func (;139;) (type 3)))
>   (import "wasi_snapshot_preview1" "environ_sizes_get" (func (;140;) (type 1)))
>   (import "wasi_snapshot_preview1" "environ_get" (func (;141;) (type 1)))
>   (import "env" "__syscall_fcntl64" (func (;142;) (type 4)))
>   (import "env" "__syscall_ioctl" (func (;143;) (type 4)))
>   (import "env" "__syscall_openat" (func (;144;) (type 6)))
>   (import "wasi_snapshot_preview1" "fd_close" (func (;145;) (type 0)))
>   (import "wasi_snapshot_preview1" "fd_read" (func (;146;) (type 6)))
>   (import "wasi_snapshot_preview1" "fd_write" (func (;147;) (type 6)))
>   (import "env" "_tzset_js" (func (;148;) (type 8)))
923c923
<     call 2185
---
>     call 2186

I also tested the link command below with EMCC_DEBUG. Order of imports differs from /tmp/emscripten_temp/emcc-00-base.wasm.

It seems imports are sorted in test as well.

imports.sort()

Not sure if it's a emscripten issue or llvm issue.

Version of emscripten/emsdk:
Please include the output emcc -v here

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.74 (1092ec30a3fb1d46b1782ff1b4db5094d3d06ae5)
clang version 20.0.0git (https:/github.com/llvm/llvm-project 322eb1a92e6d4266184060346616fa0dbe39e731)
Target: wasm32-unknown-emscripten
Thread model: posix

Failing command line in full:
Not failing.

Full link command and output with -v appended:

$ em++ -v -O3 -DNDEBUG  src/CMakeFiles/Fcitx5.dir/fcitx.cpp.o src/CMakeFiles/Fcitx5.dir/keycode.cpp.o src/CMakeFiles/
Fcitx5.dir/input_method.cpp.o src/CMakeFiles/Fcitx5.dir/config.cpp.o src/CMakeFiles/Fcitx5.dir/action.cpp.o src/CMakeFiles/Fcitx5.dir/event_js.cpp.o src/CMakeFiles/Fcitx
5.dir/__/dummy.cpp.o src/CMakeFiles/Fcitx5.dir/Fcitx5-webpanel-import-addon.cpp.o src/CMakeFiles/Fcitx5.dir/Fcitx5-wasmfrontend-import-addon.cpp.o src/CMakeFiles/Fcitx5.
dir/Fcitx5-keyboard-import-addon.cpp.o -o src/Fcitx5.js  -sMAIN_MODULE=1  -fexceptions  -sSTACK_SIZE=1MB  -sALLOW_MEMORY_GROWTH=1  -sMAXIMUM_MEMORY=4GB  -sEXPORTED_RUNTI
ME_METHODS=['ccall','FS']  -sENVIRONMENT=web  --extern-pre-js ../build/pre.js  --extern-post-js ../build/index.js  -L../build/destdir/usr/lib  --preload-file ../build/sy
sroot/usr/share/X11@/usr/share/X11  --preload-file ../build/sysroot/usr/share/iso-codes/json/iso_3166-1.json@/usr/share/iso-codes/json/iso_3166-1.json  --preload-file ..
/build/sysroot/usr/share/iso-codes/json/iso_639-3.json@/usr/share/iso-codes/json/iso_639-3.json  --preload-file ../build/destdir/usr/share/locale@/usr/share/locale  --pr
eload-file ../build/destdir/usr/share/fcitx5@/usr/share/fcitx5  --preload-file ../build/destdir/usr/lib/fcitx5@/usr/lib/fcitx5  webpanel/libwebpanel.a  wasmfrontend/libw
asmfrontend.a  fcitx5/src/im/keyboard/libkeyboard.a  fcitx5-webview/src/libWebviewCandidateWindow.a  fcitx5/src/lib/fcitx/libFcitx5Core.so  fcitx5/src/lib/fcitx-config/l
ibFcitx5Config.so  fcitx5/src/lib/fcitx-utils/libFcitx5Utils.so  sysroot/usr/lib/libexpat.a  sysroot/usr/lib/libxkbcommon.a  sysroot/usr/lib/libjson-c.a
 /mnt/storage/github/emsdk/upstream/bin/clang --version
 /mnt/storage/github/emsdk/upstream/emscripten/tools/file_packager src/Fcitx5.data --from-emcc --preload ../build/sysroot/usr/share/X11@/usr/share/X11 ../build/sysroot/usr/share/iso-codes/json/iso_3166-1.json@/usr/share/iso-codes/json/iso_3166-1.json ../build/sysroot/usr/share/iso-codes/json/iso_639-3.json@/usr/share/iso-codes/json/iso_639-3.json ../build/destdir/usr/share/locale@/usr/share/locale ../build/destdir/usr/share/fcitx5@/usr/share/fcitx5 ../build/destdir/usr/lib/fcitx5@/usr/lib/fcitx5 --no-node
 /mnt/storage/github/emsdk/upstream/bin/wasm-ld @/tmp/emscripten_qie0voif.rsp.utf-8
 /mnt/storage/github/emsdk/upstream/bin/wasm-ld @/tmp/emscripten_l43olzxs.rsp.utf-8
 /mnt/storage/github/emsdk/upstream/bin/llvm-objcopy src/Fcitx5.wasm src/Fcitx5.wasm --remove-section=.debug* --remove-section=producers
 /mnt/storage/github/emsdk/upstream/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-export-originals --pass-arg=legalize-js-interface-exported-helpers src/Fcitx5.wasm -o src/Fcitx5.wasm --detect-features
 /mnt/storage/github/emsdk/upstream/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-export-originals --pass-arg=legalize-js-interface-exported-helpers src/Fcitx5.wasm -o src/Fcitx5.wasm --detect-features
 /mnt/storage/github/emsdk/node/20.18.0_64bit/bin/node /mnt/storage/github/emsdk/upstream/emscripten/src/compiler.mjs /tmp/tmpzuugy7zv.json
 /mnt/storage/github/emsdk/upstream/bin/wasm-opt --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable --no-stack-ir src/Fcitx5.wasm -o src/Fcitx5.wasm --mvp-features --enable-call-indirect-overlong --enable-multivalue --enable-mutable-globals --enable-reference-types --enable-sign-ext
 /mnt/storage/github/emsdk/upstream/bin/wasm-opt --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable --no-stack-ir src/Fcitx5.wasm -o src/Fcitx5.wasm --mvp-features --enable-call-indirect-overlong --enable-multivalue --enable-mutable-globals --enable-reference-types --enable-sign-ext
 /mnt/storage/github/emsdk/node/20.18.0_64bit/bin/node /mnt/storage/github/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_3_h7m503/Fcitx5.js unsignPointers -o /tmp/emscripten_temp_3_h7m503/Fcitx5.jso1.js
 /mnt/storage/github/emsdk/node/20.18.0_64bit/bin/node /mnt/storage/github/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_3_h7m503/Fcitx5.js unsignPointers -o /tmp/emscripten_temp_3_h7m503/Fcitx5.jso1.js
 /mnt/storage/github/emsdk/node/20.18.0_64bit/bin/node /mnt/storage/github/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_3_h7m503/Fcitx5.jso1.js --minify-whitespace -o /tmp/emscripten_temp_3_h7m503/Fcitx5.jso2.js
 /mnt/storage/github/emsdk/node/20.18.0_64bit/bin/node /mnt/storage/github/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_3_h7m503/Fcitx5.jso1.js --minify-whitespace -o /tmp/emscripten_temp_3_h7m503/Fcitx5.jso2.js

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