-
Notifications
You must be signed in to change notification settings - Fork 784
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
Can't cross-compile rust lib from linux to windows #666
Comments
Sorry, I'm not sure it's possible now... |
Hey is there any update on this one ? I am trying to build a python library for windows with maturin using the same kind of setting by using cross : https://github.com/rust-embedded/cross It is frustrating since the only problem is at link and normally everything is there. I tried to pass some --rustc-extra-args="-l dylib=pythonXY:python38" to maturin in order to force the finding. But then maturin tell me I have no #[link(...)] in my crate, which is normal since it is pyo3 related and not user-defined crate related. I have no insight how to make a workaround on that :/ and I want to avoid using travis and a windows vm. I prefer to stay in a full linux setting with cross-compilation for mac and win. Do you have any advice for me to tweak something in my build setting or directly adding a feature in the code ? |
@benoitbayol from what I read you're building a Python extension module, and have the In theory you shouldn't need linking at all for an extension module, so what pyo3 is doing here is definitely wrong. We have some open discussion around the Maybe I will provide a patch later in the next week or so... |
Yes I have extension_module. A patch would be so great :) |
@benoitbayol can you please have a go with #923 and let me know if this resolves your problem? Thanks. |
Hey is there any updates on this? I'm having the same issue and it's really frustrating |
@mahmoudfarouq can you try the branch in the PR I linked and let me know if that works for you? |
@davidhewitt Just tried it now, didn't work. however, before the output contained
but now it's
This is my
|
@mahmoudfarouq great, thanks for feedback. Can you please look in your |
Ah yes that branch is quite old, I should probably rebase it 😅 |
I don't have it set, can you please tell me to what should i set it? |
I think it should should be the "libs" subdirectory of the (There's a bit more detail on cross-compiling here: https://pyo3.rs/v0.11.1/building_and_distribution.html#cross-compiling) |
@davidhewitt I think this is what i'm missing, donno how to fix though. |
TBH looking at https://wiki.python.org/moin/WindowsCompilers#GCC_-_MinGW-w64_.28x86.2C_x64.29 support for mingw might have stopped at Python 3.4? Afraid I haven't tried to do this cross-compile myself, so also don't have any idea how you would get a suitable build of Python to link against with the mingw target. What are you trying to do this cross-compile for? If it's to package a wheel to distribute for other users, then I think you want to be targeting FWIW, the python packaging docs suggest using Appveyor to build the package on a Windows host, rather than cross-compile (Github Actions also supports Windows hosts). |
I didn't want to use windows and msvc because this would be a big install and setup for a really tiny package, but seems this is my only choice, Thanks man for your help :"D |
🐛 Bug Reports
When reporting a bug, please provide the following information. If this is not a bug report you can just discard this template.
🌍 Environment
rustc --version
): 1.40.0-nightly (95f437b3c 2019-10-27)version = "0.x.y"
withgit = "https://github.com/PyO3/pyo3")?
yes💥 Reproducing
I'm trying to compile this lib on linux for windows.
Running with
cargo build --release --target "x86_64-pc-windows-gnu" -v
, I'm getting this error:The text was updated successfully, but these errors were encountered: