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

Problem with dynamic linking crate 'rand' #4

Open
mverleg opened this issue Oct 26, 2019 · 1 comment
Open

Problem with dynamic linking crate 'rand' #4

mverleg opened this issue Oct 26, 2019 · 1 comment

Comments

@mverleg
Copy link

mverleg commented Oct 26, 2019

When I run this:

runner --add rand
echo "use rand;" > mwe.rs
runner mwe.rs

I get this error:

error: extern location for rand does not exist: /home/mark/.cargo/.runner/unstable/dy-cache/librand.so
error[E0463]: can't find crate for `rand`
  --> /home/user/.cargo/.runner/unstable/bin/mwe.rs:20:5
   |
20 | use rand;
   |     ^^^^ can't find crate

I think the first line means there's something going wrong with linking. I tried with -s:

runner -s mwe.rs

and indeed that works fine. I don't know how to solve it though.

P.s.: I like the tool, cool idea!

@stevedonovan
Copy link
Owner

Dynamic linking comes with some serious limitations. First, you actually have to do runner -C rand. This fails because rand has dependencies, and some of them simply can't be dynamically linked. For straightforward stuff like json crate, runner -C json does the job, but in general -s will be needed.

Dynamic linking is somewhat faster but the static case isn't too bad...

Oh yes, I do a lot of prototyping - if I'm curious about an API, I open up a little file or just do -e

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

No branches or pull requests

2 participants