[QBS] Linking inter-dependent libraries using gcc

Ilya Lyubimov villytiger at gmail.com
Mon Aug 10 10:47:28 CEST 2015

Hi Lars,

I agree that circular dependency is a sign of poor design in general. I
wouldn't do it in my own code. Unfortunately I met this problem in 3rd
party libraries which I need to use in my project. So I wanted to designate
a problem which qbs users face in the real world. I think that good build
tool must provide means to solve this issue even if those libraries have
bad design.

2015-08-08 19:42 GMT+03:00 Lars Ivar Igesund <larsivi at gmail.com>:

> Hi Ilya,
> I can't help you with the qbs issue, but I remember using a different
> build tool that added lib dependencies throughout the produced linker
> commandline to make sure to avoid any similar issues.
> However, assuming you can do something about it (if not, complain to
> those responsible), try to merge or reorganize the libraries so that
> they're not interdependent.
> Circular dependency graphs at most software levels is almost always a sign
> of a future problem. I think it is often overlooked, but if the dependency
> graph look like spaghetti, then things are bound to get messy. Personally,I
> always put this high on the list of general requirements for my software.
> Best regards,
> Lars Ivar Igesund
> On Fri, Aug 7, 2015 at 6:44 PM Ilya Lyubimov <villytiger at gmail.com> wrote:
>> Hi,
>> I'm trying to link inter-dependent libraries, but as qbs merges the list
>> of libraries it seems to be impossible now.
>> For example there are two libraries: liba.a and libb.a. liba.a uses
>> symbols from libb.a and libb.a uses symbols from liba.a. Then using gcc
>> they must be linked with the following command line: "-la -lb -la". But I
>> can't get this behavior using cpp.staticLibraries property, because qbs
>> passes each library only once. So in such situation the only way is to use
>> low level linkerFlags.
>> Things become more complicated if one of this libraries is produced by
>> qbs, while another one is an external library. I don't know how to
>> workaround in such case without using qbs internals (artifact paths).
>> And finally two inter-dependent libraries built by qbs would produce
>> graph cycle error.
>> --
>> С уважением, / Best regards
>> Любимов Илья / Ilya Lyubimov
>> _______________________________________________
>> QBS mailing list
>> QBS at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qbs

С уважением, / Best regards
Любимов Илья / Ilya Lyubimov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150810/fdd316cc/attachment.html>

More information about the Qbs mailing list