Skip to content

fix(build): add z3 include path for RHEL/Fedora bindgen compatibility#1388

Open
russellb wants to merge 1 commit into
NVIDIA:mainfrom
russellb:fix/z3-bindgen-rhel
Open

fix(build): add z3 include path for RHEL/Fedora bindgen compatibility#1388
russellb wants to merge 1 commit into
NVIDIA:mainfrom
russellb:fix/z3-bindgen-rhel

Conversation

@russellb
Copy link
Copy Markdown
Contributor

Summary

On RHEL and Fedora, the system z3.pc file returns a malformed include path (-I/usr/usr/include/z3 — double /usr prefix), causing the z3-sys crate's bindgen step to fail with 'z3.h' file not found. Add the correct include path via .cargo/config.toml so bindgen can find the header regardless of the broken pkg-config output.

Related Issue

None — discovered while testing the nftables migration (#1335) on a RHEL dev host.

Changes

  • Add .cargo/config.toml with BINDGEN_EXTRA_CLANG_ARGS = "-I/usr/include/z3" — picked up automatically by cargo
  • Add the same env var to mise.toml for consistency with the mise-based workflow
  • The -I flag for a nonexistent path is silently ignored by clang, so this is harmless on distros where z3 headers are in the default include path

Testing

  • mise run pre-commit passes
  • Verified cargo build succeeds on RHEL without manually setting CPATH
  • Verified no effect on macOS where z3 headers are in the default path

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 14, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@russellb
Copy link
Copy Markdown
Contributor Author

russellb commented May 14, 2026

This seems like a package bug, but I think the CFLAGS addition is harmless where it's not needed.

cc @maxamillion

Comment thread mise.toml Outdated
Comment on lines +58 to +61
# z3-sys bindgen needs the z3 include path. On some distros (e.g. RHEL)
# the header lives in /usr/include/z3/ rather than /usr/include/. The
# extra -I is harmless on systems where the path doesn't exist.
BINDGEN_EXTRA_CLANG_ARGS = "-I/usr/include/z3"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: Why is this specified twice? Once here and in the .cargo/config.toml file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one should be removed. I added it here first, but then it wasn't helpful when I was building outside of mise, so I added the other. Only the first one was supposed to end up in the PR, and I failed to review the result. Sorry about that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems unrelated to the INCLUDE change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sorry ... I told my agent to split out a build fix into a separate branch and PR and then failed to look at the result since it was supposed to be simple ... apologies.

On RHEL and Fedora, the z3 header is installed to /usr/include/z3/
rather than /usr/include/. The z3-sys crate's bindgen step fails
because pkg-config doesn't find z3 on these distros. Add the extra
include path via BINDGEN_EXTRA_CLANG_ARGS in mise.toml — the -I
flag is silently ignored on systems where the path doesn't exist.
@russellb russellb force-pushed the fix/z3-bindgen-rhel branch from 0a34672 to ca8815a Compare May 15, 2026 12:04
@russellb russellb requested a review from elezar May 15, 2026 12:05
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.

2 participants