You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.
Trying to print a value for a type defined in an external crate is crashing rusti:
$ cargo run -- -L testi/target/debug/
Running target/debug/rusti -L testi/target/debug/
rusti=> extern crate testi;
rusti=> use testi::Foo;
rusti=> Foo
LLVM ERROR: Program used external function '__ZN21Foo...std..fmt..Debug3fmt20h8530f8b2d5755ad6iaaE' which could not be resolved!
An unknown error occurred
To learn more, run the command again with --verbose.
$
The issue here is that rusti needs both an rlib and a dylib build available for any crate it wants to load, but it doesn't check that both of these exist before trying to run the code that depends on them. Therefore, LLVM's linker encounters a missing symbol and aborts.
To build both rlib and dylib for a project, you can either add crate-type = ["rlib", "dylib"] to the [lib] section of your Cargo.toml or run cargo rustc -- --crate-type=rlib,dylib to build the project.
Keep this issue open, though. I definitely want to improve the error message for this case.
Edit: Implementing an error message for this will be problematic because some core crates (core, libc, collections, etc.) don't have dylib versions installed. I don't have any idea how rusti could differentiate between core crates and user-supplied crates for this check.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Trying to print a value for a type defined in an external crate is crashing rusti:
$ cargo run -- -L testi/target/debug/
Running
target/debug/rusti -L testi/target/debug/
rusti=> extern crate testi;
rusti=> use testi::Foo;
rusti=> Foo
LLVM ERROR: Program used external function '__ZN21Foo...std..fmt..Debug3fmt20h8530f8b2d5755ad6iaaE' which could not be resolved!
An unknown error occurred
To learn more, run the command again with --verbose.
$
Environment:
Both rusti and the testi crate compiled clean with this version.
External crate:
$ cat testi/Cargo.toml
[package]
name = "testi"
version = "0.0.1"
$ cat testi/src/lib.rs
[derive(Debug)]
pub struct Foo;
The text was updated successfully, but these errors were encountered: