Notice
Recent Posts
Recent Comments
Link
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

what i learned

Autoware 설치 중 '/usr/lib/ccache/gcc' ERROR 본문

TroubleShooting

Autoware 설치 중 '/usr/lib/ccache/gcc' ERROR

햄식이111 2024. 4. 3. 10:00
[설치환경]
Ubuntu 22.04
ROS2(Humble)
Autoware(Universe)

 

Autoware 설치는 공식문서에 친절히 나와있어서 어렵지 않다. Autoware Documentation(source installation)

근데 Autoware를 4번째 설치하는 과정에서 처음보는 에러를 마주쳐서 포스팅하게 되었다.

 

[오류문구]

CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/lib/ccache/gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/user/autoware/build/ament_cmake_gen_version_h/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_fe6be/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_fe6be.dir/build.make CMakeFiles/cmTC_fe6be.dir/build
    gmake[1]: Entering directory '/home/user/autoware/build/ament_cmake_gen_version_h/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_fe6be.dir/testCCompiler.c.o
    /usr/lib/ccache/gcc    -o CMakeFiles/cmTC_fe6be.dir/testCCompiler.c.o -c /home/user/autoware/build/ament_cmake_gen_version_h/CMakeFiles/CMakeTmp/testCCompiler.c
    ccache: error: Failed to create directory /ccache/e/6: Permission denied
    gmake[1]: *** [CMakeFiles/cmTC_fe6be.dir/build.make:78: CMakeFiles/cmTC_fe6be.dir/testCCompiler.c.o] Error 1
    gmake[1]: *** Deleting file 'CMakeFiles/cmTC_fe6be.dir/testCCompiler.c.o'
    gmake[1]: Leaving directory '/home/user/autoware/build/ament_cmake_gen_version_h/CMakeFiles/CMakeTmp'
    gmake: *** [Makefile:127: cmTC_fe6be/fast] Error 2
    
    

  

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

 

 

[해결방법]

나는 컴파일러 캐시 설정을 하니 해결되었는데 여러 해결법이 있는 것 같아 3가지정도 작성해보겠다.

1. build, install, log 혹은 workspace(autoware) 삭제 후 재설치

# $ colcon build 명령어로 생성된 build, install, log 파일 삭제 후 재설치(autoware 작업공간 안에서 실행)
$ rm -rf build/ install/ log/ 
$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

# workspace 전체 삭제 후 재설치 (autoware 작업공간이 있는 상위 디렉토리에서 실행)
$ rm -rf autoware 
$ sudo apt-get -y update
$ git clone https://github.com/autowarefoundation/autoware.git
$ cd autoware
$ ./setup-dev-env.sh
$ cd autoware
$ mkdir src
$ vcs import src < autoware.repos
$ source /opt/ros/humble/setup.bash
$ rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
# #All required rosdeps installed successfully 출력되어야 함
$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

 

2. build-essential 설치

$ sudo apt install build-essential

# 설치 후 확인
$ gcc --version

 

3. Ccache 설치 및 설정 Autoware Guide

$ sudo apt update && sudo apt install ccache
$ mkdir -p ~/.cache/ccache
$ touch ~/.cache/ccache/ccache.conf
$ echo "max_size = 60G" >> ~/.cache/ccache/ccache.conf

# 아래 명령어는 ~/.bashrc 파일의 하단에 기입
export CC="/usr/lib/ccache/gcc"
export CXX="/usr/lib/ccache/g++"
export CCACHE_DIR="$HOME/.cache/ccache/"

# 작동확인
$ ccache -s

 

 

 

Ccache 설정 이후에도 중간에 build가 중지되는 현상이 있었는데 메모리가 부족해서 생긴 현상이라 스왑파일을 만들어서 진행했다.

스왑파일을 만들어도 노트북으로 진행하다보니 노트북이 너무 힘들어해서 스왑파일을 만들어줘도 2번정도 colcon build를 진행해서 완료했다.

 

Autoware가 정상설치 됐는지 확인하기 위해 simulator 런치파일을 실행해서 확인했다.

$ source install/setup.bash

$ ros2 launch autoware_launch planning_simulator.launch.xml