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

opencv-0.93.0/build.rs:203:26 compile error:expected &str, found String #620

Closed
phial3 opened this issue Sep 22, 2024 · 8 comments
Closed

Comments

@phial3
Copy link

phial3 commented Sep 22, 2024

Before reporting an issue please first check the
troubleshooting guide. If
the issue you're encountering is not solved thereby please state the following in your bugreport:

  1. Operating system : MacOS M2
  2. The way you installed OpenCV: package by homebrew
  3. OpenCV version : 4.10.0
  4. rustc version : rustc 1.83.0-nightly (1d68e6dd1 2024-09-21)
  5. Attach the full output of the following command from your project directory:
    RUST_BACKTRACE=full cargo build -vv 
error[E0308]: mismatched types
   --> /Users/admin/.cargo/registry/src/rsproxy-0dccff568467c15b/opencv-0.93.0/build.rs:203:26
    |
203 |             out.flag_if_supported(format!("-F{}", p.to_str().expect("Can't convert path to str")));
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found `String`
    |
    = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
@twistedfall
Copy link
Owner

That's weird looks like you have an old cc crate, can you please show the output you're getting when running in the project directory:

cargo tree | grep cc

@twistedfall
Copy link
Owner

Although I must say that no version of cc after the minimum supported 1.0.83 has had &str as an argument to flag_if_supported(), they all have impl AsRef<OsStr>. Maybe it's a regression in rustc's nightly?

@phial3
Copy link
Author

phial3 commented Sep 22, 2024

That's weird looks like you have an old cc crate, can you please show the output you're getting when running in the project directory:

cargo tree | grep cc

this is cc v1.0.83

@phial3
Copy link
Author

phial3 commented Sep 22, 2024

That's weird looks like you have an old cc crate, can you please show the output you're getting when running in the project directory:

cargo tree | grep cc

this is cc v1.0.83

I don't know why is that, rust stable 1.81.0 is the same mistake.

use opencv = "0.92", it's good

@twistedfall
Copy link
Owner

Can you please also try doing cargo clean to see if it helps with the issue?

@phial3
Copy link
Author

phial3 commented Sep 22, 2024

Can you please also try doing cargo clean to see if it helps with the issue?

I've tried it, and the mistake is still there

error[E0308]: mismatched types
   --> /Users/admin/.cargo/registry/src/rsproxy-0dccff568467c15b/opencv-0.93.0/build.rs:203:26
    |
203 |             out.flag_if_supported(format!("-F{}", p.to_str().expect("Can't convert path to str")));
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found `String`
    |
    = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0308`.
error: could not compile `opencv` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

@twistedfall
Copy link
Owner

Thank you for reporting! This regression should now be fixed in v0.93.1

@phial3
Copy link
Author

phial3 commented Sep 22, 2024

Thank you for reporting! This regression should now be fixed in v0.93.1

👍👍👍

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