miri: can't call foreign functions from cmath (libm)
I just tried cargo miri test on the various num crates. I got pretty far, but I was stopped by errors on foreign function calls from std::sys::cmath, which come from libm on unix platforms. For example:
num-complex:
error[E0080]: constant evaluation error: can't call foreign function: hypot
--> /home/jistone/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/f64.rs:533:18
|
533 | unsafe { cmath::hypot(self, other) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: hypot
|
num-integer:
--> /home/jistone/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/f64.rs:513:18
|
513 | unsafe { cmath::cbrt(self) }
| ^^^^^^^^^^^^^^^^^ can't call foreign function: cbrt
|
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (17 by maintainers)
Ah, I’ve seen that before. Please wait until https://github.com/rust-lang/miri/pull/830 lands, Miri currently does not fully work when a seed is set. That PR should fix your problem, in fact it adds it specifically as a test case.
I am a
numauthor, so yes, this is something I would like in CI.Yeah, I have a toolchain
stage2pointing tobuild/x86_64-unknown-linux-gnu/stage2. Then I./x.py build src/rustcin the rustc dir, switch to the Miri dir,rustup override set stage2and finally./miri install.Also see the relevant section in the Miri README.