Skip to content

cortexm.inc.mk: detect 'arm-none-eabi-gcc' from ubuntu bionic#10404

Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom
cladmi:pr/arm/warning_on_ubuntu_bionic_gcc
Jan 10, 2019
Merged

cortexm.inc.mk: detect 'arm-none-eabi-gcc' from ubuntu bionic#10404
miri64 merged 1 commit intoRIOT-OS:masterfrom
cladmi:pr/arm/warning_on_ubuntu_bionic_gcc

Conversation

@cladmi
Copy link
Copy Markdown
Contributor

@cladmi cladmi commented Nov 15, 2018

Contribution description

arm-gcc version from ubuntu bionic repository is not supported in RIOT.
Both when building with gnu and llvm.

arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620

So detect this version and print an error if found.

The check is done on the building machine and not on the host when building in
docker.

The error can be disabled when building with WERROR=0.

TODO

  • Verify it does not fail on murdock "test nodes" when doing only "flash test"
    • maybe catch if it is not installed ?
  • verify mac does not break, the 'sed' command should be safe.

Testing procedure

Not matching your working gcc version

Try compiling anything for samr21-xpro with your working setup, it should produce no error at compilation

Detecting bionic

Try building with ubuntu bionic GCC version (change your PATH) to see the error is detected, and also other "working" gcc versions:

RIOT_CI_BUILD=1 BOARD=samr21-xpro make --no-print-directory -C examples/default/ 
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:61: arm-none-eabi-gcc version not supported
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:62: arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:63: The currently recommanded version is the one installed in the riotdocker image
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:64: https://github.com/RIOT-OS/riotdocker/blob/master/Dockerfile
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:66: *** This check can be ignored by building with 'WERROR=0'.  Stop.

You can disable the error with WERROR=0 and still try compiling:

WERROR=0 RIOT_CI_BUILD=1 BOARD=samr21-xpro make --no-print-directory -C examples/default/ 
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:61: arm-none-eabi-gcc version not supported
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:62: arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:63: The currently recommanded version is the one installed in the riotdocker image
/home/harter/work/git/RIOT/makefiles/arch/cortexm.inc.mk:64: https://github.com/RIOT-OS/riotdocker/blob/master/Dockerfile
Building application "default" for "samr21-xpro" with MCU "samd21".

   text    data     bss     dec     hex filename
  47436     148    6044   53628    d17c /home/harter/work/git/RIOT/examples/default/bin/samr21-xpro/default.elf

When building in docker, no check is done on your machine:

BUILD_IN_DOCKER=1 DOCKER="sudo docker" RIOT_CI_BUILD=1 BOARD=samr21-xpro make --no-print-directory -C examples/default/ 
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/home/harter/work/git/RIOT:/data/riotbuild/riotbase' \
    -v '/home/harter/work/git/RIOT/cpu:/data/riotbuild/riotcpu' \
    -v '/home/harter/work/git/RIOT/boards:/data/riotbuild/riotboard' \
    -v '/home/harter/work/git/RIOT/makefiles:/data/riotbuild/riotmake' \
    -v '/home/harter/work/git/RIOT:/data/riotbuild/riotproject' \
    -v /etc/localtime:/etc/localtime:ro \
    -e 'RIOTBASE=/data/riotbuild/riotbase' \
    -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' \
    -e 'RIOTCPU=/data/riotbuild/riotcpu' \
    -e 'RIOTBOARD=/data/riotbuild/riotboard' \
    -e 'RIOTMAKE=/data/riotbuild/riotmake' \
    -e 'RIOTPROJECT=/data/riotbuild/riotproject' \
    -v /home/harter/.gitcache:/data/riotbuild/gitcache -e GIT_CACHE_DIR=/data/riotbuild/gitcache  \
    -e 'BOARD=samr21-xpro' -e 'RIOT_CI_BUILD=1' \
    -w '/data/riotbuild/riotproject/examples/default/' \
    'riot/riotbuild:latest' make  
Building application "default" for "samr21-xpro" with MCU "samd21".

   text    data     bss     dec     hex filename
  39796     508    6044   46348    b50c /data/riotbuild/riotproject/examples/default/bin/samr21-xpro/default.elf

Issues/PRs references

Was reported here:

@cladmi cladmi added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … labels Nov 15, 2018
@cladmi cladmi force-pushed the pr/arm/warning_on_ubuntu_bionic_gcc branch from 4f39f86 to 1facdd1 Compare November 15, 2018 16:24
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Nov 15, 2018

@HendrikVE could you also try ?

@HendrikVE
Copy link
Copy Markdown
Contributor

Works good for me, warning is displayed and bypass with WERROR=0 also works.

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 16, 2018
@cladmi cladmi added this to the Release 2019.01 milestone Nov 23, 2018
Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still works without warning on Arch and I trust @HendrikVE's testing.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Dec 6, 2018

Updated (not sure it sent a message)

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set-up a VM using https://app.vagrantup.com/ubuntu/boxes/bionic64 and installed the toolchain via apt-get:

sudo apt-get update
sudo apt-get install gcc-arm-none-eabi unzip build-essential
arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However, when following the testing procedures I don't get the expected result:

