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

Fix type error for 32-bit freebsd (on i386, armv6, armv7, powerpc) #669

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

GuillaumeGomez
Copy link
Owner

Fixes #668.

@jbeich: I'll try to check how to have a CI check for that as well. In the meantime, can you confirm it's fixing your issue please?

@jbeich
Copy link

jbeich commented Jan 6, 2022

9f7c22c still fails:

error[E0282]: type annotations needed
  --> src/freebsd/disk.rs:65:55
   |
65 |     disk.total_space = vfs.f_blocks * vfs.f_frsize as _;
   |                                                       ^ cannot infer type
   |
   = note: type must be known at this point

error[E0282]: type annotations needed
   --> src/freebsd/disk.rs:132:57
    |
132 |             total_space: vfs.f_blocks * vfs.f_frsize as _,
    |                                                         ^ cannot infer type
    |
    = note: type must be known at this point

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

@GuillaumeGomez
Copy link
Owner Author

And now?

@jbeich
Copy link

jbeich commented Jan 6, 2022

b67a41c still fails:

error[E0425]: cannot find value `f_frsize` in this scope
   --> src/freebsd/disk.rs:136:41
    |
136 |             total_space: vfs.f_blocks * f_frsize,
    |                                         ^^^^^^^^ help: a local variable with a similar name exists: `frsize`

error[E0425]: cannot find value `f_frsize` in this scope
   --> src/freebsd/disk.rs:137:45
    |
137 |             available_space: vfs.f_favail * f_frsize,
    |                                             ^^^^^^^^ help: a local variable with a similar name exists: `frsize`

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

@GuillaumeGomez GuillaumeGomez force-pushed the fix-freebsd-types branch 2 times, most recently from a457c83 to b67a41c Compare January 6, 2022 22:38
@jbeich
Copy link

jbeich commented Jan 6, 2022

a457c83 still fails:

error[E0308]: mismatched types
  --> src/freebsd/disk.rs:65:39
   |
65 |     disk.total_space = vfs.f_blocks * vfs.f_frsize;
   |                                       ^^^^^^^^^^^^ expected `u64`, found `u32`

error[E0277]: cannot multiply `u64` by `u32`
  --> src/freebsd/disk.rs:65:37
   |
65 |     disk.total_space = vfs.f_blocks * vfs.f_frsize;
   |                                     ^ no implementation for `u64 * u32`
   |
   = help: the trait `Mul<u32>` is not implemented for `u64`

error[E0308]: mismatched types
  --> src/freebsd/disk.rs:66:43
   |
66 |     disk.available_space = vfs.f_favail * vfs.f_frsize;
   |                                           ^^^^^^^^^^^^ expected `u64`, found `u32`

error[E0277]: cannot multiply `u64` by `u32`
  --> src/freebsd/disk.rs:66:41
   |
66 |     disk.available_space = vfs.f_favail * vfs.f_frsize;
   |                                         ^ no implementation for `u64 * u32`
   |
   = help: the trait `Mul<u32>` is not implemented for `u64`

error[E0308]: mismatched types
   --> src/freebsd/disk.rs:132:41
    |
132 |             total_space: vfs.f_blocks * vfs.f_frsize,
    |                                         ^^^^^^^^^^^^ expected `u64`, found `u32`

error[E0277]: cannot multiply `u64` by `u32`
   --> src/freebsd/disk.rs:132:39
    |
132 |             total_space: vfs.f_blocks * vfs.f_frsize,
    |                                       ^ no implementation for `u64 * u32`
    |
    = help: the trait `Mul<u32>` is not implemented for `u64`

error[E0308]: mismatched types
   --> src/freebsd/disk.rs:133:45
    |
133 |             available_space: vfs.f_favail * vfs.f_frsize,
    |                                             ^^^^^^^^^^^^ expected `u64`, found `u32`

error[E0277]: cannot multiply `u64` by `u32`
   --> src/freebsd/disk.rs:133:43
    |
133 |             available_space: vfs.f_favail * vfs.f_frsize,
    |                                           ^ no implementation for `u64 * u32`
    |
    = help: the trait `Mul<u32>` is not implemented for `u64`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `sysinfo` due to 8 previous errors

@GuillaumeGomez
Copy link
Owner Author

Sorry, failed a push (working on two PRs at the same time...). And now?

@jbeich
Copy link

jbeich commented Jan 6, 2022

47110b3 built fine:

$ cargo build
   Compiling sysinfo v0.22.4 (/tmp/sysinfo)
    Finished dev [unoptimized + debuginfo] target(s) in 1.16s

$ carg test
   Compiling sysinfo v0.22.4 (/tmp/sysinfo)
    Finished test [unoptimized + debuginfo] target(s) in 1.52s
     Running unittests (target/debug/deps/sysinfo-1c7a731f11281dfb)

running 16 tests
test common::tests::check_display_impl_process_status ... ok
test test::check_host_name ... ok
test system::tests::check_hostname_has_no_nuls ... ok
test test::check_memory_usage ... ok
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/tmp/sysinfo/target/debug/deps/sysinfo-1c7a731f11281dfb` (signal: 11, SIGSEGV: invalid memory reference)

$ cargo test --lib
    Finished test [unoptimized + debuginfo] target(s) in 0.05s
     Running unittests (target/debug/deps/sysinfo-1c7a731f11281dfb)

running 16 tests
test common::tests::check_display_impl_process_status ... ok
test system::tests::check_hostname_has_no_nuls ... ok
test test::check_host_name ... ok
test test::check_memory_usage ... ok
test system::tests::test_refresh_process ... ok
test system::tests::check_if_send_and_sync ... ok
test system::tests::test_get_process ... ok
test test::check_system_info ... ok
test test::check_refresh_process_return_value ... ok
test test::ensure_is_supported_is_set_correctly ... ok
test test::check_uid_gid ... ok
test system::tests::test_refresh_system ... ok
test test::check_process_memory_usage ... ok
test test::check_processors_number ... ok
test test::check_users ... ok
test system::tests::check_uptime ... ok

test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.00s

@jbeich
Copy link

jbeich commented Jan 6, 2022

av1an-0.3.0 built with this PR also works fine.

$ pkg install av1an x264
$ av1an -e x264 -i /tmp/pedestrian_area_1080p25.y4m -o /tmp/out.mp4
Scene detection
  00:00:04 [###################################################################################################] 100%  375/375 (81.01 fps, eta 0s) Queue 2 Workers 1 Passes 1
Params: --preset slow --crf 25
  00:00:14 [########################################################################] 100%  375/375 (23.99 fps, eta 0s, 3448.3 Kbps, est. 6.17MiB)

Thanks for the quick fix. Applied downstream.

@GuillaumeGomez
Copy link
Owner Author

Thanks for your help! It's late here so I'll make a release with this fix tomorrow.

@GuillaumeGomez GuillaumeGomez merged commit 570c4b9 into master Jan 7, 2022
@GuillaumeGomez GuillaumeGomez deleted the fix-freebsd-types branch January 7, 2022 10:05
@GuillaumeGomez
Copy link
Owner Author

@jbeich The new version has been released with this fix.

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

Successfully merging this pull request may close these issues.

Fails to build on 32-bit FreeBSD: i386, armv6, armv7, powerpc
2 participants