PGO errors on native with symbols generated by `wit_bindgen::generate!`

Abierto
#1,509 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #1577 de @carabistouflette — cerrado sin fusionar

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust, wasm

Línea de trabajo

Reproduce el fallo en khutulun-dev usando scripts/build, scripts/build-examples y el comando PGO documentado; después, compara la entrada del enlazador generada con el archivo floria-plugins.wit y el issue relacionado de cargo-pgo. Se considera completado cuando la compilación PGO finaliza sin el error de rust-lld para los símbolos generados por wit_bindgen::generate!.

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

Descripción

gen-rust

While trying to create a PGO build of a complex program that uses wasmtime as well as wasmtime::component::bindgen I encountered a linker error during the PGO optimization phase:

 "/home/xxx/.cargo/target/x86_64-unknown-linux-gnu/release/deps/{libregex-c07ab95555f39da0,libregex_automata-7ee923d5f6c2717f,libaho_corasick-5c8f4fd45dbfd81d,libmemchr-6bf3bd84cc706660,libregex_syntax-29ae9a4cd46cd534,libpuccini_plugin_sdk_tosca_2_0-e5bae6e4238f19b8,libchrono-cdb2d612e7931659,libiana_time_zone-e1ddac5c8d3f6e30,libbase64-bc218090048adb9e,libfloria_plugin_sdk-2d3041ed2aa76b6f,libwit_bindgen-d74a0375665663a5,libwaki-0efdb38898b964aa,libform_urlencoded-b370f73aedd7d6ac,libpercent_encoding-3f263064c2841206,libwit_bindgen-fb809008eb3c2160,libwit_bindgen_rt-0a4c48ecc7933c57,libbitflags-50780dc367a8909d,libhttp-25d9a9cb8324f3c8,libitoa-6dd9b0b770f89707,libbytes-fe6d9b7a8a9571c5,libanyhow-8b765c7e03803d5b,libordered_float-1bbdc6eb007024dd,libserde-6a94ee0c090e296d,libserde_core-67855228a5a4e304,libnum_traits-24fe799717f9791d}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustctoZu3J/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/xxx/.cargo/target/x86_64-unknown-linux-gnu/release/deps/libpuccini_plugin_tosca_2_0.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: /tmp/rustctoZu3J/list:4: ; expected, but got cabi_post_floria:plugins/dispatch
          >>>     cabi_post_floria:plugins/dispatch#[method]custom-resource.replica;
          >>>     ^
          collect2: error: ld returned 1 exit status

As you can see, it seems to have something to do with the symbol name for the C ABI. I opened this issue first on cargo-pgo but it's a head-scratcher.

Maybe we can try to figure this out together?

Steps to Reproduce

Not trivial, but the best way is this:

Clone and install the khutulun-dev repository. And then try to PGO Puccini:

cd puccini
scripts/build
scripts/build-examples
PGO=true WASM_PRECOMPILE=false LTO=false scripts/build -r

(We don't actually need to disable Wasm precompile and LTO, but they don't make a different for this bug and this will get you the results faster)

For reference, here is the WIT file used.

Versions and Environment

Wasmtime version or commit: 41.0.0

Operating system: Fedora 43

Architecture: x86-64

Lenguaje dominante
Rust
Estrellas
1.5k
Forks
306
Merge medio
1 d 4 h
PR fusionados (30 d)
21

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Sin Dockerfile ni archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

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 bytecodealliance/wit-bindgen

Todos los issues de bytecodealliance/wit-bindgen

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.