christianrauch / msp

Implementation of the MultiWii Serial Protocol (MSP) for MultiWii and Cleanflight flight controller
http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol
GNU Lesser General Public License v3.0
83 stars 31 forks source link

Build failing on ubuntu 22.04 #63

Open mattwilliamson opened 5 months ago

mattwilliamson commented 5 months ago

I assume I must be using clang and -Werror is set, but probably should just initialize the tmp vars.


matt@deepdrive:~$ uname -a
Linux deepdrive 5.10.120-tegra #1 SMP PREEMPT Wed Aug 9 15:29:32 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

matt@deepdrive:~/src/msp$ cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/matt/src/msp/build

matt@deepdrive:~/src/msp$ cmake --build build
[1/10] Building CXX object CMakeFiles/client_read_test.dir/examples/client_read_test.cpp.o
FAILED: CMakeFiles/client_read_test.dir/examples/client_read_test.cpp.o 
/usr/bin/c++  -DASIO_HAS_CSTDINT -DASIO_HAS_STD_ADDRESSOF -DASIO_HAS_STD_ARRAY -DASIO_HAS_STD_SHARED_PTR -DASIO_HAS_STD_TYPE_TRAITS -DASIO_STANDALONE -I../inc/msp -O3 -DNDEBUG   -Wall -Wextra -Wpedantic -Werror -std=c++17 -MD -MT CMakeFiles/client_read_test.dir/examples/client_read_test.cpp.o -MF CMakeFiles/client_read_test.dir/examples/client_read_test.cpp.o.d -o CMakeFiles/client_read_test.dir/examples/client_read_test.cpp.o -c ../examples/client_read_test.cpp
In file included from ../inc/msp/Client.hpp:11,
                 from ../examples/client_read_test.cpp:1:
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::DebugMessage::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  275 |         int8_t tmp;
      |                ^~~
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::PidNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::BoxNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
[2/10] Building CXX object CMakeFiles/msp_fcu.dir/src/FlightController.cpp.o
FAILED: CMakeFiles/msp_fcu.dir/src/FlightController.cpp.o 
/usr/bin/c++  -DASIO_HAS_CSTDINT -DASIO_HAS_STD_ADDRESSOF -DASIO_HAS_STD_ARRAY -DASIO_HAS_STD_SHARED_PTR -DASIO_HAS_STD_TYPE_TRAITS -DASIO_STANDALONE -Dmsp_fcu_EXPORTS -I../inc/msp -O3 -DNDEBUG -fPIC   -Wall -Wextra -Wpedantic -Werror -std=c++17 -MD -MT CMakeFiles/msp_fcu.dir/src/FlightController.cpp.o -MF CMakeFiles/msp_fcu.dir/src/FlightController.cpp.o.d -o CMakeFiles/msp_fcu.dir/src/FlightController.cpp.o -c ../src/FlightController.cpp
In file included from ../inc/msp/Client.hpp:11,
                 from ../inc/msp/FlightController.hpp:4,
                 from ../src/FlightController.cpp:1:
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::BuildInfo::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  275 |         int8_t tmp;
      |                ^~~
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::FcVariant::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::BoardInfo::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::BoxNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
[3/10] Building CXX object CMakeFiles/client_async_test.dir/examples/client_async_test.cpp.o
FAILED: CMakeFiles/client_async_test.dir/examples/client_async_test.cpp.o 
/usr/bin/c++  -DASIO_HAS_CSTDINT -DASIO_HAS_STD_ADDRESSOF -DASIO_HAS_STD_ARRAY -DASIO_HAS_STD_SHARED_PTR -DASIO_HAS_STD_TYPE_TRAITS -DASIO_STANDALONE -I../inc/msp -O3 -DNDEBUG   -Wall -Wextra -Wpedantic -Werror -std=c++17 -MD -MT CMakeFiles/client_async_test.dir/examples/client_async_test.cpp.o -MF CMakeFiles/client_async_test.dir/examples/client_async_test.cpp.o.d -o CMakeFiles/client_async_test.dir/examples/client_async_test.cpp.o -c ../examples/client_async_test.cpp
In file included from ../inc/msp/Client.hpp:11,
                 from ../examples/client_async_test.cpp:1:
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::DebugMessage::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  275 |         int8_t tmp;
      |                ^~~
../inc/msp/ByteVector.hpp: In member function ‘void msp::client::Subscription<T>::decode(msp::ByteVector&) const [with T = msp::msg::DebugMessage]’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::BoxNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::PidNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
[4/10] Building CXX object CMakeFiles/fcu_test.dir/examples/fcu_test.cpp.o
FAILED: CMakeFiles/fcu_test.dir/examples/fcu_test.cpp.o 
/usr/bin/c++  -DASIO_HAS_CSTDINT -DASIO_HAS_STD_ADDRESSOF -DASIO_HAS_STD_ARRAY -DASIO_HAS_STD_SHARED_PTR -DASIO_HAS_STD_TYPE_TRAITS -DASIO_STANDALONE -I../inc/msp -O3 -DNDEBUG   -Wall -Wextra -Wpedantic -Werror -std=c++17 -MD -MT CMakeFiles/fcu_test.dir/examples/fcu_test.cpp.o -MF CMakeFiles/fcu_test.dir/examples/fcu_test.cpp.o.d -o CMakeFiles/fcu_test.dir/examples/fcu_test.cpp.o -c ../examples/fcu_test.cpp
In file included from ../inc/msp/Client.hpp:11,
                 from ../inc/msp/FlightController.hpp:4,
                 from ../examples/fcu_test.cpp:1:
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::DebugMessage::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  275 |         int8_t tmp;
      |                ^~~
../inc/msp/ByteVector.hpp: In member function ‘void msp::client::Subscription<T>::decode(msp::ByteVector&) const [with T = msp::msg::DebugMessage]’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::BoxNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../inc/msp/ByteVector.hpp: In member function ‘virtual bool msp::msg::PidNames::decode(const msp::ByteVector&)’:
../inc/msp/ByteVector.hpp:275:16: error: ‘tmp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.```
christianrauch commented 2 months ago

Do you have a way to reproduce this on an x86_64 system? I tried on Ubuntu 24.04 with CXX=clang++ cmake -B build -G Ninja, which uses Clang 18.1.3, without getting this error/warning. -Werror is already set on GCC or clang.