Skip to content

Debug build fails with clang-11 compiler. #15

@shariar-rajib

Description

@shariar-rajib

Hi,

We are trying to compile this library using clang-11. The runtime version builds without any issues however the debug build fails with the following error:

[ 36%] Building CXX object libuavcan/CMakeFiles/libuavcan_test.dir/test/marshal/integer_spec.cpp.o
[ 37%] Building CXX object libuavcan/CMakeFiles/libuavcan_test_optim.dir/test/dsdl_test/dsdl_const_2.cpp.o
1 warning generated.
[ 38%] Building CXX object libuavcan/CMakeFiles/libuavcan_test.dir/test/marshal/scalar_codec.cpp.o
[ 38%] Building CXX object libuavcan/CMakeFiles/libuavcan_test.dir/test/marshal/type_util.cpp.o
/home/raj/dasa_cheri/libuavcan/libuavcan/test/marshal/array.cpp:353:20: error: use of overloaded operator '==' is ambiguous (with operand types 'A' (aka 'Array<IntegerSpec<1, SignednessUnsigned, CastModeSaturate>, ArrayModeDynamic, 5>') and 'B' (aka 'Array<IntegerSpec<8, SignednessSigned, CastModeSaturate>, ArrayModeDynamic, 255>'))
    ASSERT_FALSE(a == b);
                 ~ ^  ~
/home/raj/dasa_cheri/libuavcan/build/googletest-src/googletest/include/gtest/gtest.h:1905:25: note: expanded from macro 'ASSERT_FALSE'
  GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
                        ^~~~~~~~~
/home/raj/dasa_cheri/libuavcan/build/googletest-src/googletest/include/gtest/internal/gtest-internal.h:1229:34: note: expanded from macro 'GTEST_TEST_BOOLEAN_'
      ::testing::AssertionResult(expression)) \
                                 ^~~~~~~~~~
/home/raj/dasa_cheri/libuavcan/./libuavcan/include/uavcan/marshal/array.hpp:766:5: note: candidate function [with R = uavcan::Array<uavcan::IntegerSpec<8, uavcan::SignednessSigned, uavcan::CastModeSaturate>, uavcan::ArrayModeDynamic, 255>]
    operator==(const R& rhs) const
    ^
/home/raj/dasa_cheri/libuavcan/./libuavcan/include/uavcan/marshal/array.hpp:1101:1: note: candidate function [with R = uavcan::Array<uavcan::IntegerSpec<1, uavcan::SignednessUnsigned, uavcan::CastModeSaturate>, uavcan::ArrayModeDynamic, 5>, T = uavcan::IntegerSpec<8, uavcan::SignednessSigned, uavcan::CastModeSaturate>, ArrayMode = uavcan::ArrayModeDynamic, MaxSize = 255]
operator==(const R& rhs, const Array<T, ArrayMode, MaxSize>& lhs)

The commands used to build the library:

git clone https://github.com/DroneCAN/libuavcan
cd libuavcan
git submodule update --init
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER="clang-11" -DCMAKE_CXX_COMPILER="clang++-11"
make -j8

Output of cmake:

-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-11 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-11 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done

-- Configuring done
-- Generating done
-- Build files have been written to: /home/raj/dasa_cheri/libuavcan/build/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
HEAD is now at ba96d0b1 Merge pull request #1622 from rohanjoyce/bazel_test_filter
[ 33%] Performing update step for 'googletest'
[ 44%] No patch step for 'googletest'
[ 55%] No configure step for 'googletest'
[ 66%] No build step for 'googletest'
[ 77%] No install step for 'googletest'
[ 88%] No test step for 'googletest'
[100%] Completed 'googletest'
[100%] Built target googletest
CMake Deprecation Warning at build/googletest-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

-- Found PythonInterp: /usr/bin/python (found version "2.7.17") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Debug build
-- Using Compiler ID: Clang
-- Using C++11
-- Debug build (note: requires gtest)
-- GTest found, tests will be built and run.
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/raj/dasa_cheri/libuavcan/build

Compiler info:

Ubuntu clang version 11.1.0-++20211011094159+1fdec59bffc1-1~exp1~20211011214614.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Operating system info:

Linux 5.4.0-146-generic #163~18.04.1-Ubuntu SMP Mon Mar 20 15:02:59 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions