Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 16.04 ccache 3.2.4 Fallthrough Bug #12813

Closed
baumanta opened this issue Aug 27, 2019 · 15 comments
Closed

Ubuntu 16.04 ccache 3.2.4 Fallthrough Bug #12813

baumanta opened this issue Aug 27, 2019 · 15 comments
Labels
Board: Pixhawk bug Tools Sub-tools used within PX4 ecosystem (scripts, etc)

Comments

@baumanta
Copy link
Contributor

Describe the bug
When I try to build current master for v4, the build fails with the following error message.

../../src/lib/led/led.cpp: In member function 'void LedController::get_control_data(LedControlData&)':
../../src/lib/led/led.cpp:229:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (cur_data.blink_times_left % 10 < 6) { // 2 blinks, then turn off for the rest of the cycle
^~
compilation terminated due to -Wfatal-errors.

To Reproduce
Steps to reproduce the behavior:

  1. checkout master@2f10c315b56f0bd9cb200956b112ad1f0930b90a
  2. make px4_fmu-v4_default

Additional context
I use the gcc toolchain version:
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q3-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]

@julianoes
Copy link
Contributor

@julianoes
Copy link
Contributor

@baumanta can you do which arm-none-eabi-gcc please?

@baumanta
Copy link
Contributor Author

@julianoes that returns: /usr/lib/ccache/arm-none-eabi-gcc

@julianoes
Copy link
Contributor

Ok, and that's a symlink. Where does it go?

ls -l /usr/lib/ccache/

@hamishwillee
Copy link
Contributor

hamishwillee commented Aug 28, 2019

I get same error (irrespective of build target). Installed from ubuntu.sh.

ubuntu@ubuntu-VirtualBox:~/github/Firmware$ which arm-none-eabi-gcc
/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc

@julianoes
Copy link
Contributor

@hamishwillee so you're saying the build is broken in general, not just with @baumanta's newer compiler?

@hamishwillee
Copy link
Contributor

hamishwillee commented Aug 28, 2019

I'm saying that if you install with ubuntu.sh from that PR we've been discussing, then the problem happens irrespective of the build target - ie FMUv2, 3, 4 etc. - not just make px4_fmu-v4_default

@julianoes
Copy link
Contributor

Ok, this is really weird with the script from ubuntu.sh it fails to compile with the fallthrough error. With the scripts from the devguide it's fine.'

I tried to find differences and found that the arm-none-eabi-gcc version as well as the cmake versions are identical. The only difference is that the Firmware script also installs ccache.

I tried to remove the ccache cache using ccache -C but it did not resolve the issue! Only sudo apt-get remove ccache helped.

@julianoes
Copy link
Contributor

Presumably the comments are stripped by the preprocessor before it goes into ccache. The workaround export CCACHE_CPP2=yes seems to work for me.

@baumanta
Copy link
Contributor Author

@julianoes about the symlink, running your command, I get:
lrwxrwxrwx 1 root root 16 Nov 26 2018 arm-none-eabi-g++ -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 arm-none-eabi-gcc -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Mär 12 08:57 arm-none-eabi-gcc-7.3.1 -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 c++ -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 c89-gcc -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 c99-gcc -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 cc -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 g++ -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 g++-5 -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 gcc -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 gcc-5 -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 x86_64-linux-gnu-g++ -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 x86_64-linux-gnu-g++-5 -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 x86_64-linux-gnu-gcc -> ../../bin/ccache
lrwxrwxrwx 1 root root 16 Nov 26 2018 x86_64-linux-gnu-gcc-5 -> ../../bin/ccache

@baumanta
Copy link
Contributor Author

I just mentioned the build target, because I noticed that SITL builds are fine. I did not try any other targets, e.g. v2 or such

@MaEtUgR MaEtUgR changed the title fmu-v4_default build fails Ubuntu 16.04 ccache 3.2.4 Fallthrough Bug Oct 9, 2019
@MaEtUgR
Copy link
Member

MaEtUgR commented Oct 9, 2019

I updated the title since we long found out what the problem and workaround is:
#12820 (comment)
#12827 (comment)
To still work without manual ccache upgrade the compile warnings were temporarily disabled:
https://github.com/PX4/Firmware/pull/12825/files#diff-903c2a19ede406370227cbda7ee03051R40
https://github.com/PX4/Firmware/pull/12901/files#diff-dfaa0b66e8c5239fe60fe79fd5b29749R36
1f63d85#diff-f56b373864d883619e4d0961090a9e9aR52 (not sure if NuttX implements the fallthrough guards)
And the desired solution is mentioned multiple times
#13104 (comment)
#13084 (comment)
Switching to C++17 and using the [[fallthrough]]; statement.

Let's keep this issue to remember/track that. I'm not aware what's missing to be fully C++17 compatible. @dagar mentioned the compiler version for one board once the snapdragon toolchain is updated.

@MaEtUgR MaEtUgR added the Tools Sub-tools used within PX4 ecosystem (scripts, etc) label Oct 9, 2019
@stale
Copy link

stale bot commented Jan 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Jan 11, 2020
@hamishwillee
Copy link
Contributor

So is this still something that needs to be alive? ie is this just alive as a reminder to people there is a problem, or are we planning on doing something?

@stale stale bot removed the stale label Jan 12, 2020
@julianoes
Copy link
Contributor

For Ubuntu 16.04 users this can be resolved by installing a newer ccache version as it is done in:

https://github.com/PX4/Firmware/blob/0d36e5094b4655c960846d481f62361d40cf1d9f/Tools/setup/ubuntu.sh#L103-L107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Board: Pixhawk bug Tools Sub-tools used within PX4 ecosystem (scripts, etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants