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 thread e2e/rust/tests/bypass_detection.rs
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
@maxamillion
Copy link
Copy Markdown
Collaborator

@russellb I'm good with putting this specifically in the rpm spec file if there's a desire to keep it scoped there, but I agree with you that it's likely harmless to have it project scoped. I'm good with it if @elezar @drew @johntmyers and @TaylorMutch are.

Copy link
Copy Markdown
Member

@elezar elezar left a comment

Choose a reason for hiding this comment

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

LGTM.

I'll defer to @drew or one of the other reviewers though.

@russellb
Copy link
Copy Markdown
Contributor Author

@russellb I'm good with putting this specifically in the rpm spec file if there's a desire to keep it scoped there, but I agree with you that it's likely harmless to have it project scoped. I'm good with it if @elezar @drew @johntmyers and @TaylorMutch are.

@maxamillion it looks like it's a bug in the z3 package. pkg-config seems to be generating a bogus value.

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.

3 participants