Error because an older version of protoc

Hi
I’m trying to install the dev environment on Ubuntu in wsl2.
The tuto is very good and I found a good yt video to help me.
Install wsl - ok
git clone - ok
ubuntu.sh - ok
make px4_sitl - KO
this may be due to an error when using a different compiler.
could you please help me?

jo@DESKTOP-699CJ8R:~/PX4-Autopilot$ make px4_sitl
[0/915] git submodule src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client
[11/915] git submodule src/drivers/gps/devices
[14/915] git submodule src/modules/mavlink/mavlink
[622/915] Building CXX object src/modules/simulation/gz_br...akeFiles/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/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/jo/PX4-Autopilot/boards/px4/sitl/src -I/home/jo/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/jo/PX4-Autopilot/build/px4_sitl_default -I/home/jo/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/jo/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/jo/PX4-Autopilot/platforms/common -I/home/jo/PX4-Autopilot/platforms/common/include -I/home/jo/PX4-Autopilot/src -I/home/jo/PX4-Autopilot/src/include -I/home/jo/PX4-Autopilot/src/lib -I/home/jo/PX4-Autopilot/src/lib/matrix -I/home/jo/PX4-Autopilot/src/modules -I/home/jo/PX4-Autopilot/platforms/posix/include -I/home/jo/PX4-Autopilot/build/px4_sitl_default/external/Install/include -isystem /usr/include/gz/transport12 -isystem /mnt/d/dev/vcpkg/installed/x64-windows/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 -Wformat-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/CMakeFiles/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/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZBridge.cpp
In file included 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/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.hpp:38,
                 from /home/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZBridge.hpp:36,
                 from /home/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZBridge.cpp:34:
/usr/include/gz/msgs9/gz/msgs/details/discovery.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
   17 | #error This file was generated by an older version of protoc which is
      |  ^~~~~
compilation terminated due to -Wfatal-errors.
[623/915] Building CXX object src/modules/simulation/gz_br...ules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceESC.cpp.o
/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/jo/PX4-Autopilot/boards/px4/sitl/src -I/home/jo/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/jo/PX4-Autopilot/build/px4_sitl_default -I/home/jo/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/jo/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/jo/PX4-Autopilot/platforms/common -I/home/jo/PX4-Autopilot/platforms/common/include -I/home/jo/PX4-Autopilot/src -I/home/jo/PX4-Autopilot/src/include -I/home/jo/PX4-Autopilot/src/lib -I/home/jo/PX4-Autopilot/src/lib/matrix -I/home/jo/PX4-Autopilot/src/modules -I/home/jo/PX4-Autopilot/platforms/posix/include -I/home/jo/PX4-Autopilot/build/px4_sitl_default/external/Install/include -isystem /usr/include/gz/transport12 -isystem /mnt/d/dev/vcpkg/installed/x64-windows/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 -Wformat-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_bridge/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/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.cpp
In file included 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/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.hpp:38,
                 from /home/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceESC.cpp:34:
/usr/include/gz/msgs9/gz/msgs/details/discovery.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
   17 | #error This file was generated by an older version of protoc which is
      |  ^~~~~
compilation terminated due to -Wfatal-errors.
[625/915] Building CXX object src/modules/simulation/gz_br...es__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/modules__simulation__gz_bridge.dir/GZMixingInterfaceServo.cpp.o
/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/jo/PX4-Autopilot/boards/px4/sitl/src -I/home/jo/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/jo/PX4-Autopilot/build/px4_sitl_default -I/home/jo/PX4-Autopilot/build/px4_sitl_default/src/lib -I/home/jo/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/jo/PX4-Autopilot/platforms/common -I/home/jo/PX4-Autopilot/platforms/common/include -I/home/jo/PX4-Autopilot/src -I/home/jo/PX4-Autopilot/src/include -I/home/jo/PX4-Autopilot/src/lib -I/home/jo/PX4-Autopilot/src/lib/matrix -I/home/jo/PX4-Autopilot/src/modules -I/home/jo/PX4-Autopilot/platforms/posix/include -I/home/jo/PX4-Autopilot/build/px4_sitl_default/external/Install/include -isystem /usr/include/gz/transport12 -isystem /mnt/d/dev/vcpkg/installed/x64-windows/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 -Wformat-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_bridge/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/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp
In file included 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/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.hpp:38,
                 from /home/jo/PX4-Autopilot/src/modules/simulation/gz_bridge/GZMixingInterfaceServo.cpp:34:
/usr/include/gz/msgs9/gz/msgs/details/discovery.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
   17 | #error This file was generated by an older version of protoc which is
      |  ^~~~~
compilation terminated due to -Wfatal-errors.
[631/915] Building CXX object src/modules/replay/CMakeFiles/modules__replay.dir/Replay.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:232: px4_sitl] Error 1
1 Like

Same question. Have you solved it? I have tried to remove the new version and install an older one. But it still happens.