PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.22k stars 13.39k forks source link

[Bug] build error: bit_cast_with_different_sizes #23139

Closed durka closed 4 months ago

durka commented 4 months ago

Describe the bug

I encountered these errors trying to build the simulation:

[981/987] Building CXX object src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gz_bridge\" -DPROTOBUF_USE_DLLS -DPX4_MAIN=gz_bridge_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/home/exyn/re
pos/github/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/exyn/repos/github
/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/includ
e -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib/matrix -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/modules -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_def
ault/external/Install/include -isystem /usr/include/gz/transport12 -isystem /home/linuxbrew/.linuxbrew/include -isystem /usr/include/gz/utils2 -isystem /usr/include/gz/msgs9 -isystem /usr/include/gz/math7 -isystem /usr/include/uuid -O2 -g -DNDEBUG -fPIC -g -fdata-sections -ffunction-sections -fomit
-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wform
at-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -
Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -frtti -fexceptions -O2 -I/usr/include/uuid -std=gnu++17 -MD -MT src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o -MF src/modules/simulation/gz_brid
ge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o.d -o src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o -c /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.cpp
In file included from /usr/include/google/protobuf/map_entry_lite.h:37,
                 from /usr/include/google/protobuf/generated_message_table_driven.h:35,
                 from /usr/include/gz/msgs9/gz/msgs/details/pointcloud_packed.pb.h:26,
                 from /usr/include/gz/msgs9/gz/msgs/pointcloud_packed.pb.h:17,
                 from /usr/include/gz/msgs9/gz/msgs/detail/PointCloudPackedUtils.hh:24,
                 from /usr/include/gz/msgs9/gz/msgs.hh:23,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.hpp:38,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.cpp:34:
/usr/include/google/protobuf/stubs/casts.h: In function ‘To google::protobuf::internal::bit_cast(const From&)’:
/usr/include/google/protobuf/stubs/casts.h:120:25: error: ‘bit_cast_with_different_sizes’ was not declared in this scope
  120 |                         bit_cast_with_different_sizes);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[982/987] Building CXX object src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceWheel.cpp.o
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceWheel.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gz_bridge\" -DPROTOBUF_USE_DLLS -DPX4_MAIN=gz_bridge_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/home/exyn/re
pos/github/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/exyn/repos/github
/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/includ
e -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib/matrix -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/modules -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_def
ault/external/Install/include -isystem /usr/include/gz/transport12 -isystem /home/linuxbrew/.linuxbrew/include -isystem /usr/include/gz/utils2 -isystem /usr/include/gz/msgs9 -isystem /usr/include/gz/math7 -isystem /usr/include/uuid -O2 -g -DNDEBUG -fPIC -g -fdata-sections -ffunction-sections -fomit
-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wform
at-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -
Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -frtti -fexceptions -O2 -I/usr/include/uuid -std=gnu++17 -MD -MT src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceWheel.cpp.o -MF src/modules/simulation/gz_br
idge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceWheel.cpp.o.d -o src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceWheel.cpp.o -c /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceWheel.cpp
In file included from /usr/include/google/protobuf/map_entry_lite.h:37,
                 from /usr/include/google/protobuf/generated_message_table_driven.h:35,
                 from /usr/include/gz/msgs9/gz/msgs/details/pointcloud_packed.pb.h:26,
                 from /usr/include/gz/msgs9/gz/msgs/pointcloud_packed.pb.h:17,
                 from /usr/include/gz/msgs9/gz/msgs/detail/PointCloudPackedUtils.hh:24,
                 from /usr/include/gz/msgs9/gz/msgs.hh:23,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceWheel.hpp:38,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceWheel.cpp:34:
