Skip to content

Comments

Support dylib crate-type#3

Open
kxxt wants to merge 3 commits intodylanmckay:masterfrom
kxxt:dylib
Open

Support dylib crate-type#3
kxxt wants to merge 3 commits intodylanmckay:masterfrom
kxxt:dylib

Conversation

@kxxt
Copy link

@kxxt kxxt commented Feb 6, 2025

This PR adds support for dylib crate-type.

It statically links the libvsnprintf.a into the dylib. Otherwise we get

error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/tmp/rustcDJSjdl/symbols.o" "<40 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "/home/kxxt/repos/vsprintf/reproducer/target/debug/deps/libvsprintf.so" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-54c13a3455b13793.so" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/kxxt/repos/vsprintf/reproducer/target/debug/build/vsprintf-92262a54da674b7a/out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/kxxt/repos/vsprintf/reproducer/target/debug/deps/reproducer-d78040fec6c8bb2e" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: undefined symbol: vsnprintf_wrapper
          >>> referenced by lib.rs:33 (/home/kxxt/repos/vsprintf/src/lib.rs:33)
          >>>               /home/kxxt/repos/vsprintf/reproducer/target/debug/deps/reproducer-d78040fec6c8bb2e.49ly8begse5ph7ebdnwi8zwi0.rcgu.o:(vsprintf::vsprintf_raw::hf0f8fe4b8ca2844e)
          collect2: error: ld returned 1 exit status

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant