Link failure with -sWASMFS -flto=thin

Abierto
#27,939 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
15/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c, wasm
Área
build-system

Línea de trabajo

The failure is a wasm-ld import module mismatch for __wasi_fd_sync, between the WASMFS syscalls.o in libwasmfs-debug.a (imported as env) and the fsync.o from the libc archive built under -flto=thin (imported as wasi_snapshot_preview1). Start by reproducing with the 4-line fsync/fdatasync program using emcc -sWASMFS -flto=thin, then compare against each flag alone. Done means the program links with both flags, and the import module for __wasi_fd_sync is consistent across the ThinLTO archives.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.11 (a0014542110d6078c3a1a7941fa1ddb3a2281f16)
clang version 24.0.0git (https:/github.com/llvm/llvm-project f718ebe873411a562ef6e5c27da36d75b7aaec98)
Target: wasm32-unknown-emscripten
Thread model: posix

Failing command line in full:

Use the reproducer:

#include <unistd.h>

int main(int argc, char **argv) {
  fsync(0);
  fdatasync(0);
  return 0;
}

Link with:
emcc -sWASMFS -flto=thin minimal.c -o minimal.js

Result:

wasm-ld: error: import module mismatch for symbol: __wasi_fd_sync
>>> defined as env in /home/paradust/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/thinlto/libwasmfs-debug.a(syscalls.o)
>>> defined as wasi_snapshot_preview1 in /home/paradust/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/thinlto/minimal.wasm.lto.libc-debug.a(fsync.o at 2366516).o
emcc: error: '/home/paradust/emsdk/upstream/bin/wasm-ld -o minimal.wasm /tmp/tmp_mszapyplibemscripten_js_symbols.so -Bstatic --strip-debug -u__cxa_atexit --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=wasmfs_flush --export=_emscripten_stack_alloc --export=setThrew --export=__wasm_call_ctors --export=_emscripten_stack_restore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --no-growable-memory --initial-heap=16777216 --no-entry --stack-first --table-base=1 /tmp/emscripten_temp_8xy2kcjf/minimal.o -L/home/paradust/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/thinlto -L/home/paradust/emsdk/upstream/emscripten/src/lib -lGL-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lclang_rt.builtins -lc++-debug-noexcept -lc++abi-debug-noexcept -lsockets -lwasmfs_no_fs -lwasmfs-debug -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (returned 1)

Omitting either flag results in a successful compile.

Lenguaje dominante
C++
Estrellas
27.8k
Forks
3.6k
Merge medio
1 d 4 h
PR fusionados (30 d)
179

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de emscripten-core/emscripten

Todos los issues de emscripten-core/emscripten

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.