RIOT_CI_BUILD=1 BOARD=samr21-xpro make --no-print-directory -C examples/default/ 
Building application "default" for "samr21-xpro" with MCU "samd21".
make[1]: Warning: File '/home/vagrant/RIOT/examples/default/bin/samr21-xpro/riotbuild/riotbuild.h' has modification time 1 s in the future
make[2]: Warning: File '/home/vagrant/RIOT/examples/default/bin/samr21-xpro/riotbuild/riotbuild.h' has modification time 0.56 s in the future
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Warning: File '/home/vagrant/RIOT/examples/default/bin/samr21-xpro/riotbuild/riotbuild.h' has modification time 0.16 s in the future
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make: Warning: File '/home/vagrant/RIOT/examples/default/bin/samr21-xpro/stdio_uart.a' has modification time 0.027 s in the future
   text	   data	    bss	    dec	    hex	filename
  47436	    148	   6044	  53628	   d17c	/home/vagrant/RIOT/examples/default/bin/samr21-xpro/default.elf
make: warning:  Clock skew detected.  Your build may be incomplete.

$(warning $(shell $(TARGET_ARCH)-gcc --version | head -n 1))
$(warning The currently recommanded version is the one installed in the riotdocker image)
$(warning https://github.com/RIOT-OS/riotdocker/blob/master/Dockerfile)
ifeq (1,$(WERROR))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the error message below I would expect it to be checked with ifneq (0,$(WERROR))

Copy link
Copy Markdown
Contributor Author

@cladmi cladmi Jan 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to be consistent with the other handling of WERROR

RIOT/Makefile.include

Lines 141 to 144 in 6a8808c

# Fail on warnings. Can be overridden by `make WERROR=0`.
WERROR ?= 1
export WERROR
ifeq ($(WERROR),1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhhhh... Ok for now, but we should think about if it isn't more clearer the other way around (afaics only WERROR=0 is documented, nothing is said about WERROR=<random number != 0>

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Jan 10, 2019

On my machine I get the message… I will try with the vagrant image.

What do you get with

RIOT_CI_BUILD=1 BOARD=samr21-xpro WERROR=0 make --no-print-directory -C examples/default/ info-debug-variable-ARM_GCC_VERSION ?

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Jan 10, 2019

It correctly fails with the test command in a vagrant image. Did you remember to checkout the branch before testing in the VM ?
I did the mistake on first test…

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 10, 2019

It correctly fails with the test command in a vagrant image. Did you remember to checkout the branch before testing in the VM ?
I did the mistake on first test…

Pretty sure I did, but let me try again ;-)

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 10, 2019

It correctly fails with the test command in a vagrant image. Did you remember to checkout the branch before testing in the VM ?
I did the mistake on first test…

Pretty sure I did, but let me try again ;-)

Arghs, though I mounted the repo from the host machine, I hooked it into a different repo then the one I checked out the PR in (I copied the config for the VM from my #9942 test setup where I did not want to interfere with my development cycle).

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 10, 2019

Now it works as expected. Sorry for the noise -.-

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Arch Linux, Ubuntu 16.04, Ubuntu 18.04 (both with apt-get toolchain and the one used in the docker container). Works as expected. Note that for Ubuntu 16.04 I used the GCC from this source (why aren't we using that one in the docker btw?):

deb http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu xenial main
# deb-src http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu xenial main

To test the right GCC on Ubuntu 18.04 I did as done here https://github.com/RIOT-OS/riotdocker/blob/97c77bd8fe9f7e63d0ac4f2f1fd4357e779ab5fb/Dockerfile#L100-L107 and rerouted the PATH:

PATH=/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/:$PATH RIOT_CI_BUILD=1 BOARD=samr21-xpro make --no-print-directory -C examples/default/ 

ACK!

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 10, 2019

(please squash)

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Jan 10, 2019

We are not using the PPA anymore to have an explicit version number and choice and also help migrating releases.
RIOT-OS/riotdocker#53

@cladmi cladmi force-pushed the pr/arm/warning_on_ubuntu_bionic_gcc branch from 1e9c4aa to a06519e Compare January 10, 2019 12:26
arm-gcc version from ubuntu bionic repository is not supported in RIOT.
Both when building with `gnu` and `llvm`.

    arm-none-eabi-gcc --version
    arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620

So detect this version and print an error if found.

The check is done on the building machine and not on the host when building in
docker.

The error can be disabled when building with WERROR=0.
@cladmi cladmi force-pushed the pr/arm/warning_on_ubuntu_bionic_gcc branch from a06519e to 89d7e2e Compare January 10, 2019 12:27
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Jan 10, 2019

I rebased then squashed in two steps.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 10, 2019

Then let's go

@miri64 miri64 merged commit a09dc18 into RIOT-OS:master Jan 10, 2019
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Jan 10, 2019

Thank you for reviewing and testing.

@cladmi cladmi deleted the pr/arm/warning_on_ubuntu_bionic_gcc branch January 10, 2019 14:50
@aabadie aabadie modified the milestone: Release 2019.01 Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants