Hi there,

I just got a new MacBook and needed to install the Mynewt toolchain. The native 
gcc version installed by brew has recently changed requiring that a yml 
configuration file in the newt source tree be changed as well as reporting some 
minor compilation errors that cause sim (native mac) builds to fail. This only 
affects new toolchain installs, there are no issues with existing installs.

Read further if you need to (re)install the mynewt toolchain on a mac.
—

The instructions on the Installing Native Mynewt Tools 
<http://mynewt.incubator.apache.org/latest/os/get_started/native_tools/> page 
succeed but install gcc version 6.1 rather the expected 5.x:

==> Using the sandbox
==> Downloading https://ftpmirror.gnu.org/gcc/gcc-6.1.0/gcc-6.1.0.tar.bz2
… [snip]…
==> Summary
🍺  /usr/local/Cellar/gcc/6.1.0_1: 1,435 files, 282.3M, built in 30 minutes 44 
seconds

This doesn’t impact cross-compilation, but native compilation (i.e. for the sim 
environment) fails, i.e.:

% newt test all
Testing package @apache-mynewt-core/libs/os
sh: /usr/local/bin/gcc-5: No such file or directory
Testing package @apache-mynewt-core/sys/log
sh: /usr/local/bin/gcc-5: No such file or directory
…

This can be fixed by modifying
<mynewt-src-directory>/repos/apache-mynewt-core/compiler/sim/compiler.yml
with this change:

42,43c42,43
< compiler.path.cc.DARWIN.OVERWRITE: "/usr/local/bin/gcc-5"
< compiler.path.as.DARWIN.OVERWRITE: "/usr/local/bin/gcc-5 -x 
assembler-with-cpp"
---
> compiler.path.cc.DARWIN.OVERWRITE: "/usr/local/bin/gcc-6"
> compiler.path.as.DARWIN.OVERWRITE: "/usr/local/bin/gcc-6 -x 
> assembler-with-cpp”

The new gcc reports some new minor compilation errors, e.g,

Compiling x509_crl.c
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 )
         ^~

Tickets will be filed shortly to fix the compile and change the documentation 
accordingly.

- peter

Reply via email to