Closed mrdotb closed 1 year ago
Thanks. So I try the https://github.com/philss/rustler_precompilation_example and I got the same issue.
mix test
Compiling 2 files (.ex)
23:40:49.386 [debug] Copying NIF from cache and extracting to c:/Users/john/projects/rustler_precompilation_example/_build/test/lib/rustler_precompilation_example/priv/native/example-v0.5.0-nif-2.15-x86_64-pc-windows-msvc.dll
I have MSVC and MinGW installed. I removed MinGW from the env, then from the computer. No success. What's the recommended windows env where the precompiled nif should work on windows ? I can try to go a bit deeper but I don't know what is the flow of things. Any clues what sources I should look ?
Oh, I see. There are some ideas from this tutorial: https://www.erlang.org/doc/tutorial/debugging.html I'm going to test that on Monday. Thanks for reporting!
I've made significant progress after investing some time in exploration and experimentation.
Initially, I attempted to locally replicate what occurs within the action using cross and cross-toolchain. I followed the instructions for building the dockerfile, which allowed me to generate a DLL with debug features using 'cross' within WSL (Windows Subsystem for Linux).
Following that, I attempted to utilize this DLL on Windows by setting up a local server. Although there may be simpler alternatives, I was unable to find one and opted for this approach:
use RustlerPrecompiled,
otp_app: :resvg,
crate: "resvg",
# base_url: "#{github_url}/releases/download/v#{version}",
base_url: "http://localhost:8080/v#{version}",
Even though the NIF couldn't be loaded, the error message I received differed from the previous one. This strategy is likely to aid in identifying the exact issue with cross wine compilation in the docker, albeit requiring additional time and research.
I also experimented with using NIF versions 2.15 and 2.16 by upgrading the Elixir and Erlang versions on my Windows machine from OTP 23 to OTP 24 both got the same errors.
I also installed msvc 2019 on visual studio only the 2022 was installed (I saw on the docker a mention that the 2019 is used) but same errors.
I found a temporary fix which is generating the x86_64-pc-windows-msvc
on my local Windows machine. Once I had done that, I edited the release and replaced the x86_64-pc-windows-msvc
2.16 built NIF with the one I had constructed locally. This allowed me to successfully use the precompiled NIF on a separate Windows computer.
@mrdotb this is awesome! Thank you for sharing! I couldn't yet dive into this, but I should be able soon.
I try again today and now it work on my two windows computer. I can't reproduce the bug anymore. I did not do any modification my windows computers. Only think I can think of is windows update.
Hello I have an issue with precompiled nif on windows. It work fine on ubuntu. I followed the https://github.com/philss/rustler_precompiled/blob/main/PRECOMPILATION_GUIDE.md . The repo https://github.com/mrdotb/resvg_nif The release nif https://github.com/mrdotb/resvg_nif/releases When I try to run then with the precompiled nif it quit without error after downloading the nif.
Forcing the build work on windows.
On wsl and ubuntu running test from the precompiled nif work
I read the source of rustler_precompiled and add some extra logsthe build_metada return
So it appear the nif is properly downloaded and the checksum valid. Any ideas of what should I try next ?