axodotdev / cargo-dist

📦 shippable application packaging
https://axodotdev.github.io/cargo-dist/
Apache License 2.0
1.47k stars 66 forks source link

Dpendency specified in meta-data is not installed #1417

Closed andrewdavidmackenzie closed 2 weeks ago

andrewdavidmackenzie commented 2 weeks ago

I have added the armv7-unknown-linux-gnueabihf target to my cargo-dist list of targets:

# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.22.0"
# CI backends to support
ci = "github"
# The installers to generate for each app
installers = ["shell", "homebrew", "msi"]
# A GitHub repo to push Homebrew formulas to
tap = "andrewdavidmackenzie/pigg-tap"
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
# Publish jobs to run in CI
publish-jobs = ["homebrew"]
# Which actions to run on pull requests
pr-run-mode = "plan"
# Path that installers should place binaries in
install-path = "CARGO_HOME"
# Whether to install an updater program
install-updater = false

And I specified the toolchain associated with that target as an install dependency via the meta-data:

[workspace.metadata.dist.dependencies.apt]
gcc-aarch64-linux-gnu = { version = '*', targets = ["aarch64-unknown-linux-gnu"] }
gcc-arm-linux-gnueabihf = { version = '*', targets = ["armv7-unknown-linux-gnueabihf"] }

However, in the GH Action Release run you can see that the "Install dependencies" step is empty and the armv7 toolchain is not installed.

I have verified the target is correct, the linker name correct and the package to install is correct, and the build works in local Linux and GH Actions.

andrewdavidmackenzie commented 2 weeks ago

I can no longer find the entry in the docs that explained using [workspace.metadata.dist.dependencies.apt]

Is that still an option, or is using:

[workspace.metadata.dist]
# ...
github-build-setup = "build-setup.yml"

the only supported mechanism, and hence the one I should use?

andrewdavidmackenzie commented 2 weeks ago

Pending response, I'm trying to install the linkers I require myself via that customization method.

Getting this error:

Run sudo apt install gcc-aarch64-linux-gnu
The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt.
Please visit http://www.java.com/ for information on installing Java.

It looks like that is because it is running that on all platforms (macos included), so I will have to check runner.os in that yml snippet?

andrewdavidmackenzie commented 2 weeks ago

I'm getting closer to having release artifact builds working.

Now aarch64 linux build (for RPi) works, but armv7 (32bit for Pi 3) fails with a linkage report error.

That error sounds familiar from other issues I have seen here, so I will close this and move on to finding the fix for that error, maybe in an existing issue...

I assume the declarative way of defining dependencies in Cargo.toml has been deprecated and the "procedural" way of customizing the builds via an additional yml snippet is the way to go and works.