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

"error: no bin target named api. Available bin targets: crane-dummy-cherami" #590

Closed
samuela opened this issue Apr 16, 2024 · 4 comments
Closed

Comments

@samuela
Copy link

samuela commented Apr 16, 2024

The documentation suggests that adding cargoExtraArgs = "--bin=api"; will cause crane to only build the api binary, as in cargo build --bin=api. However, I'm seeing the following error when doing so:

error: builder for '/nix/store/nv80m22mn133gmsg2fraggxcl001nlpd-cherami-build.drv' failed with exit code 101;
       last 25 log lines:
       >     Checking color-eyre v0.6.2
       >     Checking hyper-rustls v0.24.2
       >     Checking cliclack v0.1.13
       >     Checking parse_duration v2.1.1
       >     Checking chrono-humanize v0.2.3
       >     Checking aws-smithy-runtime v1.1.4
       >     Checking email_address v0.2.4
       >    Compiling sqlx-macros-core v0.7.3
       >     Checking tower-http v0.5.2
       >    Compiling async-recursion v1.0.5
       >     Checking reqwest v0.11.23
       >     Checking clap v4.4.18
       >    Compiling sqlx-macros v0.7.3
       >     Checking aws-sdk-sts v1.12.0
       >     Checking aws-sdk-sso v1.12.0
       >     Checking aws-sdk-ssooidc v1.12.0
       >     Checking aws-sdk-ec2 v1.17.0
       >     Checking aws-config v1.1.4
       >     Checking sqlx v0.7.3
       >     Finished release [optimized] target(s) in 1m 45s
       > ++ command cargo build --release --bin=api
       > error: no bin target named `api`.
       > Available bin targets:
       >     crane-dummy-cherami
       >
       For full logs, run 'nix log /nix/store/nv80m22mn133gmsg2fraggxcl001nlpd-cherami-build.drv'.
error: 1 dependencies of derivation '/nix/store/gjsaicr5k4r09c983k46vxw6xn3ccvi5-cherami-build.drv' failed to build
root@b62e2017d34d:/workspaces/bitbop/cherami# cargo build --bin=api
    Finished dev [unoptimized + debuginfo] target(s) in 0.47s
root@b62e2017d34d:/workspaces/bitbop/cherami#

Am I missing something? Is this functioning as intended?

@dpc
Copy link
Contributor

dpc commented Apr 16, 2024

Given that I see 3rd party dependencies, it could be that pasing of args to implicit XDepsOnly is breaking. Make sure to split your build into explicit build-deps-only and build steps using cargoArtifacts passing.

@samuela
Copy link
Author

samuela commented Apr 16, 2024

Why do I have to do this? Why doesn't it happen automatically?

@dpc
Copy link
Contributor

dpc commented Apr 16, 2024

I think it is happening automatically and going wrong. :D

@ipetkov
Copy link
Owner

ipetkov commented Apr 21, 2024

Why do I have to do this? Why doesn't it happen automatically?

The short answer is when buildDepsOnly runs we strip out all sources and stub out any binary targets so that if you were to add a new target it would not require rebuilding the entire workspace from scratch. There's an existing issue for this (#268) so will dedup this to there

@ipetkov ipetkov closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2024
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

3 participants