Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking against pythonXX.lib fails on windows within virtualenv #213

Open
striggldy opened this issue Mar 30, 2020 · 1 comment
Open

Linking against pythonXX.lib fails on windows within virtualenv #213

striggldy opened this issue Mar 30, 2020 · 1 comment

Comments

@striggldy
Copy link

When a virtualenv (created with the venv or virtualenv module, pyvenv not tested) is active, building on windows fails with fatal error LNK1181, because the pythonXX.lib cannot be found.

In

} else if cfg!(target_os = "windows") {
println!("cargo:rustc-link-search=native={}\\libs", exec_prefix);

the rustc lib search path {exec_prefix}/libs will be added, which is valid for a system interpreter, but not for virtualenvs created with the modules mentioned above. There's no LIBDIR set as well when running python -c "import sysconfig;print(sysconfig.get_config_var('LIBDIR')"

Is there a way to specifiy additional link search paths for rust_cpython?

@nemjit001
Copy link

nemjit001 commented Dec 1, 2022

Hey, I found a fix for this. Seems like checking the sys.exec_prefix instead of sys.base_prefix in the get_config_from_interpreter function causes the issue.

I got it working locally. @dgrunwald how can I contribute the fix?

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

No branches or pull requests

2 participants