carla-simulator / carla

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

Carla UE5 build failed due to clang 16 compatibility issue #7991

Closed jeromepatel closed 1 month ago

jeromepatel commented 1 month ago

Hello, I am trying to build the Carla version with Unreal Engine 5 from the official docs given here I am getting clang cannot find /lib64/ld-linux-x86-64.so.2 error, I have tried on two different linux machines and encountering the same error.

My machine has 64 GB RAM and 24 GB VRAM so I don't think it's an issue. I tried reinstalling system clang from the git (to version 20.0) and it still gives error. I figured the error lies from the fact that clang 16.0.6 from UE5 might be having error with the Ubuntu version 24.04 during compilation (or boost) of carla since the error comes when running ./Setup.sh AND I can see


**********  SUCCESS ****************
Setup successful.

from UE5 setup script. It's the configuration line in carla setup script which gives this error:

retry --until=success --times=10 -- cmake -G Ninja -S . -B Build \
    --toolchain=$PWD/CMake/LinuxToolchain.cmake \
    -DLAUNCH_ARGS="-prefernvidia" \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_ROS2=ON \
    -DBUILD_CARLA_UNREAL=ON \
    -DCARLA_UNREAL_ENGINE_PATH=$CARLA_UNREAL_ENGINE_PATH

The error is as follows:

CMake Error at /opt/cmake-3.28.3-linux-x86_64/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/home/jeromepatel/Documents/CVL/CarlaUE5/Build/CMakeFiles/CMakeScratch/TryCompile-tedqrJ'

    Run Build Command(s): /usr/bin/ninja -v cmTC_afeca
    [1/2] /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang   -fms-extensions -fno-math-errno -fdiagnostics-absolute-paths -MD -MT CMakeFiles/cmTC_afeca.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_afeca.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_afeca.dir/testCCompiler.c.o -c /home/jeromepatel/Documents/CVL/CarlaUE5/Build/CMakeFiles/CMakeScratch/TryCompile-tedqrJ/testCCompiler.c
    [2/2] : && /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang  -stdlib=libc++ -L/home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Source/ThirdParty/Unix/LibCxx/lib/Unix/x86_64-unknown-linux-gnu CMakeFiles/cmTC_afeca.dir/testCCompiler.c.o -o cmTC_afeca   && :
    FAILED: cmTC_afeca 
    : && /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang  -stdlib=libc++ -L/home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Source/ThirdParty/Unix/LibCxx/lib/Unix/x86_64-unknown-linux-gnu CMakeFiles/cmTC_afeca.dir/testCCompiler.c.o -o cmTC_afeca   && :
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: warning: /lib/x86_64-linux-gnu/Scrt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: warning: /lib/x86_64-linux-gnu/libc.so.6: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: skipping incompatible /lib/x86_64-linux-gnu/libc.so.6 when searching for /lib/x86_64-linux-gnu/libc.so.6
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: cannot find /lib/x86_64-linux-gnu/libc.so.6
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: skipping incompatible /lib64/ld-linux-x86-64.so.2 when searching for /lib64/ld-linux-x86-64.so.2
    /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld: cannot find /lib64/ld-linux-x86-64.so.2
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:34 (project)

-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang
-- Check for working C compiler: /home/jeromepatel/Documents/CVL/UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang - broken
-- Configuring incomplete, errors occurred!
retry: cmake returned 1, backing off for 10 seconds and trying again...

To check whether the issue is clang from UE5, I tried running the following simple command

UnrealEngine5_carla/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/bin/clang test.c -o test_program

and it gives the exact same error so now I know where it's coming from (clang is broken inside UE5). I tried to look it up where it's setting up this exact version of LLVM but couldn't find anywhere where it's setting this up from. Is there a way to resolve this issue ? Any help would be appreciated. I am guessing if I can work with my system clang (since it works) then I would be able to build the CarlaUE5 properly.

Thanks!

jeromepatel commented 1 month ago

Closing this issue since after spending many hours I still couldn't figure out how to make Carla UE5.3 work in Ubuntu 24.04 (probably in future if someone visits this issue again). The solution is to basically change OS to either Ubuntu 22.04 or Windows 10/11. I did later and with few minor errors I was able to make UE5.3 work in windows 11.

In case someone encounters this issue, it is regarding UE5.3 internal Clang Toolchain compiler only supporting Linux version upto 22.04 (more info here), This is exact compiler which is being used inside Setup.sh script during compiling. (One crude solution is to remove that and use system's default Clang toolchain but also requires configuring UE5 compiler too), in case the clang support has been extended in future then you can use Ubuntu 24.04 with Carla UE5 without any hassle. Commenting this so that no-one else have to waste many hours on a dead-end.

J160KU commented 1 month ago

Hello Jerome,

I would use Ubuntu 22.04, since this is the version which is recommended on the offical CARLA docs. I could not discover any website mentioning Ubuntu 24.04 yet.

jeromepatel commented 1 month ago

Hi, Yes, I resorted to using Windows 11 since it was more convenient for me to use. You are right that Ubuntu 24.04 is not mentioned anywhere, I was hoping to make it work but didn't succeed.