Skip to content

fix(deps): add Cross.toml to install libudev-dev for linux cross-compilation#326

Merged
jdx merged 1 commit intomainfrom
fix/cross-libudev
Mar 8, 2026
Merged

fix(deps): add Cross.toml to install libudev-dev for linux cross-compilation#326
jdx merged 1 commit intomainfrom
fix/cross-libudev

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Mar 8, 2026

Summary

  • Adds Cross.toml with pre-build commands to install libudev-dev in Docker containers used by cross for Linux targets
  • Fixes build failures for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu caused by missing libudev (required by hidapi crate)
  • Uses $CROSS_DEB_ARCH for aarch64 to install the correct architecture's package

Test plan

  • cross build --target x86_64-unknown-linux-gnu succeeds locally
  • cross build --target aarch64-unknown-linux-gnu building locally
  • CI release workflow passes for both Linux targets

🤖 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.toml to customize cross Docker images for Linux builds by running pre-build apt commands.

The pre-build steps install libudev-dev for x86_64-unknown-linux-gnu, and for aarch64-unknown-linux-gnu they add the appropriate Debian architecture and install the arch-specific libudev-dev package via $CROSS_DEB_ARCH.

Written by Cursor Bugbot for commit cca6388. This will update automatically on new commits. Configure here.

…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>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Cross-compilation configuration: Introduced a Cross.toml file to define pre-build steps for Linux cross-compilation targets.
  • Dependency resolution: Ensured libudev-dev is installed in Docker containers used by cross to resolve build failures caused by missing libudev for hidapi crate.
  • Architecture-specific installation: Utilized $CROSS_DEB_ARCH for aarch64 targets to correctly install the architecture-specific libudev-dev package.
Changelog
  • Cross.toml
    • Added pre-build commands to install libudev-dev for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu targets.
Activity
  • The pull request was generated using Claude Code.
  • The author has provided a test plan, including local verification for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu builds, and a check for the CI release workflow.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Cross.toml
Comment on lines +3 to +4
"apt-get update",
"apt-get install -y libudev-dev",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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/*"

Comment thread Cross.toml
Comment on lines +10 to +11
"apt-get update",
"apt-get install -y libudev-dev:$CROSS_DEB_ARCH",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 8, 2026

Greptile Summary

This PR adds a Cross.toml configuration file to fix Linux cross-compilation builds by installing libudev-dev as a pre-build step inside the cross Docker containers. The dependency is required by the hidapi crate (pulled in transitively via ctap-hid-fido2), which links against libudev on Linux.

  • Adds Cross.toml with pre-build commands for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu targets
  • Correctly uses dpkg --add-architecture $CROSS_DEB_ARCH + libudev-dev:$CROSS_DEB_ARCH for the aarch64 target to install the ARM64 variant of the package into the x86_64 cross-compilation container
  • Directly corresponds to the two Linux targets using cross in .github/workflows/release.yml
  • Note: the aarch64 build is not yet verified locally (marked unchecked in the test plan)

Confidence Score: 4/5

  • Safe to merge — the change is a single, well-scoped config file that follows the documented cross pattern for adding system dependencies.
  • The approach is correct: $CROSS_DEB_ARCH is the proper environment variable provided by cross for target Debian architecture names, and the two-step dpkg --add-architecture + arch-suffixed install is the standard pattern for cross-arch packages. The only open question is the untested aarch64 path (unchecked in the test plan), which is a minor risk but not a code correctness issue.
  • No files require special attention.

Important Files Changed

Filename Overview
Cross.toml New file configuring cross pre-build commands to install libudev-dev for both Linux targets; uses correct $CROSS_DEB_ARCH pattern for aarch64 cross-architecture package installation.

Sequence Diagram

sequenceDiagram
    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
Loading

Last reviewed commit: cca6388

@jdx jdx enabled auto-merge (squash) March 8, 2026 00:32
@jdx jdx merged commit f1a794e into main Mar 8, 2026
21 checks passed
@jdx jdx deleted the fix/cross-libudev branch March 8, 2026 00:50
jdx pushed a commit that referenced this pull request Mar 8, 2026
### 🐛 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)
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

Successfully merging this pull request may close these issues.

1 participant