[QBS] Wrong ld arguments depending on source files

Joerg Bornemann joerg.bornemann at theqtcompany.com
Tue Apr 7 11:53:22 CEST 2015


On 04-Apr-15 10:39, Ilya Lyubimov wrote:

> I have a directory called crypto in my project. At the same time I
> want to link my product with crypto library. The problem is that
> linkerFlags function from gcc.js looks for file with library name and
> having found crypto directory (I think it would be wrong behaviour
> even if crypto was a regular file) it doesn't pass "-l" argument. So
> in this situation the only option is to pass linkerFlags manually.
> I think a possible solution for this issue would be to split
> staticLibraries and dynamicLibraries properties into properties for
> libraries by name and properties for libraries by path, or use ":"
> prefix, as ld with "-l" argument do, for passing libraries by path.

How would those pairs of properties be called?

Why is "crypto" found by ld anyways? Did you add the project directory 
to the linker's search path?

> And another question is about linking static libraries. As far as I
> can see in source code there is no any difference between
> staticLibraries and dynamicLibraries properties. When I use
> staticLibraries property, I want to be sure that it will at least
> prefer static libraries or won't link dynamic libraries at all. But
> "-l" option of ld by default prefer dynamic libraries to static ones.
> May be it's better to link static libraries like this
> ""-Wl,--push-state,-Bstatic -lcrypto -Wl,--pop-state", to be sure that
> static version of library was linked.

That looks like a good idea at the first glance. We must make sure that 
every flavor of ld supports those flags though.


BR,

Joerg



More information about the Qbs mailing list