KDAB/cxx-qt

Could not find qmltyperegistrar: ()

Closed this issue · 2 comments

When running cargo run -p qml-minimal-no-cmake I get the error:

  --- stderr
  thread 'main' panicked at /home/myuser/Repositories/cxx-qt/crates/qt-build-utils/src/lib.rs:672:22:
  Could not find qmltyperegistrar: ()
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

qmltyperegistrar is installed and can be started:

$ qmltyperegistrar --version
qmltyperegistrar 5.15.14

I checked lib.rs and it contains the line match Command::new(&executable_path).args(["-help"]).output() . I suspect that the problem might be in using -help instead of --help.

  • qmltyperegistrar -help returns 1 on exit
  • qmltyperegistrar --help returns 0 on exit

So the code might be assuming that qmltyperegistrar is not installed, when in fact it is.

I am pretty new to Rust and was just evaluating cxx-qt, so I am not sure if this is the cause.

Thanks for taking the time to report this issue.

I also see that same returning of 1 and 0 with -help vs --help we should check all the tools which CLI interface they are expecting or try both 🤔 But what is odd is that qmltyperegistrar works for me even it returning exit code 1 😅 So lets also get some more info about your environment.

As you have found, internally we try to find qmltyperegistrar here

self.get_qt_tool("qmltyperegistrar")
This then uses get_qt_tool which queries various parts of qmake to try and find the tool
fn get_qt_tool(&self, tool_name: &str) -> Result<String, ()> {

Are you able to run the following commands so we can see where qmake and bash think things are?

qmake -query
command -v qmltyperegistrar

Then can you describe your system and how you have installed Qt (eg via a package manager or Qt online installer etc) ?

Hi Andrew, thanks for the quick reply! It seems, I have wasted your time.

I prepared all the informational output and was about to submit it, but then run the command again and it worked. The window appears. I use NixOS and VScode and copied a shell.nix into the cxx-qt repo and it seems the environment was not (re)produced properly yesterday.