Skip to content

Get build to work on macOS#35

Merged
mmaker merged 2 commits into
mainfrom
macos-build
May 27, 2026
Merged

Get build to work on macOS#35
mmaker merged 2 commits into
mainfrom
macos-build

Conversation

@hellais
Copy link
Copy Markdown
Member

@hellais hellais commented Apr 16, 2026

Use pyo3_build_config to build correct build and linker flags on macOS.

hellais and others added 2 commits May 11, 2026 15:27
Today, the README gives some information for how to link the python interpreter and expects the user to find their way.
This commit only enables PyO3 extension-module for maturin builds, but disable it for plain cargo builds.
This way, Rust test binaries link libpython correctly.
Along the way, we remove some unused configuration flags in build.rs, and add wheels/ to .gitignore.
@mmaker
Copy link
Copy Markdown
Collaborator

mmaker commented May 11, 2026

Hi @hellais! I've tested it on my machine and made an extra commit for the following:

  1. ignore the wheels/ folder.
  2. update the ooniauth_py.pyi file
  3. remove the following lines, which I believe are unused:
    println!("cargo:rustc-check-cfg=cfg(Py_3_10)");
    println!("cargo:rustc-check-cfg=cfg(Py_3_11)");
    println!("cargo:rustc-check-cfg=cfg(Py_3_12)");
    println!("cargo:rustc-check-cfg=cfg(Py_3_13)");
    println!("cargo:rustc-check-cfg=cfg(Py_3_14)");
    println!("cargo:rustc-check-cfg=cfg(Py_3_15)");
  1. make cargo test work without writing yourself the linking flags, and update readme accordingly.

I'm OK to remove (4), and otherwise the patch looks good to me.

@mmaker
Copy link
Copy Markdown
Collaborator

mmaker commented May 16, 2026

@hellais friendly bump here!

Copy link
Copy Markdown
Collaborator

@mmaker mmaker left a comment

Choose a reason for hiding this comment

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

On my machines this still doesn't compile.

Comment thread ooniauth-py/build.rs Outdated
Comment on lines +13 to +18
println!("cargo:rustc-check-cfg=cfg(Py_3_10)");
println!("cargo:rustc-check-cfg=cfg(Py_3_11)");
println!("cargo:rustc-check-cfg=cfg(Py_3_12)");
println!("cargo:rustc-check-cfg=cfg(Py_3_13)");
println!("cargo:rustc-check-cfg=cfg(Py_3_14)");
println!("cargo:rustc-check-cfg=cfg(Py_3_15)");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't seem to be using any of these flags, are these lines necessary?

@mmaker
Copy link
Copy Markdown
Collaborator

mmaker commented May 23, 2026

@hellais bump here!

@LDiazN
Copy link
Copy Markdown
Collaborator

LDiazN commented May 26, 2026

I tested this locally on linux and seems to be working FYI

@hellais
Copy link
Copy Markdown
Member Author

hellais commented May 27, 2026

Thanks for updating the readme docs and making the extension module optional. I don't think we need the rustc-check-cfg= at this time. They may be required depending on the setup we opt for in the build matrix, but I think it's fine to drop them as part of this changeset.

For me this is good to go.

@mmaker mmaker merged commit e5469b8 into main May 27, 2026
2 checks passed
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