Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Creating a deb file from a Cross build #99

Closed
TotalKrill opened this issue Jul 2, 2019 · 3 comments
Closed

Creating a deb file from a Cross build #99

TotalKrill opened this issue Jul 2, 2019 · 3 comments

Comments

@TotalKrill
Copy link

I am using cross to build my package. How would I generate a deb using cargo deb from that.

@kornelski
Copy link
Collaborator

kornelski commented Jul 2, 2019

I haven't used cross. If it puts compiled files in target/release/, then just cargo deb --no-build should work.

If it puts compiled files in target/<platform triple>/release/, then cargo deb --no-build --target <platform triple> should work.

If it puts compiled files somewhere else, then it won't work.

@TotalKrill
Copy link
Author

TotalKrill commented Jul 3, 2019

Yeah, I think I have a somewhat special setup, but I was hoping it would work anyway.

I have a top level workspace containing [ project-libs, armv7bin, serverbin]. the reason being the libraries contain information sent between the different systems.

so the project is:

workspace/ (I run cargo cross here)
workspace/project-libs
workspace/armv7bin (I run cargo deb here, it seems to try to run stuff on the workspace/target folder)
workspace/serverbin
workspace/target/<triple>/release/armv7bin

I have to build armv7bin using cross from the workspace folder, since cross does not handle crates with relative paths, unfortunately. The resulting binary is put in workspace/target//release. But since cargo deb does not handle workspaces, i run cargo deb inside workspace/armv7bin like this:

cargo deb --target armv7-unknown-linux-gnueabihf --no-build

but then I get the result:

warning: description field is missing in Cargo.toml
warning: license field is missing in Cargo.toml
warning: README.md file exists, but is not specified in `readme` Cargo.toml field
strip: Unable to recognise the format of the input file `/home/me/projects/workspace/target/armv7-unknown-linux-gnueabihf/release/armv7bin'
cargo-deb: unable to strip binary '/home/me/projects/workspace/target/armv7-unknown-linux-gnueabihf/release/armv7bin': strip: exit code: 1.
hint: Target-specific strip commands are configured in [target.armv7-unknown-linux-gnueabihf] strip = { path = "strip" } in /home/me/projects/workspace/.cargo/config

@TotalKrill
Copy link
Author

Reading through my own question i was able to fix this.

The problem was that cargo deb was using the .cargo/config file located under workspace, instead of under workspace/armv7bin

adding the correct objcopy and strip commands to arm-none-eabi-objcopy and arm-none-eabi-strip actually generated a correct debian file that I could install on the target system!

resulting workspace/.cargo/config:

[target.armv7-unknown-linux-gnueabihf]
objcopy = { path ="arm-none-eabi-objcopy" }
strip = { path ="arm-none-eabi-strip" }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants