carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.35k stars 3.68k forks source link

make PythonAPI failure <error: reference to 'Server' is ambiguous> & <errof:reference to 'Client' is ambiguous> #5089

Open iscanGH opened 2 years ago

iscanGH commented 2 years ago

Platform/OS: Ubuntu 20.04 clang: 8 Problem: ninja: build stopped: subcommand failed when running $ make PythonAPI to build Carla

Output looks like:

Setup.sh: llvm-8.0 already installed.
Setup.sh: boost-1.72.0-c8 already installed.
Setup.sh: rpclib-v2.2.1_c5-c8 already installed.
Setup.sh: gtest-1.8.1-c8 already installed.
Setup.sh: recast-0b13b0-c8 already installed.
Setup.sh: Libpng already installed.
Setup.sh: Xerces-c already installed.
Setup.sh: Sqlite already installed.
Setup.sh: PROJ already installed.
Setup.sh: Patchelf already installed.
Setup.sh: CARLA version 0.9.13-1-g8854804f-dirty.
Setup.sh: Generating CMake configuration files.
Setup.sh: Success!
BuildLibCarla.sh: Building LibCarla "Client.Release" configuration.
[40/122] Building CXX object LibCarla/.../opendrive/parser/GeometryParser.cpp.o
../../LibCarla/source/carla/opendrive/parser/GeometryParser.cpp:118:21: warning: loop variable 'geo' of type 'const carla::opendrive::parser::Geometry' creates a copy from type 'const carla::opendrive::parser::Geometry' [-Wrange-loop-construct]
    for (auto const geo : geometry) {
                    ^
../../LibCarla/source/carla/opendrive/parser/GeometryParser.cpp:118:10: note: use reference type 'const carla::opendrive::parser::Geometry &' to prevent copying
    for (auto const geo : geometry) {
         ^~~~~~~~~~~~~~~~
                    &
1 warning generated.
[41/122] Building CXX object LibCarla/...ce/carla/client/detail/Simulator.cpp.o
../../LibCarla/source/carla/client/detail/Simulator.cpp:161:56: warning: implicit conversion changes signedness: 'int' to 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') [-Wsign-conversion]
        if (fill_base_string == false && map_info.name[i] != '/') {
                                         ~~~~~~~~      ^
../../LibCarla/source/carla/client/detail/Simulator.cpp:162:37: warning: implicit conversion changes signedness: 'int' to 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') [-Wsign-conversion]
          map_name += map_info.name[i];
                      ~~~~~~~~      ^
../../LibCarla/source/carla/client/detail/Simulator.cpp:164:42: warning: implicit conversion changes signedness: 'int' to 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') [-Wsign-conversion]
          map_base_path += map_info.name[i];
                           ~~~~~~~~      ^
../../LibCarla/source/carla/client/detail/Simulator.cpp:160:41: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
      for (int i = map_info.name.size() - 1; i >= 0; --i) {
               ~   ~~~~~~~~~~~~~~~~~~~~~^~~
4 warnings generated.
[49/122] Building CXX object LibCarla/...arla/opendrive/parser/RoadParser.cpp.o
../../LibCarla/source/carla/opendrive/parser/RoadParser.cpp:299:23: warning: loop variable 's' of type 'const carla::opendrive::parser::RoadTypeSpeed' creates a copy from type 'const carla::opendrive::parser::RoadTypeSpeed' [-Wrange-loop-construct]
      for (auto const s : r.speed) {
                      ^
../../LibCarla/source/carla/opendrive/parser/RoadParser.cpp:299:12: note: use reference type 'const carla::opendrive::parser::RoadTypeSpeed &' to prevent copying
      for (auto const s : r.speed) {
           ^~~~~~~~~~~~~~
                      &
../../LibCarla/source/carla/opendrive/parser/RoadParser.cpp:310:23: warning: loop variable 's' of type 'const carla::opendrive::parser::LaneSection' creates a copy from type 'const carla::opendrive::parser::LaneSection' [-Wrange-loop-construct]
      for (auto const s : r.sections) {
                      ^
../../LibCarla/source/carla/opendrive/parser/RoadParser.cpp:310:12: note: use reference type 'const carla::opendrive::parser::LaneSection &' to prevent copying
      for (auto const s : r.sections) {
           ^~~~~~~~~~~~~~
                      &
../../LibCarla/source/carla/opendrive/parser/RoadParser.cpp:290:21: warning: loop variable 'r' of type 'const carla::opendrive::parser::Road' creates a copy from type 'const carla::opendrive::parser::Road' [-Wrange-loop-construct]
    for (auto const r : roads) {
                    ^
../../LibCarla/source/carla/opendrive/parser/RoadParser.cpp:290:10: note: use reference type 'const carla::opendrive::parser::Road &' to prevent copying
    for (auto const r : roads) {
         ^~~~~~~~~~~~~~
                    &
3 warnings generated.
[64/122] Building CXX object LibCarla/.../__/source/carla/road/MapBuilder.cpp.o
../../LibCarla/source/carla/road/MapBuilder.cpp:292:46: warning: implicit conversion loses floating-point precision: 'const double' to 'float' [-Wimplicit-float-conversion]
    geom::Location location = geom::Location(x, -y, z);
                              ~~~~           ^
../../LibCarla/source/carla/road/MapBuilder.cpp:292:49: warning: implicit conversion loses floating-point precision: 'double' to 'float' [-Wimplicit-float-conversion]
    geom::Location location = geom::Location(x, -y, z);
                              ~~~~              ^~
../../LibCarla/source/carla/road/MapBuilder.cpp:292:53: warning: implicit conversion loses floating-point precision: 'const double' to 'float' [-Wimplicit-float-conversion]
    geom::Location location = geom::Location(x, -y, z);
                              ~~~~                  ^
3 warnings generated.
[69/122] Building CXX object LibCarla/...urce/carla/road/element/Geometry.cpp.o
../../LibCarla/source/carla/road/element/Geometry.cpp:196:28: warning: implicit conversion from 'size_t' (aka 'unsigned long') to 'double' may lose precision [-Wimplicit-int-float-conversion]
    double delta_p = 1.0 / number_intervals;
                         ~ ^~~~~~~~~~~~~~~~
1 warning generated.
[97/122] Building CXX object LibCarla/...trafficmanager/LocalizationStage.cpp.o
../../LibCarla/source/carla/trafficmanager/LocalizationStage.cpp:198:73: warning: implicit conversion from 'std::vector::size_type' (aka 'unsigned long') to 'double' may lose precision [-Wimplicit-int-float-conversion]
        selection_index = static_cast<uint64_t>(r_sample*next_waypoints.size()*0.01);
                                                        ~~~~~~~~~~~~~~~~^~~~~~
../../LibCarla/source/carla/trafficmanager/LocalizationStage.cpp:474:65: warning: implicit conversion from 'unsigned int' to 'const float' may lose precision [-Wimplicit-int-float-conversion]
        const float imported_road_id = imported->GetWaypoint()->GetRoadId();
                    ~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
../../LibCarla/source/carla/trafficmanager/LocalizationStage.cpp:487:66: warning: implicit conversion from 'unsigned int' to 'float' may lose precision [-Wimplicit-int-float-conversion]
          float jep_road_id = junction_end_point->GetWaypoint()->GetRoadId();
                ~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
3 warnings generated.
[107/122] Building CXX object LibCarla...__/source/test/client/test_image.cpp.o
../../LibCarla/source/test/client/test_image.cpp:83:45: warning: implicit conversion from 'unsigned int' to 'const float' may lose precision [-Wimplicit-int-float-conversion]
          const float depth = r + (g * 256) + (b  * 256 * 256);
                      ~~~~~   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
1 warning generated.
[115/122] Building CXX object LibCarla...ource/test/common/test_streaming.cpp.o
FAILED: LibCarla/cmake/test/CMakeFiles/libcarla_test_client_release.dir/__/__/source/test/common/test_streaming.cpp.o 
/bin/clang++-10  -DBOOST_ERROR_CODE_HEADER_ONLY -DLIBCARLA_ENABLE_PROFILER -DLIBCARLA_IMAGE_WITH_PNG_SUPPORT=true -DLIBCARLA_TEST_CONTENT_FOLDER=\"/home/arrb6005/carla/Build/test-content\" -DLIBCARLA_WITH_GTEST -I../../LibCarla/cmake/../source -I../../LibCarla/cmake/../source/third-party -I../../LibCarla/cmake/../source/test -isystem ../boost-1.72.0-c8-install/include -isystem ../rpclib-v2.2.1_c5-c8-libstdcxx-install/include -isystem ../gtest-1.8.1-c8-libstdcxx-install/include -isystem ../libpng-1.6.37-install/include -std=c++14 -pthread -fPIC -Wall -Wextra -Wpedantic -Wdeprecated -Wshadow -Wuninitialized -Wunreachable-code -Wpessimizing-move -Wold-style-cast -Wnull-dereference -Wduplicate-enum -Wnon-virtual-dtor -Wheader-hygiene -Wconversion -Wfloat-overflow-conversion -std=c++14 -pthread -fPIC -Wall -Wextra -Wpedantic -Wdeprecated -Wshadow -Wuninitialized -Wunreachable-code -Wpessimizing-move -Wold-style-cast -Wnull-dereference -Wduplicate-enum -Wnon-virtual-dtor -Wheader-hygiene -Wconversion -Wfloat-overflow-conversion   -O3 -DNDEBUG -MD -MT LibCarla/cmake/test/CMakeFiles/libcarla_test_client_release.dir/__/__/source/test/common/test_streaming.cpp.o -MF LibCarla/cmake/test/CMakeFiles/libcarla_test_client_release.dir/__/__/source/test/common/test_streaming.cpp.o.d -o LibCarla/cmake/test/CMakeFiles/libcarla_test_client_release.dir/__/__/source/test/common/test_streaming.cpp.o -c ../../LibCarla/source/test/common/test_streaming.cpp
../../LibCarla/source/test/common/test_streaming.cpp:58:3: error: reference to 'Server' is ambiguous
  Server<tcp::Server> srv(io.service, TESTING_PORT);
  ^
../../LibCarla/cmake/../source/carla/streaming/Server.h:20:9: note: candidate found by name lookup is 'carla::streaming::Server'
  class Server {
        ^
../../LibCarla/cmake/../source/carla/streaming/low_level/Server.h:25:9: note: candidate found by name lookup is 'carla::streaming::low_level::Server'
  class Server {
        ^
../../LibCarla/source/test/common/test_streaming.cpp:63:3: error: reference to 'Client' is ambiguous
  Client<tcp::Client> c;
  ^
../../LibCarla/cmake/../source/carla/streaming/Client.h:23:9: note: candidate found by name lookup is 'carla::streaming::Client'
  class Client {
        ^
../../LibCarla/cmake/../source/carla/streaming/low_level/Client.h:27:9: note: candidate found by name lookup is 'carla::streaming::low_level::Client'
  class Client {
        ^
../../LibCarla/source/test/common/test_streaming.cpp:93:3: error: reference to 'Server' is ambiguous
  Server<tcp::Server> srv(io.service, TESTING_PORT);
  ^
../../LibCarla/cmake/../source/carla/streaming/Server.h:20:9: note: candidate found by name lookup is 'carla::streaming::Server'
  class Server {
        ^
../../LibCarla/cmake/../source/carla/streaming/low_level/Server.h:25:9: note: candidate found by name lookup is 'carla::streaming::low_level::Server'
  class Server {
        ^
../../LibCarla/source/test/common/test_streaming.cpp:96:3: error: reference to 'Client' is ambiguous
  Client<tcp::Client> c;
  ^
../../LibCarla/cmake/../source/carla/streaming/Client.h:23:9: note: candidate found by name lookup is 'carla::streaming::Client'
  class Client {
        ^
../../LibCarla/cmake/../source/carla/streaming/low_level/Client.h:27:9: note: candidate found by name lookup is 'carla::streaming::low_level::Client'
  class Client {
        ^
4 errors generated.
[116/122] Building CXX object LibCarla...ource/test/client/test_opendrive.cpp.o
../../LibCarla/source/test/client/test_opendrive.cpp:372:42: warning: implicit conversion from 'size_t' (aka 'unsigned long') to 'float' may lose precision [-Wimplicit-int-float-conversion]
      float seconds = 1e-3f * stop_watch.GetElapsedTime();
                            ~ ~~~~~~~~~~~^~~~~~~~~~~~~~~~
../../LibCarla/source/test/client/test_opendrive.cpp:419:42: warning: implicit conversion from 'size_t' (aka 'unsigned long') to 'float' may lose precision [-Wimplicit-int-float-conversion]
      float seconds = 1e-3f * stop_watch.GetElapsedTime();
                            ~ ~~~~~~~~~~~^~~~~~~~~~~~~~~~
2 warnings generated.
[120/122] Building CXX object LibCarla...afficmanager/TrafficManagerLocal.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Util/BuildTools/Linux.mk:124: LibCarla.client.release] Error 1

I guess the problem is that I had installed clang 11, but I cannot install clang 8 as I get following error The following packages have unmet dependencies: clang-8 : Depends: libllvm8 (>= 1:8~svn298832-1~) but it is not going to be installed Depends: libclang-common-8-dev (= 1:8.0.1+svn369350-1~exp1~20200114191400.80) but it is not going to be installed Depends: libclang1-8 (= 1:8.0.1+svn369350-1~exp1~20200114191400.80) but it is not going to be installed Recommends: llvm-8-dev but it is not going to be installed lld-8 : Depends: libllvm8 (= 1:8.0.1+svn369350-1~exp1~20200114191400.80) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Any hint & advice on how can I fix it would be really appreciated

armando-fandango commented 2 years ago

Getting the same error.

dpresence commented 2 years ago

same error here

henryzhuhr commented 2 years ago

same error here ,how to solve

PatrickFSLin commented 1 year ago

same error here, no solution?

wutianze commented 1 year ago

same error, I used clang-10, also failed

wutianze commented 1 year ago

One possible solution is to use clang 8 instead. Remember to remove "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" from /etc/apt/sources.list, or you will be unable to install clang 8 in 20.04

gufenglcy commented 1 year ago

got the same error, I am using clang-10, According to guide clang-10 is support in 20.04 for carla.

hengcong commented 1 year ago

I solved this problem by adding 'carla::streaming::low_level' before every ambiguous 'Server' and 'Client'. Actually, it refers to confusion about the definitions of 'Server' and 'Client' since it introduces several definitions in this test_streaming.cpp file. So, give it a namespace to specify the definition that it needs to call.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Derkai52 commented 1 year ago

same error here, no solution?