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

Can cargo dist build exactly the binary? #1442

Open
tisonkun opened this issue Oct 8, 2024 · 3 comments
Open

Can cargo dist build exactly the binary? #1442

tisonkun opened this issue Oct 8, 2024 · 3 comments
Assignees

Comments

@tisonkun
Copy link
Contributor

tisonkun commented Oct 8, 2024

I built a project that has several test-only, non-binary crates.

Now when cargo-dist runs cargo dist build, those crates will be built and some of them may fail - https://github.com/tisonkun/morax/actions/runs/11226860397/job/31208119385?pr=9

Since those crates have nothing to do with the binary I'd like to release, I wonder if it's possible to exclude their build.

@mistydemeo
Copy link
Contributor

You can try adding a [metadata.dist] section to their Cargo.toml files with dist = false - that will tell cargo-dist not to try to build them. https://opensource.axo.dev/cargo-dist/book/reference/config.html#dist

@tisonkun
Copy link
Contributor Author

tisonkun commented Oct 8, 2024

tisonkun/morax#9

@mistydemeo thanks for your suggestion. But it doesn't seem to work.

@tisonkun
Copy link
Contributor Author

tisonkun commented Oct 8, 2024

At commit tisonkun/morax@f2e8ee7

It failed with https://github.com/tisonkun/morax/actions/runs/11227771504/job/31210572728

It seems that the rdkafka crate still built although all its dependent is excluded by package.netadata.dist.dist = false.

building cargo target (x86_64-pc-windows-msvc/dist --workspace)
    Updating crates.io index
   Compiling morax-protos v0.1.0 (D:\a\morax\morax\api\protos)
   Compiling libz-sys v1.1.20
   Compiling morax-runtime v0.1.0 (D:\a\morax\morax\crates\runtime)
   Compiling kafka-api v0.4.1 (D:\a\morax\morax\api\kafka-api)
   Compiling morax-meta v0.1.0 (D:\a\morax\morax\crates\meta)
   Compiling morax-storage v0.1.0 (D:\a\morax\morax\crates\storage)
   Compiling zstd-sys v2.0.13+zstd.1.5.6
   Compiling morax-kafka-broker v0.1.0 (D:\a\morax\morax\crates\kafka-broker)
   Compiling morax-wal-broker v0.1.0 (D:\a\morax\morax\crates\wal-broker)
   Compiling morax-server v0.1.0 (D:\a\morax\morax\crates\server)
   Compiling lz4-sys v1.11.0
   Compiling zstd-safe v6.0.6
   Compiling libgit2-sys v0.[17](https://github.com/tisonkun/morax/actions/runs/11227771504/job/31210572728#step:8:18).0+1.8.1
   Compiling morax-telemetry v0.1.0 (D:\a\morax\morax\crates\telemetry)
   Compiling rdkafka-sys v4.7.0+2.3.0
   Compiling snap v1.1.1
error: failed to run custom build command for `rdkafka-sys v4.7.0+2.3.0`

Caused by:
  process didn't exit successfully: `D:\a\morax\morax\target\dist\build\rdkafka-sys-e938e9d14[18](https://github.com/tisonkun/morax/actions/runs/11227771504/job/31210572728#step:8:19)95f08\build-script-build` (exit code: 101)
  --- stdout
  Cloning librdkafka
  Configuring librdkafka

  --- stderr
  Building and linking librdkafka statically
  Running command: "cp -a librdkafka/. D:\a\morax\morax\target\x86_64-pc-windows-msvc\dist\build\rdkafka-sys-e3eacd032f9e3efa\out" in dir: .
  Running command: "\\?\D:\a\morax\morax\target\x86_64-pc-windows-msvc\dist\build\rdkafka-sys-e3eacd032f9e3efa\out\configure --disable-ssl --disable-gssapi --disable-curl --disable-zstd --disable-lz4-ext" in dir: D:\a\morax\morax\target\x86_64-pc-windows-msvc\dist\build\rdkafka-sys-e3eacd032f9e3efa\out
  thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rdkafka-sys-4.7.0+2.3.0\build.rs:38:[19](https://github.com/tisonkun/morax/actions/runs/11227771504/job/31210572728#step:8:20):
  Command failed with error: %1 is not a valid Win32 application. (os error 193)
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
  × failed to find bin morax.exe for path+file:///D:/a/morax/morax/cmd/morax#[email protected]
  help: did the above build fail?

@ashleygwilliams ashleygwilliams self-assigned this Oct 17, 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