rust-qt / ritual

Use C++ libraries from Rust
Apache License 2.0
1.22k stars 49 forks source link

App silently fails if missing zlib1.dll on windows. #51

Closed kdar closed 7 years ago

kdar commented 7 years ago
Key Value
Environment Windows 7 64bit. MSYS2 64bit.
Compiler g++.exe (Rev3, Built by MSYS2 project) 6.3.0
Qt version mingw64/mingw-w64-x86_64-qt5 5.9.0-1
qt_build_tools 0.2.1
qt_core 0.2.2
qt_gui 0.2.2

This is what happens initially:

cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target\debug\qttest.exe`
error: process didn't exit successfully: `target\debug\qttest.exe` (exit code: 3221225785)

It runs successfully when I put zlib1.dll in the project root:

 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target\debug\qttest.exe`
Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:
   QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors.
   QT_SCREEN_SCALE_FACTORS to set per-screen factors.
   QT_SCALE_FACTOR to set the application global scale factor.

I'm assuming that because it's not failing for not having the Qt*.dll files in the project root is that this compiles the Qt libs statically?

I don't know if this is an issue to fix on your end. Just a pain point I noticed compiling the example widget app.

Riateche commented 7 years ago

No, standard Qt installation (with dynamic libraries) is assumed. The output binary depends on Qt DLLs (and apparently zlib too). Unfortunately Windows doesn't provide a meaningful error message when running an exe file from terminal, but it would give the proper message when running it from Explorer.

Usually during development you should just add Qt binary directories to PATH environment variable instead of copying DLL files. And when packaging the application, you need to supply all required DLLs. If you don't have errors about missing Qt DLLs, I guess they are already in PATH on your system, but zlib DLL is in another directory for some reason.

kdar commented 7 years ago

Ah, you're right about using explorer. The zlib problem is weird because that is in the same directory as the Qt DLLs in my PATH. I'm just going to close this as an oversight on my part though, thanks.