[SDK 3.8.3] $$system() does not provide output

I’m running SDK 3.8.3 which has Qt Creator 4.15.2 from revision ecaf63b61a.

I have a helper script to help me with version bumping (it pushes the version in yaml, spec and a few QML files) and I have been utilizing it in my .pro file like so:

VER = 0.1.2
REL = 1
CMD_OUT = $$system(bash update-spec-version.sh $$TARGET $$VER $$REL)
message($$CMD_OUT)

There was no output anymore, and it didn’t have any effect, so I tested with this:

CMD_OUT = $$system(echo Hello Sailfish)
message($$CMD_OUT)

This outputs Project MESSAGE: and that’s it… Using message(Hello Sailfish) works fine, though. Then I tested the above using Qt Creator 6.0.2 which I installed separately, and there the echo test command works as expected, as did a small test bash script I wrote.

So it looks like $$system() isn’t run at all with SDK 3.8.3. It returns no output, and the command has no effect whatsoever. I can run the file manually of course, but it’s a lot less convenient than to have it run automatically.

Thanks!

I believe what you observe is that the $$system() call is ignored when Qt Creator parses project files but it is correctly executed when qmake actually runs. So you see an empty message in the General Output pane, but you should see the expected message in the Build Output pane when qmake is running.

Execution of the $$system() call when Qt Creator parses project files is disabled by intention - it would execute it directly on host, not inside the cross-build environment.

But then I need to ask why do yo set version from qmake? Maybe you miss the fact that when you set version to 0 inside the SPEC/YAML, then the SDK will set the version automatically from the latest git tag (See Packaging | Sailfish OS Documentation)

Then you can do it the opposite way – pass %{version} to the qmake call in SPEC/YAML, e.g., by adding the following to the YAML:

QMakeOptions: VERSION="$(sed 's/+.*//' <<<"%{version}")"

(This will strip the suffix added to package version when you have untagged changes in your Git repository)

Disabled by intention resolves this enough for my use case. I’ll just have to update my work flow and try not to forget essential steps :slight_smile: