[Qbs] Passing unescaped flags to the linker

Benjamin TERRIER b.terrier at gmail.com
Thu Nov 2 11:37:27 CET 2017


2017-11-02 11:19 GMT+01:00 Timur Kristóf <timur.kristof at gmail.com>:
>> For instance I need to pass "--specs=nano.specs" to g++. If I put it
>> in cpp.linkerFlags it does
>> not work as qbs will escape it with "-Wl". I can put it in
>> cpp.driverFlags, but then it get passed
>> to every call to g++ which is useless
>
> Those flags may not be necessary for the compiler, but they won't hurt either.

This particular flag doesn't hurt g++, but it creates noise by passing
necessary text in the command lines.
Also there is no guarantee that every flag that need to be passed to
the compiler at link time
will not generate a warning or an error, and that for every compiler.

>> and generates warning when using
>> Clang Static Analyzer
>
> How do you use the Clang Static Analyzer? I tried too, and for me it
> does not complain about those flags. Maybe we use it differently or
> use a different version?

I use the latest versions (Qt Creator 4.4.1 and QBS 1.9.1) available on Windows.
I just configured a Kit with my ARM toolchain, created a minimal qbs
project that compile
and run the static analyzer.

If I managed to make the Build step works, I haven't managed to make
the static analyzer work completely.
My first issue is that clang ignores the system includes in the
sysroot (every libc or STL include fails),
so I had to add those folders with cpp.includePaths (also I haven't
found a way to add those only when
running the static analyzer: putting a condition on the compiler does
not work as gcc is still considered to be the compiler
even if it is clang that does the static analysis). My current issue
is that clang fails each time
it meets a bit of assembly code in a c/c++ file, likely because it
does not use the ARM assembler.

Br,

Benjamin



More information about the Qbs mailing list