Installing Native Toolchain¶
This page shows you how to install the toolchain to build Mynewt OS applications that run native on macOS and Linux. The applications run on Mynewt’s simulated hardware. It also allows you to run the test suites for all packages that do not require HW support.
Note: This is not supported on Windows.
Setting Up the Toolchain for Mac¶
If you have not already installed Homebrew from the
pages install it (Installing Newt on macOS).
Since macOS with Xcode ships with a C compiler called Clang there is no need to install the other compiler. However, one can install gcc compiler with brew:
$ brew install gcc ... ... ==> Pouring gcc-10.2.0_2.big_sur.bottle.tar.gz 🍺 /usr/local/Cellar/gcc/10.2.0_2: 1,455 files, 338.1MB
Check the GCC version you have installed (either using
previously installed). The brew-installed version can be checked using
brew list gcc. To use gcc instead of clang
file must be edited:
# OS X. compiler.path.cc.DARWIN.OVERWRITE: "gcc" compiler.path.as.DARWIN.OVERWRITE: "gcc" compiler.path.objdump.DARWIN.OVERWRITE: "gobjdump" compiler.path.objcopy.DARWIN.OVERWRITE: "gobjcopy" compiler.flags.base.DARWIN: [-DMN_OSX, -Wno-missing-braces] compiler.ld.resolve_circular_deps.DARWIN.OVERWRITE: false
…with the following:
compiler.path.cc.DARWIN.OVERWRITE: "gcc-<version>" compiler.path.as.DARWIN.OVERWRITE: "gcc-<version>”
$ brew install gdb ... ... ==> Summary 🍺 /usr/local/Cellar/gdb/7.10.1: XXX files,YYM
NOTE: When running a program with GDB, you may need to sign your
shows a recipe for gdb signing. Alternately you can skip this step and
continue without the ability to debug your mynewt application on your
Setting Up the Toolchain for Linux¶
The below procedure can be used to set up a Debian-based Linux system (e.g., Ubuntu). If you are running a different Linux distribution, you will need to substitute invocations of apt-get in the below steps with the package manager that your distro uses.
Installing GCC/libc that will produce 32-bit executables¶
$ sudo apt-get install gcc-multilib libc6-i386
$ sudo apt-get install gdb Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: gdb-doc gdbserver The following NEW packages will be installed: gdb ... Processing triggers for man-db (18.104.22.168-1ubuntu1) ... Setting up gdb (7.7.1-0ubuntu5~14.04.2) ...
At this point you have installed all the necessary software to build and run your first project on a simulator on your macOS or Linux computer. You may proceed to Creating Your First Mynewt Project or continue to the next section and install the cross tools for ARM.