Cross-compiling to windows with pyo3 #319
Replies: 3 comments
-
Hi @Waelwindows, thanks for the report! Unfortunately I'm not very familiar with neither pyo3 nor Windows cross compilation so I'm not sure how to debug this myself. Searching for Though if anyone figures this out it would be great to either fix things or document them appropriately! |
Beta Was this translation helpful? Give feedback.
-
I've managed to fix the devshell problem by passing in RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
pkgs.pkgsCross.mingwW64.windows.pthreads
]); However this bricks the builds for any other target. As for the actual nix build itself, no clues yet. I've looked into the issue you mentioned and it should've been fixed by If only there was a way to see exactly what the derivation is actually doing, We'd have a better way to diagnose this |
Beta Was this translation helpful? Give feedback.
-
@Waelwindows you can set I have a sneaking suspicion the issue may be related to |
Beta Was this translation helpful? Give feedback.
-
Perhaps related to #216,
I'm trying to cross-compile my project to
x86_64-pc-windows-gnu
using crane.However, I get the following error message which I haven't faced before in my devshell environment
I'm having issues cross compiling it using the given instructions in the windows cross-compilation example, so I tried building in a dev shell.
While it can compile in the devshell, it doesn't compile as is, You have to disable
pthread
first because that causes linking errors for some reason. You get many linking errors aboutlibpthread
symbols culminating in this oneAfter compiling once without pthread it'll proceed till it complains about a missing
libpthread
. Only then can you addpthread
and it finish compiling. I can confirm that the resulting.dll
does function normally, at least viapython
onwine
.So the steps in order to build it in the devshell are:
cargo build --target="x86_64-pc-windows-gnu"
withpkgsCross.mingwW64.windows.pthreads
commented out indevShell
's `buildInputpkgsCross.mingwW64.windows.pthreads
target/x86_64-pc-windows-gnu
Obviously this won't do, and i have to find a fix for this. Ideally i'd like to be able to do all of this in just
nix build
so that I do this in CI.Here's my latest attempt so far.
On a side note, i think it would be great if
crane
had amaturin
builder just likenixpkgs
'smaturinHook
.Beta Was this translation helpful? Give feedback.
All reactions