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

GCC 8 new compiler warnings causing build to fail #11410

Closed
Hoeze opened this issue Feb 8, 2019 · 8 comments
Closed

GCC 8 new compiler warnings causing build to fail #11410

Hoeze opened this issue Feb 8, 2019 · 8 comments

Comments

@Hoeze
Copy link

Hoeze commented Feb 8, 2019

Describe the bug
When running make px4_fmu-v4_default I get the following error:

wdog/wd_start.c: In function 'wd_expiration':
wdog/wd_start.c:151:20: error: cast between incompatible function types from 'wdentry_t' {aka 'void (*)(int,  unsigned int,  ...)'} to 'void (*)(int)' [-Werror=cast-function-type]
                 (*((wdentry0_t)(wdog->func)))(0);
                    ^

To Reproduce
Running the following on my Arch linux:

git clone git@github.com:PX4/Firmware.git
cd Firmware
make submodulesclean
make px4_fmu-v4_default

I tried the same with v1.9.0-beta1 (git checkout v1.9.0-beta1), with the same result.

Expected behavior
It should compile.

Log Files and Screenshots

-- PX4 config file: /home/***/tmp/Firmware/boards/px4/fmu-v4/default.cmake
-- PX4 config: px4_fmu-v4_default
-- PX4 platform: nuttx
-- PX4 lockstep: disabled
-- PX4 version: v1.9.0-beta1-100-gc3d6a042e6
-- cmake build type: MinSizeRel
-- The CXX compiler identification is GNU 8.2.0
-- The C compiler identification is GNU 8.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
-- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++
-- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "3.7.2")
-- Found PY_jinja2: /usr/lib/python3.7/site-packages/jinja2
-- PX4 ECL: Very lightweight Estimation & Control Library v0.9.0-646-g54ab819
-- Using C++11
-- Release build type: MinSizeRel
-- Adding UAVCAN STM32 platform driver
CMake Warning (dev) at platforms/nuttx/CMakeLists.txt:76 (target_link_libraries):
Policy CMP0079 is not set: target_link_libraries allows use with targets in
other directories. Run "cmake --help-policy CMP0079" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target

nuttx_arch

is not created in this directory. For compatibility with older versions of
CMake, link library

drivers_board

will be looked up in the directory in which the target was created rather
than in this calling directory.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at platforms/nuttx/CMakeLists.txt:76 (target_link_libraries):
Policy CMP0079 is not set: target_link_libraries allows use with targets in
other directories. Run "cmake --help-policy CMP0079" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target

nuttx_arch

is not created in this directory. For compatibility with older versions of
CMake, link library

drivers_arch

will be looked up in the directory in which the target was created rather
than in this calling directory.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at platforms/nuttx/CMakeLists.txt:76 (target_link_libraries):
Policy CMP0079 is not set: target_link_libraries allows use with targets in
other directories. Run "cmake --help-policy CMP0079" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target

nuttx_arch

is not created in this directory. For compatibility with older versions of
CMake, link library

drivers_boards_common

will be looked up in the directory in which the target was created rather
than in this calling directory.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at platforms/nuttx/CMakeLists.txt:76 (target_link_libraries):
Policy CMP0079 is not set: target_link_libraries allows use with targets in
other directories. Run "cmake --help-policy CMP0079" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target

nuttx_arch

is not created in this directory. For compatibility with older versions of
CMake, link library

drivers_boards_common_arch

will be looked up in the directory in which the target was created rather
than in this calling directory.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at platforms/nuttx/CMakeLists.txt:84 (target_link_libraries):
Policy CMP0079 is not set: target_link_libraries allows use with targets in
other directories. Run "cmake --help-policy CMP0079" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target

nuttx_c

is not created in this directory. For compatibility with older versions of
CMake, link library

nuttx_drivers

will be looked up in the directory in which the target was created rather
than in this calling directory.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at platforms/nuttx/CMakeLists.txt:85 (target_link_libraries):
Policy CMP0079 is not set: target_link_libraries allows use with targets in
other directories. Run "cmake --help-policy CMP0079" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target

