How to debug .qbs building in QtCreator?


#1

Here I am again testing the newest everything on ArchLinux :wink:

This time it’s QtCreator 4.6.0 and QBS 1.11.0 which does not compile OF projects (but it does work with cmake).

Inside QtCreator there’s no output whatsoever, only grayed out qbs files in the project explorer. I wanted to figure this out to be able to help others. As far as I got was to do qbs run in the project folder, which results in:

/home/x/src/openFrameworks/libs/openFrameworksCompiled/
  project/qtcreator/modules/of/of.qbs:66:20 
    ReferenceError: Can't find variable: platform

The funny thing is of.qbs doesn’t mention platform in line 66:

 59     Probe{
 60         id: CORE
 61         property stringList includes
 62         property stringList cflags
 63         property stringList ldflags
 64         property stringList system_libs
 65         property stringList static_libs
 66         configure: {
 67             includes = [];
 68             cflags = [];
 69             ldflags = [];
 70             system_libs = [];
 71             static_libs = [];

I do see mentions of platform, of.platform, project.platform and product.platform in many other places. Could it be trying to access the variable before it’s defined?

What I’m most interested in is in how do you debug this. Do you somehow print values from the .qbs files? Do you delete parts and then add them back until it works? I saw you can do qbs run -v to make it verbose, but I don’t see valuable info there. I didn’t find any information about debugging qbs files at qt.io


#2

I think I made some progress.

Issue #1

Can't find variable: platform

Fix based on this qbs issue: in of.qbs add an id:

Module {
  id: of
  name: ofCore

then s/platform/of.platform/ in that file to refer to that id.

Issue #2

Can't find variable: ofCore

Same fix: in of.qbs s/ofCore/of.ofCore/

Issue #3

Can't find variable: platform

Same fix: in of.qbs s/platform/of.platform/

Issue #4

Can't find variable: pkgConfigs

Same fix: in of.qbs s/pkgConfigs/of.pkgConfigs/

Issue #5

Can't find variable: ofRoot

Same fix: in of.qbs s/ofRoot/of.ofRoot/

Issue #6

Can't find variable: project

Here I’m stuck. Apparently of.qbs (a Module) can’t see anything from the main .qbs Project file. I tried giving an id to the Project file but of.qbs could not see that id.

I also tried adding one by one

print(base)
print(outer)
print(original)

right after

property string ofRoot {

based on the Module docs but they gave

undefined
Can't find variable: outer
(crash)

QBS-744 and QBS-1037 might be related.

The question is now why can’t of.qbs access the properties of the Project .qbs file anymore? I get the impression the module is evaluated before the rest.

I did a small experiment. Inside the module I added:

property string something: "nothing"
property string meh: { print(something); }

And then I tried setting something from ofApp.qbs, openFrameworks.qbs and the project qbs file:

of.something: "nicer"

It always prints nothing, so either I don’t get how it works, or the assignment is evaluated after evaluating the module.


#3

this is working now on latest master


#4

Do you know the reason why it stopped working? I’m interested in learning to fix the issue :slight_smile:


#5

most of them was just because somehow you can’t reference parents properties from the Probes anymore you need to explicitly say parent.property