[Qbs] Passing unescaped flags to the linker
Christian Gagneraud
chgans at gmail.com
Fri Nov 3 23:42:00 CET 2017
On 2 November 2017 at 23:50, Timur Kristóf <timur.kristof at gmail.com> wrote:
> Hi,
>
>> 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.
>
> What I did was to set up scan-build as a compiler wrapper in my qbs file, so
> arm-none-eabi-g++ ...
> becomes
> scan-build arm-none-eabi-g++ ...
> And it didn't complain for any of those flags. But this was months
> ago, and I couldn't exactly figure out how to make it work (due to
> qbs-unrelated issues), so maybe the latest version of the static
> analyzer works differently now.
>
>> 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.
>
> After my initial experiments, I thought there must be someone who made
> it work, so I posted a StackOverflow question.
> It is still unsolved, but maybe it is of some help to you:
> https://stackoverflow.com/questions/44204695/how-to-use-clang-static-analyzer-with-a-cortex-m-project
>
> Now we are off-topic with regards to the qbs mailing list, but I'm
> very interested in your static analyzer effort, so please let me know
> if you find a way to get it working!
To get rid of errors/warnings in external headers, you have to use
-isystem instead of -I, clang wont complain about code in system
headers.
In our project any "foreign" include path is added with -isystem, this
includes Qt too.
There's the -isysroot as well as explained on QtC mailing list.
Have you tried to export the clang compilation database with Qbs and
then use it with your clang-based tool?
Chris
More information about the Qbs
mailing list