qtqbs

Can't include static lib in new qbs version (1.12)


Please help me.

I have a static lib builded with qt earlier, and it uses Qt libs. And the next app is compilable in qbs 1.11 versions and isn't in new qbs 1.12:

Application {
    qbsSearchPaths: "path_to_my_modules"
    Depends { name: "Qt.widgets"  }
    Depends { name: "mylibs.mylib" }
    files: "main.cpp"
}

On the linking step it outs multiple errors, kind of:

undefined reference to `_imp___ZN7QString6appendERKS_'
undefined reference to `_imp___Z18qSetMessagePatternRK7QString'

... etc.

the module mylib looks like:

import qbs

Module {
    Depends { name: "cpp" }
    cpp.includePaths: path
    cpp.staticLibraries: path + "/libmylib.a"
}

Is it a bug, or I need to do some corrections?

Trying to link on Windows 10 (64bit) with Qt Creator 4.6 and 4.7 rc for old and new qbs versions respectively.


Solution

  • The problem here is that qbs cannot know that mylib has a Qt dependency. It may have accidentally worked for you in previous versions, but that was just luck. Rewriting your module should help:

    Module {
        Depends { name: "Qt.core" } // Or whatever modules mylib uses
        Group {
            filesAreTargets: true
            fileTags: "staticlibrary"
            filePath: path + "/libmylib.a"
        }
    }