You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Jeffrey Thalhammer <Je...@synopsys.com.INVALID> on 2022/12/01 03:55:59 UTC

Why Does Newt Invoke Compiler Backend Directly?

Hello Newt devs!

I'm experimenting with Newt using the blinky project as described here<https://mynewt.apache.org/latest/get_started/project_create.html>. Building on linux, using gcc.

I have noticed that Newt directly invokes the compiler backend `cc1` rather than the more customary `gcc` frontend.  Unfortunately, this breaks some static analysis tools.

Can you help me understand why Newt works this way? Could it be made to (optionally) use the `gcc` frontend instead?

Thanks!

Jeffrey Thalhammer


Re: Why Does Newt Invoke Compiler Backend Directly?

Posted by Szymon Janc <sz...@codecoup.pl>.
Hello Jeffrey,

newt takes compiler configurations from core repository "compilers/foo" and
invokes whatrever is provided there.

However, we have seen issues with Coverity Scan in the past and to
workaround this we added --executeShell option to newt build and test
commands.
If I recall correctly it has something to do with Go "os/exec" using
clone() instead of fork() but don't remember details anymore..
With that option compiler is invoked via shell and it seems to fix the
issue.

BTW we have coverity scan run every two weeks on upstream repositories:
https://scan.coverity.com/projects/apache-mynewt-core

Instructions on how this is set up this are on wiki:
https://cwiki.apache.org/confluence/display/MYNEWT/Static+code+analysis

I've just tested this with latest Coverity Scan and it seems to work OK:
Emitted 502 C/C++ compilation units (100%) successfully
502 C/C++ compilation units (100%) are ready for analysis


On Sat, 3 Dec 2022 at 00:30, Jeffrey Thalhammer
<Je...@synopsys.com.invalid> wrote:

> Hello Newt devs!
>
> I'm experimenting with Newt using the blinky project as described here<
> https://mynewt.apache.org/latest/get_started/project_create.html>.
> Building on linux, using gcc.
>
> I have noticed that Newt directly invokes the compiler backend `cc1`
> rather than the more customary `gcc` frontend.  Unfortunately, this breaks
> some static analysis tools.
>
> Can you help me understand why Newt works this way? Could it be made to
> (optionally) use the `gcc` frontend instead?
>
> Thanks!
>
> Jeffrey Thalhammer
>
>

-- 
pozdrawiam
Szymon K. Janc