You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by 王华源 <18...@163.com> on 2016/09/15 07:09:34 UTC

slinky example building error

Hi,


  When I build slinky native example  as document,  the builder throws error


    Building target targets/sim_slinky

Compiling x509_crl.c

Error: x509_crl.c: In function 'mbedtls_x509_crl_parse':

x509_crl.c:508:5: error: this 'else' clause does not guard... [-Werror=misleading-indentation]

     else

     ^~~~

x509_crl.c:514:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'

         if( ret == 0 )

         ^~

cc1: all warnings being treated as errors

Re: slinky example building error

Posted by Christopher Collins <cc...@apache.org>.
Hi,

On Thu, Sep 15, 2016 at 03:09:34PM +0800, \u738b\u534e\u6e90 wrote:
> Hi,
> 
>   When I build slinky native example  as document,  the builder throws error
> 
>     Building target targets/sim_slinky
> 
> Compiling x509_crl.c
> 
> Error: x509_crl.c: In function 'mbedtls_x509_crl_parse':
> 
> x509_crl.c:508:5: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
[...]

You must be using gcc 6.  Most of the Mynewt developers still use gcc 5
for sim builds, so we haven't fixed the issues reported by the new
compiler.

There are a few ways to work around this until the issues get fixes:

1. Downgrade to gcc 5

This may be easy or difficult, depending on your system and package
manager.

2. Modify the mynewt sim compiler definition so that it doesn't report
the problematic warnings.

I don't have gcc 6 handy at the moment, so I don't know if there are
additional warnings that need to be disabled.  This one can be disabled
by making the following change to
repos/apache-mynewt-core/compiler/sim/compiler.yml:

     compiler.flags.base: >
    -    -m32 -Wall -Werror -ggdb
    +    -m32 -Wall -Werror -ggdb -Wno-misleading-indentation

(i.e., add "-Wno-misleading-indentation" to compiler.flags.base).

Sorry for the hassle!  Let us know how it goes.

Thanks,
Chris