cogciprocate / ocl

OpenCL for Rust
Other
721 stars 75 forks source link

Couldn't compile : "Couldn't find 'write' in core" after some update. #224

Closed regular-dev closed 11 months ago

regular-dev commented 11 months ago

Hello, i tried to compile my ml library that uses ocl as dependency but got an error related ocl crate. Then i decided to build single ocl from github and got the same error log:

Compiling ocl v0.19.4 (/tmp/ocl/ocl)
error[E0433]: failed to resolve: could not find `write` in `core`
  --> ocl/src/error.rs:19:17
   |
19 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `write` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `write` in `core`
  --> ocl/src/standard/buffer.rs:38:17
   |
38 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `write` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `write` in `core`
  --> ocl/src/standard/device.rs:14:17
   |
14 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `write` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `write` in `core`
  --> ocl/src/standard/kernel.rs:27:17
   |
27 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `write` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `write` in `core`
  --> ocl/src/standard/platform.rs:16:17
   |
16 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `write` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `write` in `core`
  --> ocl/src/standard/spatial_dims.rs:10:17
   |
10 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `write` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `option` in `core`
  --> ocl/src/error.rs:19:17
   |
19 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `option` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `fmt` in `core`
  --> ocl/src/error.rs:19:17
   |
19 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `fmt` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `convert` in `core`
  --> ocl/src/error.rs:19:17
   |
19 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `convert` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `option` in `core`
  --> ocl/src/standard/buffer.rs:38:17
   |
38 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `option` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `fmt` in `core`
  --> ocl/src/standard/buffer.rs:38:17
   |
38 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `fmt` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `convert` in `core`
  --> ocl/src/standard/buffer.rs:38:17
   |
38 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `convert` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `fmt` in `core`
  --> ocl/src/standard/device.rs:14:17
   |
14 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `fmt` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `fmt` in `core`
  --> ocl/src/standard/kernel.rs:27:17
   |
27 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `fmt` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `fmt` in `core`
  --> ocl/src/standard/platform.rs:16:17
   |
16 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `fmt` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `fmt` in `core`
  --> ocl/src/standard/spatial_dims.rs:10:17
   |
10 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `fmt` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `option` in `core`
  --> ocl/src/error.rs:19:17
   |
19 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `option` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
   |
4  + use core::option::Option;
   |
4  + use crate::error::std::option::Option;
   |
4  + use std::option::Option;
   |
help: if you import `Option`, refer to it directly
   |
19 | #[derive(Debug, thiserror::Error)]
   |

error[E0433]: failed to resolve: could not find `option` in `core`
  --> ocl/src/standard/buffer.rs:38:17
   |
38 | #[derive(Debug, thiserror::Error)]
   |                 ^^^^^^^^^^^^^^^^ could not find `option` in `core`
   |
   = note: this error originates in the derive macro `thiserror::Error` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
   |
3  + use core::option::Option;
   |
3  + use crate::standard::buffer::std::option::Option;
   |
3  + use std::option::Option;
   |
help: if you import `Option`, refer to it directly
   |
38 | #[derive(Debug, thiserror::Error)]`

rustc 1.72.1 (d5c2e9c34 2023-09-13)

So I guess there is a problem from ocl crate. Three months ago everything compiled fine. Thanks!

ybh1998 commented 11 months ago

I'm also encountering this issue. I think this may be related to ocl-core shadowing core. https://github.com/rust-lang/rust/issues/90960

ybh1998 commented 11 months ago

I found this error was caused by a breaking change of dependency thiserror v1.0.49. commit: https://github.com/dtolnay/thiserror/commit/f0f303a7bac9e65f9a0664141f58da9b78f21927

I can temporarily solve this issue by cargo update -p thiserror --precise 1.0.48

Maybe it's better to solve this problem in this repo? Like expand all core to full name ocl_core in https://github.com/cogciprocate/ocl/blob/3d0c52bfa75146a14b16c55e799825ad52f1f19e/ocl/src/lib.rs#L53C35-L53C35

regular-dev commented 11 months ago

I found this error was caused by a breaking change of dependency thiserror v1.0.49. commit: dtolnay/thiserror@f0f303a

I can temporarily solve this issue by cargo update -p thiserror --precise 1.0.48

Maybe it's better to solve this problem in this repo? Like expand all core to full name ocl_core in https://github.com/cogciprocate/ocl/blob/3d0c52bfa75146a14b16c55e799825ad52f1f19e/ocl/src/lib.rs#L53C35-L53C35

Thanks for temporary solution. I am not very familar with ocl codebase, so waiting for maintainer or nice people's PR.

c0gent commented 11 months ago

Fixed in 0.19.5 by setting thiserror version to 1.0.48.

We can re-alias ocl-core at some point in the future if needed.

AdrianEddy commented 10 months ago

We can re-alias ocl-core at some point in the future if needed.

I think that would be a better solution. Currently we can't use any other version of thiserror in our apps when using ocl, since there's an failed to select a version for "thiserror" error then

c0gent commented 10 months ago

Sounds good.

Do you know why this is? Seems strange that there should be a conflict like that.

AdrianEddy commented 10 months ago

@c0gent fix here: https://github.com/cogciprocate/ocl/pull/225