/usr/include/google/protobuf/stubs/casts.h: In function ‘To google::protobuf::internal::bit_cast(const From&)’:
/usr/include/google/protobuf/stubs/casts.h:120:25: error: ‘bit_cast_with_different_sizes’ was not declared in this scope
  120 |                         bit_cast_with_different_sizes);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[983/987] Building CXX object src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZBridge.cpp.o
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZBridge.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gz_bridge\" -DPROTOBUF_USE_DLLS -DPX4_MAIN=gz_bridge_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/home/exyn/re
pos/github/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/exyn/repos/github
/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/includ
e -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib/matrix -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/modules -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_def
ault/external/Install/include -isystem /usr/include/gz/transport12 -isystem /home/linuxbrew/.linuxbrew/include -isystem /usr/include/gz/utils2 -isystem /usr/include/gz/msgs9 -isystem /usr/include/gz/math7 -isystem /usr/include/uuid -O2 -g -DNDEBUG -fPIC -g -fdata-sections -ffunction-sections -fomit
-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wform
at-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -
Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -frtti -fexceptions -O2 -I/usr/include/uuid -std=gnu++17 -MD -MT src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZBridge.cpp.o -MF src/modules/simulation/gz_bridge/CMakeFile
s/modules__simulation__gz_bridge.dir/GZBridge.cpp.o.d -o src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZBridge.cpp.o -c /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZBridge.cpp
In file included from /usr/include/google/protobuf/map_entry_lite.h:37,
                 from /usr/include/google/protobuf/generated_message_table_driven.h:35,
                 from /usr/include/gz/msgs9/gz/msgs/details/pointcloud_packed.pb.h:26,
                 from /usr/include/gz/msgs9/gz/msgs/pointcloud_packed.pb.h:17,
                 from /usr/include/gz/msgs9/gz/msgs/detail/PointCloudPackedUtils.hh:24,
                 from /usr/include/gz/msgs9/gz/msgs.hh:23,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.hpp:38,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZBridge.hpp:36,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZBridge.cpp:34:
/usr/include/google/protobuf/stubs/casts.h: In function ‘To google::protobuf::internal::bit_cast(const From&)’:
/usr/include/google/protobuf/stubs/casts.h:120:25: error: ‘bit_cast_with_different_sizes’ was not declared in this scope
  120 |                         bit_cast_with_different_sizes);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[984/987] Building CXX object src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gz_bridge\" -DPROTOBUF_USE_DLLS -DPX4_MAIN=gz_bridge_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/home/exyn/re
pos/github/PX4/PX4-Autopilot/boards/px4/sitl/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/exyn/repos/github
/PX4/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/common/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/src -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/includ
e -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/lib/matrix -I/home/exyn/repos/github/PX4/PX4-Autopilot/src/modules -I/home/exyn/repos/github/PX4/PX4-Autopilot/platforms/posix/include -I/home/exyn/repos/github/PX4/PX4-Autopilot/build/px4_sitl_def
ault/external/Install/include -isystem /usr/include/gz/transport12 -isystem /home/linuxbrew/.linuxbrew/include -isystem /usr/include/gz/utils2 -isystem /usr/include/gz/msgs9 -isystem /usr/include/gz/math7 -isystem /usr/include/uuid -O2 -g -DNDEBUG -fPIC -g -fdata-sections -ffunction-sections -fomit
-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wform
at-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -
Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -frtti -fexceptions -O2 -I/usr/include/uuid -std=gnu++17 -MD -MT src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o -MF src/modules/simulation/gz_br
idge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o.d -o src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o -c /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp
In file included from /usr/include/google/protobuf/map_entry_lite.h:37,
                 from /usr/include/google/protobuf/generated_message_table_driven.h:35,
                 from /usr/include/gz/msgs9/gz/msgs/details/discovery.pb.h:26,
                 from /usr/include/gz/msgs9/gz/msgs/discovery.pb.h:17,
                 from /usr/include/gz/transport12/gz/transport/Discovery.hh:59,
                 from /usr/include/gz/transport12/gz/transport.hh:26,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.hpp:38,
                 from /home/exyn/repos/github/PX4/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp:34:
/usr/include/google/protobuf/stubs/casts.h: In function ‘To google::protobuf::internal::bit_cast(const From&)’:
/usr/include/google/protobuf/stubs/casts.h:120:25: error: ‘bit_cast_with_different_sizes’ was not declared in this scope
  120 |                         bit_cast_with_different_sizes);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
ninja: build stopped: subcommand failed.
make: *** [Makefile:232: px4_sitl] Error 1

To Reproduce

make px4_sitl gz_x500

Expected behavior

Successful build

Screenshot / Media

No response

Flight Log

N/A

Software Version

v1.14.2

Flight controller

sitl

Vehicle type

None

How are the different components wired up (including port information)

No response

Additional context

No response

durka commented 4 months ago

Still not sure what happened here, but I removed some linuxbrew stuff from my PATH and it works now.