Undefined reference to __rust_dealloc
/ __rust_alloc
when crate-type is ["staticlib", "dylib"]
#56784
Labels
A-linkage
Area: linking into static, shared libraries and binaries
E-needs-mcve
Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
Problem
A part of Cargo.toml:
When I build these rust artifact and try to link to it within c program I get a lot of
undefined reference to '__rust_dealloc' / '__rust_alloc'
. For example, the output of :Compiling c code as
gcc main.c my_lib.a -lm -ldl ....
But once I remove a
dylib
from Cargo.toml, it complies correctly with a successNotes
Actually I don't need "dylib" for a linux development, but do need for windows. However I couldn't do something like
[target.'cfg(windows)'.lib]
(as for dependencies)Output of
cargo version
:cargo 1.31.0 (339d9f9c8 2018-11-16)
The text was updated successfully, but these errors were encountered: