You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
colcon build fails to build any package when using clang on Noble / Rolling
To Reproduce
Use the setup-ros action (0.7) on rolling.
Set your compiler to clang (set CC=clang and CXX=clang++)
Try to compile a workspace
System (please complete the following information)
OS: Ubuntu noble, on github runner
ROS 2 Distro: Rolling
Additional context
Full failed action log here (not sure if it's public but it's on this PR).
An extract from our action:
2024-05-24T07:48:03.2150206Z --- output: rmf_building_map_msgs
2024-05-24T07:48:03.2151052Z -- The C compiler identification is Clang 18.1.3
2024-05-24T07:48:03.2151852Z -- The CXX compiler identification is Clang 18.1.3
2024-05-24T07:48:03.2152585Z -- Detecting C compiler ABI info
2024-05-24T07:48:03.2153291Z -- Detecting C compiler ABI info - failed
2024-05-24T07:48:03.2154522Z -- Check for working C compiler: /usr/bin/clang
2024-05-24T07:48:03.2155470Z -- Check for working C compiler: /usr/bin/clang - broken
2024-05-24T07:48:03.2157216Z -- Configuring incomplete, errors occurred!
2024-05-24T07:48:03.2158922Z CMake Error at /usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
2024-05-24T07:48:03.2159908Z The C compiler
2024-05-24T07:48:03.2160183Z
2024-05-24T07:48:03.2160360Z "/usr/bin/clang"
2024-05-24T07:48:03.2160648Z
2024-05-24T07:48:03.2160918Z is not able to compile a simple test program.
2024-05-24T07:48:03.2161426Z
2024-05-24T07:48:03.2161640Z It fails with the following output:
2024-05-24T07:48:03.2162054Z
2024-05-24T07:48:03.2163395Z Change Dir: '/__w/rmf_ci_templates/rmf_ci_templates/ros_ws/build/rmf_building_map_msgs/CMakeFiles/CMakeScratch/TryCompile-CNH656'
2024-05-24T07:48:03.2164523Z
2024-05-24T07:48:03.2165112Z Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_7833c/fast
2024-05-24T07:48:03.2165980Z /usr/bin/gmake -f CMakeFiles/cmTC_7833c.dir/build.make CMakeFiles/cmTC_7833c.dir/build
2024-05-24T07:48:03.2167065Z gmake[1]: Entering directory '/__w/rmf_ci_templates/rmf_ci_templates/ros_ws/build/rmf_building_map_msgs/CMakeFiles/CMakeScratch/TryCompile-CNH656'
2024-05-24T07:48:03.2167921Z Building C object CMakeFiles/cmTC_7833c.dir/testCCompiler.c.o
2024-05-24T07:48:03.2170068Z /usr/bin/clang -fsanitize-blacklist=/home/runner/work/rmf_ci_templates/rmf_ci_templates/blacklist.txt --coverage -MD -MT CMakeFiles/cmTC_7833c.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_7833c.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_7833c.dir/testCCompiler.c.o -c /__w/rmf_ci_templates/rmf_ci_templates/ros_ws/build/rmf_building_map_msgs/CMakeFiles/CMakeScratch/TryCompile-CNH656/testCCompiler.c
2024-05-24T07:48:03.2171879Z Linking C executable cmTC_7833c
2024-05-24T07:48:03.2172445Z /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7833c.dir/link.txt --verbose=1
2024-05-24T07:48:03.2173991Z /usr/bin/clang -fsanitize-blacklist=/home/runner/work/rmf_ci_templates/rmf_ci_templates/blacklist.txt --coverage -fuse-ld=lld CMakeFiles/cmTC_7833c.dir/testCCompiler.c.o -o cmTC_7833c
2024-05-24T07:48:03.2175423Z ld.lld: error: cannot open /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.profile-x86_64.a: No such file or directory
2024-05-24T07:48:03.2176371Z clang: error: linker command failed with exit code 1 (use -v to see invocation)
2024-05-24T07:48:03.2177003Z gmake[1]: *** [CMakeFiles/cmTC_7833c.dir/build.make:100: cmTC_7833c] Error 1
2024-05-24T07:48:03.2177974Z gmake[1]: Leaving directory '/__w/rmf_ci_templates/rmf_ci_templates/ros_ws/build/rmf_building_map_msgs/CMakeFiles/CMakeScratch/TryCompile-CNH656'
2024-05-24T07:48:03.2178759Z gmake: *** [Makefile:127: cmTC_7833c/fast] Error 2
2024-05-24T07:48:03.2179101Z
2024-05-24T07:48:03.2179277Z
2024-05-24T07:48:03.2179390Z
2024-05-24T07:48:03.2179464Z
2024-05-24T07:48:03.2179574Z
2024-05-24T07:48:03.2179777Z CMake will not be able to correctly generate this project.
2024-05-24T07:48:03.2180199Z Call Stack (most recent call first):
2024-05-24T07:48:03.2180525Z CMakeLists.txt:3 (project)
2024-05-24T07:48:03.2180718Z
2024-05-24T07:48:03.2180722Z
2024-05-24T07:48:03.2180812Z ---
2024-05-24T07:48:03.2181055Z --- stderr: rmf_building_map_msgs
Clang can't get anything to compile because libclang_rt.profile-x86_64.a is missing. I did some investigation and it seems this is due to the --no-install-recommends passed to the instruction that installs clang here.
The missing file is included in the libclang-rt-18-dev package:
Which is not installed because of the flag we pass.
Furthermore, in our actions we actually do install clang, without the --no-install-recommends flag, but because it is already installed by the setup-ros action nothing is done and the recommended package is not installed.
I don't have a lot of background on this action so I can't tell the implications of my recommendations, the main solutions I can think of are:
(Easiest) remove the --no-install-recommends flag. Will install some additional cruft but should fix clang compiles.
(Easy but unclear of implications) Remove installation of clang, downstream users that want it will do it themselves and not encounter this silent failure.
(Harder?) Make sure that we either install libclang-rt-18-dev on rolling or the recommended packages altogether.
(No action here but hacky) Force downstream users to deal with this, i.e. by removing and reinstalling clang or forcing to install it with recommended packages.
I'm happy to submit a PR if there is any recommendation.
The text was updated successfully, but these errors were encountered:
Since I believe that building with clang should just work out of the box, I would simply go with option 3 and add libclang-rt-dev (which depends on libclang-rt-18-dev) to the list of packages we install on Ubuntu Noble.
I've opened #686. Can you give it a try by using ros-tooling/setup-ros@christophebedard/noble-install-libclang-rt-dev?
Description
colcon build
fails to build any package when using clang on Noble / RollingTo Reproduce
CC=clang
andCXX=clang++
)System (please complete the following information)
Additional context
Full failed action log here (not sure if it's public but it's on this PR).
An extract from our action:
Clang can't get anything to compile because
libclang_rt.profile-x86_64.a
is missing. I did some investigation and it seems this is due to the--no-install-recommends
passed to the instruction that installs clang here.The missing file is included in the
libclang-rt-18-dev
package:However, such package is only a recommended dependency of clang:
Which is not installed because of the flag we pass.
Furthermore, in our actions we actually do install clang, without the
--no-install-recommends
flag, but because it is already installed by thesetup-ros
action nothing is done and the recommended package is not installed.I don't have a lot of background on this action so I can't tell the implications of my recommendations, the main solutions I can think of are:
--no-install-recommends
flag. Will install some additional cruft but should fix clang compiles.clang
, downstream users that want it will do it themselves and not encounter this silent failure.libclang-rt-18-dev
on rolling or the recommended packages altogether.I'm happy to submit a PR if there is any recommendation.
The text was updated successfully, but these errors were encountered: