cog-rust icon indicating copy to clipboard operation
cog-rust copied to clipboard

build error

Open dkhokhlov opened this issue 1 year ago • 2 comments

@m1guelpf

I am using latest code:

commit 654a227224c90030d216dfe5fbc20c67cb10f451 (HEAD -> main, origin/main, origin/HEAD)
Author: Miguel Piedrafita <[email protected]>
Date:   Fri Dec 15 20:22:01 2023 +0100

with toolchain:

$ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.74.1 (a28077b28 2023-12-04)`

$ rustup show | grep default
stable-x86_64-unknown-linux-gnu (default)
stable-x86_64-unknown-linux-gnu (default)

getting build errors:

   Compiling cog-core v0.2.0 (/home/dmitri/SOURCE/cog-rust/core)
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
  --> core/src/spec.rs:20:16
   |
20 |     fn setup() -> impl Future<Output = Result<Self>> + Send;
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
  --> core/src/spec.rs:33:46
   |
33 |     fn into_response(self, request: Request) -> impl Future<Output = Result<Value>> + Send;
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

error[E0706]: functions in traits cannot be declared `async`
  --> core/src/spec.rs:37:2
   |
37 |     async fn into_response(self, _: Request) -> Result<Value> {
   |     -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     `async` because of this
   |
   = note: `async` trait functions are not currently supported
   = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information

Some errors have detailed explanations: E0562, E0706.
For more information about an error, try `rustc --explain E0562`.
error: could not compile `cog-core` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...

dkhokhlov avatar Dec 15 '23 23:12 dkhokhlov

You need to use nightly or downgrade to the second to last commit. The next release of Rust will work in stable.

m1guelpf avatar Dec 16 '23 00:12 m1guelpf

with nightly:

$ cargo cog
A cargo subcommand to build, run and publish machine learning containers

Usage: cargo cog [OPTIONS] [COMMAND]

Commands:
  login    Log in to Replicate's Docker registry
  build    Build the model in the current directory into a Docker image
  push     Build and push model in current directory to a Docker registry
  predict  Run a prediction
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

$ ll
total 16
drwxrwxr-x  2 dmitri dmitri 4096 Nov 30 08:26 ./
drwxrwxr-x 12 dmitri dmitri 4096 Nov 30 08:26 ../
-rw-rw-r--  1 dmitri dmitri   63 Nov 30 08:26 cog.yaml
-rw-rw-r--  1 dmitri dmitri  170 Nov 30 08:26 predict.py

$ cargo cog build
WARNING: No swap limit support
thread 'main' panicked at cli/src/docker/builder.rs:30:14:
Failed to read Cargo.toml. Make sure you are in the root of your Cog project.: CargoMetadata { stderr: "error: manifest path `/home/dmitri//file-input-project/Cargo.toml` does not exist\n" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

yaml not supported?

dkhokhlov avatar Dec 16 '23 01:12 dkhokhlov