fix(deps): add Cross.toml to install libudev-dev for linux cross-compilation#326
fix(deps): add Cross.toml to install libudev-dev for linux cross-compilation#326
Conversation
…ilation The hidapi crate requires libudev-dev at build time. When using cross for Linux targets, the default Docker images don't have it installed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical build failures during cross-compilation for Linux targets by adding a Cross.toml configuration. This new file specifies pre-build commands to install the libudev-dev package, which is a necessary dependency for the hidapi crate, ensuring successful builds for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu environments. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a Cross.toml file to fix cross-compilation for Linux by installing libudev-dev. The approach is correct. My review includes suggestions to improve the pre-build commands by following containerization best practices, such as chaining apt-get commands and cleaning up the cache to reduce image size and improve robustness.
Note: Security Review has been skipped due to the limited scope of the PR.
| "apt-get update", | ||
| "apt-get install -y libudev-dev", |
There was a problem hiding this comment.
For better robustness and smaller container image sizes, it's a good practice to chain apt-get commands, use --no-install-recommends, and clean up the cache afterwards. This ensures atomicity and prevents installing unnecessary packages.
"apt-get update && apt-get install -y --no-install-recommends libudev-dev && rm -rf /var/lib/apt/lists/*"
| "apt-get update", | ||
| "apt-get install -y libudev-dev:$CROSS_DEB_ARCH", |
There was a problem hiding this comment.
Similar to the other target, it's a good practice to chain apt-get commands, use --no-install-recommends, and clean up the cache to create smaller and more robust container images.
"apt-get update && apt-get install -y --no-install-recommends libudev-dev:$CROSS_DEB_ARCH && rm -rf /var/lib/apt/lists/*"
Greptile SummaryThis PR adds a
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant GH as GitHub Actions
participant Cross as cross (build tool)
participant Docker as Cross Docker Container
participant Cargo as cargo build
GH->>Cross: cross build --target <linux-target>
Cross->>Docker: Start container for target
Docker->>Docker: Execute pre-build commands (Cross.toml)
Note over Docker: apt-get update
Note over Docker: [aarch64] dpkg --add-architecture $CROSS_DEB_ARCH
Note over Docker: apt-get install -y libudev-dev[:<arch>]
Docker->>Cargo: Build fnox (with libudev available)
Note over Cargo: ctap-hid-fido2 → hidapi → libudev-dev resolved
Cargo-->>GH: Binary artifact
Last reviewed commit: cca6388 |
### 🐛 Bug Fixes - **(set)** error on encryption failure; use LocalStack for AWS tests by [@jdx](https://github.com/jdx) in [#324](#324) ### 📦️ Dependency Updates - add Cross.toml to install libudev-dev for linux cross-compilation by [@jdx](https://github.com/jdx) in [#326](#326)
Summary
Cross.tomlwith pre-build commands to installlibudev-devin Docker containers used bycrossfor Linux targetsx86_64-unknown-linux-gnuandaarch64-unknown-linux-gnucaused by missinglibudev(required byhidapicrate)$CROSS_DEB_ARCHfor aarch64 to install the correct architecture's packageTest plan
cross build --target x86_64-unknown-linux-gnusucceeds locallycross build --target aarch64-unknown-linux-gnubuilding locally🤖 Generated with Claude Code
Note
Low Risk
Build-only configuration change that affects cross-compilation container setup, with minimal impact on runtime behavior.
Overview
Adds a new
Cross.tomlto customizecrossDocker images for Linux builds by running pre-build apt commands.The pre-build steps install
libudev-devforx86_64-unknown-linux-gnu, and foraarch64-unknown-linux-gnuthey add the appropriate Debian architecture and install the arch-specificlibudev-devpackage via$CROSS_DEB_ARCH.Written by Cursor Bugbot for commit cca6388. This will update automatically on new commits. Configure here.