Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit good error message, if model package is not a dynamic library #847

Closed
hannobraun opened this issue Jul 20, 2022 · 2 comments
Closed
Labels
type: feature New features and improvements to existing features

Comments

@hannobraun
Copy link
Owner

As of now, this is what happens when you try to load a model (via fj-app -m path/to/model) that doesn't build a dynamic library:

thread 'main' panicked at 'Error reloading model: LibLoading(DlOpen { desc: "target/debug/liberror.so: cannot open shared object file: No such file or directory" })', crates/fj-host/src/lib.rs:279:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This should result in a nice error message that explains what it wrong and how to fix it. The fix would be to add the following to the model's Cargo.toml:

[lib]
crate-type = ["cdylib"]
@hannobraun hannobraun added type: feature New features and improvements to existing features topic: model labels Jul 20, 2022
@hannobraun hannobraun changed the title Handle model package not being a dynamic library Emit good error message, if model package is not a dynamic library Jul 20, 2022
@hannobraun hannobraun added this to the Basic Usability milestone Jul 20, 2022
@hannobraun
Copy link
Owner Author

As an alternative to emitting a good error message, it might be possible to circumvent this problem completely, and not require the crate-type in the model's Cargo.toml. This could be done by using cargo rustc to compile models, and pass the --crate-type argument. This argument was just stabilized: rust-lang/cargo#10838

@hannobraun
Copy link
Owner Author

Closing in favor of #938.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New features and improvements to existing features
Projects
None yet
Development

No branches or pull requests

1 participant