Open owillebo opened 1 month ago
If I add src/fastdds/CMakeLists.txt as follows then the build succeeds.
can confirm same problem. This can be replicated with this Dockerfile
FROM python:3.12-slim-bookworm
# Fast-DDS library related versions
ARG version_foonathan_memory_vendor=v1.3.1
ARG version_fastcdr=v2.2.5
ARG version_fastdds=v3.1.0
ENV version_foonathan_memory_vendor=${version_foonathan_memory_vendor}
ENV version_fastcdr=${version_fastcdr}
ENV version_fastdds=${version_fastdds}
ENV INSTALL_PREFIX=/usr/local
RUN apt update && \
apt install -y --no-install-recommends \
git \
build-essential \
cmake \
wget \
libssl-dev \
libasio-dev \
libtinyxml2-dev \
libpython3-dev \
libwebsocketpp-dev
# Install `colcon` and `vcs`
RUN pip install -U colcon-common-extensions vcstool
WORKDIR /fastdds_ws
RUN mkdir -p /fastdds_ws/src && \
git clone --depth 1 --branch ${version_foonathan_memory_vendor} https://github.com/eProsima/foonathan_memory_vendor.git /fastdds_ws/src/foonathan_memory_vendor && \
git clone --depth 1 --branch ${version_fastcdr} https://github.com/eProsima/Fast-CDR.git /fastdds_ws/src/fastcdr && \
git clone --depth 1 --branch ${version_fastdds} https://github.com/eProsima/Fast-DDS.git /fastdds_ws/src/fastdds
RUN mkdir -p /fastdds_ws/build/foonathan_memory_vendor && \
cd /fastdds_ws/build/foonathan_memory_vendor && \
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
/fastdds_ws/src/foonathan_memory_vendor && \
cmake --build . --target install
RUN mkdir -p /fastdds_ws/build/fastcdr && \
cd /fastdds_ws/build/fastcdr && \
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DBUILD_SHARED_LIBS=TRUE \
/fastdds_ws/src/fastcdr && \
cmake --build . --target install
RUN mkdir -p /fastdds_ws/build/fastdds && \
cd /fastdds_ws/build/fastdds && \
cmake -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DBUILD_SHARED_LIBS=TRUE \
-DSECURITY=ON \
-DCOMPILE_EXAMPLES=OFF \
-DINSTALL_EXAMPLES=OFF \
/fastdds_ws/src/fastdds && \
cmake --build . --target install
output:
696.4 inlined from ‘void eprosima::fastdds::dds::xtypes::CompleteTypeObject::union_type(const eprosima::fastdds::dds::xtypes::CompleteUnionType&)’ at /fastdds_ws/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:21332:25,
696.4 inlined from ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_union_type_object(const eprosima::fastdds::dds::xtypes::CompleteUnionType&, const std::string&, eprosima::fastdds::dds::xtypes::TypeIdentifierPair&)’ at /fastdds_ws/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1725:27:
696.4 /usr/include/c++/12/bits/basic_string.h:234:28: error: ‘((const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)((char*)&type_object + offsetof(eprosima::fastdds::dds::xtypes::CompleteTypeObject, eprosima::fastdds::dds::xtypes::CompleteTypeObject::<unnamed>)))[21].std::__cxx11::basic_string<char>::_M_dataplus.std::__cxx11::basic_string<char>::_Alloc_hider::_M_p’ may be used uninitialized [-Werror=maybe-uninitialized]
696.4 234 | { return _M_dataplus._M_p; }
696.4 | ^~~~
696.4 /fastdds_ws/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp: In static member function ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_union_type_object(const eprosima::fastdds::dds::xtypes::CompleteUnionType&, const std::string&, eprosima::fastdds::dds::xtypes::TypeIdentifierPair&)’:
696.4 /fastdds_ws/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1724:24: note: ‘type_object’ declared here
696.4 1724 | CompleteTypeObject type_object;
696.4 | ^~~~~~~~~~~
697.2 cc1plus: all warnings being treated as errors
697.3 gmake[2]: *** [src/cpp/CMakeFiles/fastdds.dir/build.make:1168: src/cpp/CMakeFiles/fastdds.dir/fastdds/xtypes/type_representation/TypeObjectUtils.cpp.o] Error 1
697.3 gmake[1]: *** [CMakeFiles/Makefile2:976: src/cpp/CMakeFiles/fastdds.dir/all] Error 2
697.3 gmake: *** [Makefile:146: all] Error 2
Hi @owillebo, @aldas, thanks for your report.
We are working towards fixing this issue.
In the meantime, apply @owillebo's solution with the CMake flag -Wno-maybe-uninitialized
.
Thanks!
Attached is a patch that disables the warning locally.
More info: Problem is caused by class optional_storage. GCC can't figure out if the memory is initialized or not and therefore warns. Doesn't seem like a real issue. issue-5277.diff.gz
Is there an already existing issue for this?
Expected behavior
Build succeeds.
Current behavior
Build fails, with the following output;
Steps to reproduce
colcon build --packages-up-to fastdds
Fast DDS version/commit
Platform/Architecture
Other. Please specify in Additional context section.
Transport layer
Default configuration, UDPv4 & SHM
Additional context
gcc (Debian 12.2.0-14) 12.2.0
cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
XML configuration file
Relevant log output
Network traffic capture
NA