digama0 / mm0

Metamath Zero specification language
Creative Commons Zero v1.0 Universal
306 stars 40 forks source link

Error when building mm0-rs #110

Closed TressaDanvers closed 1 year ago

TressaDanvers commented 1 year ago

When I attempt to build the mm0-rs directory with rust (exact command used is "cargo build --release"), the compiler throws an error. two words have no definition, "getrusage" and "RUSAGE_SELF". I am new to rust so it might be that I am missing something that is required for this build to work, but I cannot find what it is if that's the case.

Here is the exact output of the build when it encounters the mm0_util component:

Compiling mm0_util v0.1.4 (I:\Program Files\metamath-zero\mm0-rs\components\mm0_util) error[E0425]: cannot find function getrusage in crate libc --> components\mm0_util\src\lib.rs:645:22 | | assert_eq!(libc::getrusage(libc::RUSAGE_SELF, usage.as_mut_ptr()), 0); | ^^^^^^^^^ not found in libc

error[E0425]: cannot find value RUSAGE_SELF in crate libc --> components\mm0_util\src\lib.rs:645:38 | | assert_eq!(libc::getrusage(libc::RUSAGE_SELF, usage.as_mut_ptr()), 0); | ^^^^^^^^^^^ not found in libc

For more information about this error, try rustc --explain E0425. error: could not compile mm0_util due to 2 previous errors

bjorn3 commented 1 year ago

Looks like a windows implementation is necessary for https://github.com/digama0/mm0/blob/5ea40f6f30b467537ca48d961eef0c485ac9a3b9/mm0-rs/components/mm0_util/src/lib.rs#L641 or alternatively to make it use the fallback on non-unix platforms.

digama0 commented 1 year ago

I'm surprised you are seeing that function without compiling with the memory feature enabled (which is only intended for heap profiling and should not be enabled by default). I will make sure it only gets enabled on unix.

digama0 commented 1 year ago

(I will accept a PR / mentor anyone who wants to make the heap profiling support work on windows, but I don't have one to test. I have a day job now so this project is on the back burner.)