nuttx_xx

is not created in this directory. For compatibility with older versions of
CMake, link library

nuttx_c

will be looked up in the directory in which the target was created rather
than in this calling directory.
This warning is for project developers. Use -Wno-dev to suppress it.

-- ROMFS: px4fmu_common
-- ROMFS: Adding rc.board_defaults
-- ROMFS: Adding rc.board_sensors
-- ROMFS: Adding rc.board_extras
-- Configuring done
-- Generating done
-- Build files have been written to: /home//tmp/Firmware/build/px4_fmu-v4_default
ninja: Entering directory `/home/
/tmp/Firmware/build/px4_fmu-v4_default'
[0/1165] git submodule platforms/nuttx/NuttX/nuttx
[1/1165] git submodule platforms/nuttx/NuttX/apps
[5/1165] git submodule src/lib/ecl
[9/1165] git submodule src/drivers/gps/devices
[12/1165] git submodule src/drivers/uavcan/libuavcan
[14/1165] git submodule mavlink/include/mavlink/v2.0
[17/1165] Generating nuttx/include/nuttx/version.h, nuttx/include/nuttx/config.h
[323/1165] Generating nuttx/sched/libsched.a
FAILED: NuttX/nuttx/sched/libsched.a
cd /home//tmp/Firmware/build/px4_fmu-v4_default/NuttX/nuttx && find sched -type f -name .o -delete && make -C sched --quiet --no-print-directory all TOPDIR=/home//tmp/Firmware/build/px4_fmu-v4_default/NuttX/nuttx KERNEL=y EXTRADEFINES=-D__KERNEL__ >nuttx_build.log
wdog/wd_start.c: In function 'wd_expiration':
wdog/wd_start.c:151:20: error: cast between incompatible function types from 'wdentry_t' {aka 'void (
)(int, unsigned int, ...)'} to 'void ()(int)' [-Werror=cast-function-type]
(
((wdentry0_t)(wdog->func)))(0);
^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:77: wd_start.o] Fehler 1
make[1]: *** Es wird auf noch nicht beendete Prozesse gewartet....
[336/1165] Generating nuttx/drivers/libdrivers.a
ninja: build stopped: subcommand failed.
make: *** [Makefile:171: px4_fmu-v4_default] Fehler 1

@dagar
Copy link
Member

dagar commented Feb 8, 2019

Currently we're using GCC 7 in the CI system and as the only supported compiler version.

You'll need to either fix these small issues (or disable the warnings) or switch to the GCC version in the documentation. We'll need to fix these warnings eventually when we upgrade the toolchain, but we only do that as needed (it's a huge testing effort).

@dagar
Copy link
Member

dagar commented Feb 8, 2019

I'll try to fix the cmake warnings (they go away if you upgrade cmake).

@Hoeze
Copy link
Author

Hoeze commented Feb 8, 2019

@dagar thanks for looking into it.
I'm using cmake v3.13.4.
The only newer version of cmake available would be a release candidate.
Are you sure, you're using release candidate versions of cmake?

However, my problem aren't the cmake warnings:
My problem is that wdog/wd_start.c does not compile.

The compiler I'm using is arm-none-eabi-gcc v8.2.0.
Since this version is also newer than gcc v7, the code should compile anyways, shouldn't it?

@Hoeze
Copy link
Author

Hoeze commented Feb 9, 2019

OK, I tried compiling with gcc 7.3 and this produced a working binary.
So, there is really a problem with gcc 8.2...

@dagar dagar changed the title Compilation error for px4_fmu-v5_default: incompatible cast GCC 8 new compiler warnings causing build to fail Feb 11, 2019
@dagar dagar added this to the Release v1.10.0 milestone Feb 11, 2019
@stale
Copy link

stale bot commented Jun 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 8, 2019

Closing as stale.

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 24, 2019

JFYI The exact same error is reproducible with any ARM GCC 8 version on Windows. Latest working version in my tests is 7-2018-q2-update. Updated to that now in PX4/PX4-windows-toolchain#10

@julianoes
Copy link
Contributor

Same as #12814.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants