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

test fails to build #16

Closed
andhe opened this issue Dec 12, 2023 · 6 comments · Fixed by #17
Closed

test fails to build #16

andhe opened this issue Dec 12, 2023 · 6 comments · Fixed by #17

Comments

@andhe
Copy link

andhe commented Dec 12, 2023

Debian runs "autopkgtests" for rust crates, which fails for wmidi. See:
https://ci.debian.net/packages/r/rust-wmidi/testing/amd64/40166127/#L3759

Adding #[cfg(feature = "std")] before #[test] where needed fixed some, but I could not get all error adressed this way.

@andhe
Copy link
Author

andhe commented Dec 12, 2023

132s error[E0433]: failed to resolve: maybe a missing crate `std`?
132s    --> src/cc.rs:396:9
132s     |
132s 396 |     use std::convert::TryFrom;
132s     |         ^^^ maybe a missing crate `std`?
132s     |
132s     = help: consider adding `extern crate std` to use the `std` crate
132s 
132s error: cannot find macro `vec` in this scope
132s    --> src/midi_message.rs:662:37
132s     |
132s 662 |             MidiMessage::OwnedSysEx(vec![
132s     |                                     ^^^
132s 
132s error: cannot find macro `vec` in this scope
132s    --> src/midi_message.rs:646:42
132s     |
132s 646 |             Some(MidiMessage::OwnedSysEx(vec![
132s     |                                          ^^^
132s 
132s error: cannot find macro `vec` in this scope
132s    --> src/midi_message.rs:640:37
132s     |
132s 640 |             MidiMessage::OwnedSysEx(vec![
132s     |                                     ^^^
132s 
132s error[E0433]: failed to resolve: use of undeclared crate or module `std`
132s    --> src/byte.rs:161:25
132s     |
132s 161 |         for n in 0x80..=std::u8::MAX {
132s     |                         ^^^ use of undeclared crate or module `std`
132s 
132s error[E0433]: failed to resolve: use of undeclared crate or module `std`
132s    --> src/byte.rs:207:27
132s     |
132s 207 |         for n in 0x4000..=std::u16::MAX {
132s     |                           ^^^ use of undeclared crate or module `std`
132s 
132s error[E0599]: no method named `to_freq_f32` found for reference `&Note` in the current scope
132s    --> benches/bench.rs:127:29
132s     |
132s 127 |                 *dst = note.to_freq_f32();
132s     |                             ^^^^^^^^^^^ method not found in `&Note`
132s 
132s error[E0599]: no method named `to_freq_f32` found for reference `&Note` in the current scope
132s    --> benches/bench.rs:136:39
132s     |
132s 136 |                 *dst = f64::from(note.to_freq_f32());
132s     |                                       ^^^^^^^^^^^ method not found in `&Note`
132s 
132s error[E0599]: no method named `to_freq_f64` found for reference `&Note` in the current scope
132s    --> benches/bench.rs:145:29
132s     |
132s 145 |                 *dst = note.to_freq_f64();
132s     |                             ^^^^^^^^^^^ method not found in `&Note`
132s 
133s For more information about this error, try `rustc --explain E0599`.
133s error: could not compile `wmidi` due to 3 previous errors
133s error[E0599]: no function or associated item named `try_from` found for struct `byte::U7` in the current scope
133s    --> src/cc.rs:401:28
133s     |
133s 401 |             let data = U7::try_from(value).unwrap();
133s     |                            ^^^^^^^^ function or associated item not found in `byte::U7`
133s     |
133s    ::: src/byte.rs:6:1
133s     |
133s 6   | pub struct U7(pub(crate) u8);
133s     | ------------- function or associated item `try_from` not found for this struct
133s     |
133s     = help: items from traits can only be used if the trait is in scope
133s help: the following trait is implemented but not in scope; perhaps add a `use` for it:
133s     |
133s 394 +     use core::convert::TryFrom;
133s     |
133s help: there is an associated function with a similar name
133s     |
133s 401 |             let data = U7::try_from_bytes(value).unwrap();
133s     |                            ~~~~~~~~~~~~~~
133s 
133s error[E0599]: no variant or associated item named `OwnedSysEx` found for enum `midi_message::MidiMessage` in the current scope
133s    --> src/midi_message.rs:640:26
133s     |
133s 9   | pub enum MidiMessage<'a> {
133s     | ------------------------ variant or associated item `OwnedSysEx` not found for this enum
133s ...
133s 640 |             MidiMessage::OwnedSysEx(vec![
133s     |                          ^^^^^^^^^^ variant or associated item not found in `MidiMessage<'_>`
133s 
133s error[E0599]: no variant or associated item named `OwnedSysEx` found for enum `midi_message::MidiMessage` in the current scope
133s    --> src/midi_message.rs:646:31
133s     |
133s 9   | pub enum MidiMessage<'a> {
133s     | ------------------------ variant or associated item `OwnedSysEx` not found for this enum
133s ...
133s 646 |             Some(MidiMessage::OwnedSysEx(vec![
133s     |                               ^^^^^^^^^^ variant or associated item not found in `MidiMessage<'_>`
133s 
133s error[E0599]: no variant or associated item named `OwnedSysEx` found for enum `midi_message::MidiMessage` in the current scope
133s    --> src/midi_message.rs:662:26
133s     |
133s 9   | pub enum MidiMessage<'a> {
133s     | ------------------------ variant or associated item `OwnedSysEx` not found for this enum
133s ...
133s 662 |             MidiMessage::OwnedSysEx(vec![
133s     |                          ^^^^^^^^^^ variant or associated item not found in `MidiMessage<'_>`
133s 
133s error[E0599]: no method named `to_freq_f64` found for enum `note::Note` in the current scope
133s    --> src/note.rs:487:33
133s     |
133s 20  | pub enum Note {
133s     | ------------- method `to_freq_f64` not found for this enum
133s ...
133s 487 |         let a440_f64 = Note::A4.to_freq_f64();
133s     |                                 ^^^^^^^^^^^ method not found in `note::Note`
133s 
133s error[E0599]: no method named `to_freq_f32` found for enum `note::Note` in the current scope
133s    --> src/note.rs:490:33
133s     |
133s 20  | pub enum Note {
133s     | ------------- method `to_freq_f32` not found for this enum
133s ...
133s 490 |         let a440_f32 = Note::A4.to_freq_f32();
133s     |                                 ^^^^^^^^^^^ method not found in `note::Note`

@wmedrano
Copy link
Member

wmedrano commented Dec 18, 2023

Thanks. I managed to reproduce the test errors locally with: cargo test --no-default-features.

Fix ETA: December 19th PST

@wmedrano
Copy link
Member

wmedrano commented Dec 18, 2023

This should be fixed in wmidi version 4.0.9 and up.

  • edit 4.0.9 and up, not 4.0.8.

@andhe
Copy link
Author

andhe commented Dec 19, 2023

Hi,

Thanks for looking into this so quickly. I tried building the new version (4.0.9) and there seems to still be an issue with benches:

[...]
     Running `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=wmidi CARGO_MANIFEST_DIR=/usr/share/cargo/registry/wmidi-4.0.9 CARGO_PKG_AUTHORS='wmedrano <[email protected]>' CARGO_PKG_DESCRIPTION='Midi parsing library.' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=wmidi CARGO_PKG_REPOSITORY='https://github.com/RustAudio/wmidi' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=4.0.9 CARGO_PKG_VERSION_MAJOR=4 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=9 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/tmp/tmp.gMG23AgrrT/target/debug/deps:/usr/lib' rustc --crate-name wmidi src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=03d31bda6c51bcb1 -C extra-filename=-03d31bda6c51bcb1 --out-dir /tmp/tmp.gMG23AgrrT/target/aarch64-unknown-linux-gnu/debug/deps --target aarch64-unknown-linux-gnu -C incremental=/tmp/tmp.gMG23AgrrT/target/aarch64-unknown-linux-gnu/debug/incremental -L dependency=/tmp/tmp.gMG23AgrrT/target/aarch64-unknown-linux-gnu/debug/deps -L dependency=/tmp/tmp.gMG23AgrrT/target/debug/deps --extern criterion=/tmp/tmp.gMG23AgrrT/target/aarch64-unknown-linux-gnu/debug/deps/libcriterion-757c0a68f524c438.rlib -C debuginfo=2 --cap-lints warn -C linker=aarch64-linux-gnu-gcc -C link-arg=-Wl,-z,relro --remap-path-prefix /usr/share/cargo/registry/wmidi-4.0.9=/usr/share/cargo/registry/wmidi-4.0.9 --remap-path-prefix /tmp/tmp.gMG23AgrrT/registry=/usr/share/cargo/registry`
error[E0599]: no method named `to_freq_f32` found for reference `&Note` in the current scope
   --> benches/bench.rs:127:29
    |
127 |                 *dst = note.to_freq_f32();
    |                             ^^^^^^^^^^^ method not found in `&Note`

error[E0599]: no method named `to_freq_f32` found for reference `&Note` in the current scope
   --> benches/bench.rs:136:39
    |
136 |                 *dst = f64::from(note.to_freq_f32());
    |                                       ^^^^^^^^^^^ method not found in `&Note`

error[E0599]: no method named `to_freq_f64` found for reference `&Note` in the current scope
   --> benches/bench.rs:145:29
    |
145 |                 *dst = note.to_freq_f64();
    |                             ^^^^^^^^^^^ method not found in `&Note`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `wmidi` due to 3 previous errors

[...]

@wmedrano wmedrano reopened this Dec 20, 2023
This was referenced Dec 20, 2023
@wmedrano
Copy link
Member

😮‍💨 How about 4.0.10?

Filed #19 for better testing. Perhaps wmidi should use autopkgtest which is used by debian?

@andhe
Copy link
Author

andhe commented Dec 20, 2023

😮‍💨 How about 4.0.10?

Seems to work in my local build! Will upload to Debian archive now to get full test coverage.

Filed #19 for better testing. Perhaps wmidi should use autopkgtest which is used by debian?

I'm packaging via alot of helpers (including but not limited to generating the package via debcargo-conf and then using sbuild for chroot management for build and test runs). Not sure how to best integrate this all in your upstream CI. The info on my debian packager way of working is available here: https://salsa.debian.org/rust-team/debcargo-conf/-/blob/master/README.rst

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 a pull request may close this issue.

2 participants