rust-qt / ritual

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

compile error solved with QT_SELECT=5 #56

Closed vandenoever closed 4 years ago

vandenoever commented 6 years ago

Building the create qt_core on a Neon docker image (kdeneon/plasma:dev-stable) gives this compile error:

error: failed to run custom build command for `qt_core v0.2.2`
process didn't exit successfully: `/home/neon/q/target/debug/build/qt_core-714aeaf1eb8ac892/build-script-build` (exit code: 101)
--- stderr
Executing command: "qmake" "-query" "QT_VERSION"
Stdout:
Stderr:
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
Error:
   0: command failed with exit code: 1: "qmake" "-query" "QT_VERSION"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Msg("command failed with exit code: 1: \"qmake\" \"-query\" \"QT_VERSION\""), (None, None))', src/libcore/result.rs:837
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Cargo picks up qt4 instead of 5. This can be avoided by setting the environment variable QT_SELECT=5:

$ QT_SELECT=5 cargo build
   Compiling qt_core v0.2.2
   Compiling q v0.1.0 (file:///home/neon/q)
    Finished debug [unoptimized + debuginfo] target(s) in 177.57 secs

I propose that the qt executables are called with that environment variable set.

See also qtchooser.

Riateche commented 4 years ago

It's up to the user to make the proper qmake executable available in the environment before building Qt. There are many platform-dependent ways to do that (QT_SELECT only works if qmake in your PATH is qtchooser wrapper so that only works on some systems; you may also just modify PATH to point to a specific qmake). I don't think it's a good idea to intervene with this process in some automatic way. And on modern OSs Qt 5 should already be the default.