Robotics StackExchange | Archived questions

Autoware compilation failed. building from source

Trying to build Autoware from source according to this. The version I want to install is 1.12.0.

My system is ubuntu 16 with ros kinetic.
g++ and gcc version is 5.4.0.
Python version is 2.7 and 3.5.

After I run

colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

error occurs:

$ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Starting >>> autoware_build_flags
Starting >>> autoware_msgs
Starting >>> vector_map_msgs
Starting >>> autoware_config_msgs
[Processing: autoware_build_flags, autoware_config_msgs, autoware_msgs, vector_map_msgs]
Finished <<< autoware_build_flags [32.7s]                                      
Starting >>> tablet_socket_msgs
Finished <<< autoware_config_msgs [42.5s]                                      
Starting >>> autoware_system_msgs
Finished <<< tablet_socket_msgs [12.4s]                                        
Starting >>> autoware_can_msgs
Finished <<< autoware_msgs [49.7s]                                       
Starting >>> amathutils_lib
Finished <<< vector_map_msgs [55.5s]                                           
Starting >>> vector_map
Finished <<< autoware_can_msgs [11.6s]                                      
Starting >>> gnss
Finished <<< autoware_system_msgs [14.3s]
Starting >>> autoware_health_checker
--- stderr: amathutils_lib                                                     
/home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp: In member function ‘bool KalmanFilter::update(const MatrixXd&, const MatrixXd&, const MatrixXd&, const MatrixXd&)’:
/home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp:113:22: error: ‘isnan’ was not declared in this scope
   if (isnan(K.array()).any() || isinf(K.array()).any())
                      ^
/home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp:113:22: note: suggested alternative:
In file included from /usr/include/c++/5/complex:44:0,
                 from /usr/local/include/eigen3/Eigen/Core:28,
                 from /home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/include/amathutils_lib/kalman_filter.hpp:19,
                 from /home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp:17:
/usr/include/c++/5/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
/home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp:113:48: error: ‘isinf’ was not declared in this scope
   if (isnan(K.array()).any() || isinf(K.array()).any())
                                                ^
/home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp:113:48: note: suggested alternative:
In file included from /usr/include/c++/5/complex:44:0,
                 from /usr/local/include/eigen3/Eigen/Core:28,
                 from /home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/include/amathutils_lib/kalman_filter.hpp:19,
                 from /home/igs/bty_code/autoware/autoware.ai/src/autoware/common/amathutils_lib/src/kalman_filter.cpp:17:
/usr/include/c++/5/cmath:621:5: note:   ‘std::isinf’
     isinf(_Tp __x)
     ^
make[2]: *** [CMakeFiles/amathutils_lib.dir/src/kalman_filter.cpp.o] Error 1
make[1]: *** [CMakeFiles/amathutils_lib.dir/all] Error 2
make: *** [all] Error 2
---
Failed   <<< amathutils_lib [ Exited with code 2 ]
Aborted  <<< vector_map
Aborted  <<< autoware_health_checker
Aborted  <<< gnss
[69.325s] ERROR:colcon.colcon_core.event_reactor:Exception in event handler extension 'log': write to closed file
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/event_reactor.py", line 78, in _notify_observers
    retval = observer(event)
  File "/usr/lib/python3/dist-packages/colcon_output/event_handler/log.py", line 110, in __call__
    h.write(line)
ValueError: write to closed file

[69.325s] ERROR:colcon.colcon_core.event_reactor:Exception in event handler extension 'status': <colcon_core.executor.Job object at 0x7f9191548898>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/event_reactor.py", line 78, in _notify_observers
    retval = observer(event)
  File "/usr/lib/python3/dist-packages/colcon_notification/event_handler/status.py", line 109, in __call__
    progress = self._running[job].get('progress', [])
KeyError: <colcon_core.executor.Job object at 0x7f9191548898>

[69.326s] ERROR:colcon.colcon_core.event_reactor:Exception in event handler extension 'log': write to closed file
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/event_reactor.py", line 78, in _notify_observers
    retval = observer(event)
  File "/usr/lib/python3/dist-packages/colcon_output/event_handler/log.py", line 110, in __call__
    h.write(line)
ValueError: write to closed file


Summary: 7 packages finished [1min 9s]
  1 package failed: amathutils_lib
  3 packages aborted: autoware_health_checker gnss vector_map
  1 package had stderr output: amathutils_lib
  128 packages not processed
[87.004s] ERROR:concurrent.futures:exception calling callback for <Future at 0x7f9191463ba8 state=finished returned NoneType>
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 297, in _invoke_callbacks
    callback(self)
  File "/usr/lib/python3.5/asyncio/futures.py", line 442, in _call_set_state
    dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 532, in call_soon_threadsafe
    handle = self._call_soon(callback, args)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
    self._check_closed()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[87.004s] ERROR:concurrent.futures:exception calling callback for <Future at 0x7f91909dab38 state=finished returned NoneType>
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 297, in _invoke_callbacks
    callback(self)
  File "/usr/lib/python3.5/asyncio/futures.py", line 442, in _call_set_state
    dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 532, in call_soon_threadsafe
    handle = self._call_soon(callback, args)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
    self._check_closed()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[105.942s] ERROR:concurrent.futures:exception calling callback for <Future at 0x7f9190c243c8 state=finished returned NoneType>
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 297, in _invoke_callbacks
    callback(self)
  File "/usr/lib/python3.5/asyncio/futures.py", line 442, in _call_set_state
    dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 532, in call_soon_threadsafe
    handle = self._call_soon(callback, args)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
    self._check_closed()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[105.942s] ERROR:concurrent.futures:exception calling callback for <Future at 0x7f9190c1c940 state=finished returned NoneType>
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/_base.py", line 297, in _invoke_callbacks
    callback(self)
  File "/usr/lib/python3.5/asyncio/futures.py", line 442, in _call_set_state
    dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 532, in call_soon_threadsafe
    handle = self._call_soon(callback, args)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
    self._check_closed()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[105.961s] ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending coro=<_fd2callback() done, defined at /usr/lib/python3/dist-packages/colcon_core/subprocess.py:216> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.5/asyncio/futures.py:431, Task._wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.5/asyncio/tasks.py:414]>
[105.961s] ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending coro=<_fd2callback() done, defined at /usr/lib/python3/dist-packages/colcon_core/subprocess.py:216> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.5/asyncio/futures.py:431, Task._wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.5/asyncio/tasks.py:414]>
[105.961s] ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending coro=<_fd2callback() done, defined at /usr/lib/python3/dist-packages/colcon_core/subprocess.py:216> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.5/asyncio/futures.py:431, Task._wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.5/asyncio/tasks.py:414]>
[105.961s] ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending coro=<_fd2callback() done, defined at /usr/lib/python3/dist-packages/colcon_core/subprocess.py:216> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.5/asyncio/futures.py:431, Task._wakeup()]> cb=[_wait.<locals>._on_completion() at /usr/lib/python3.5/asyncio/tasks.py:414]>

Is there anything wrong with compiler? How to fix this, thanks in advance...

Asked by JohnBT on 2019-10-31 03:13:57 UTC

Comments

You are using Eigen3 in /usr/local/include/eigen3, but usually in kinetic, /usr/include/eigen3 should be used. I guess this is causing the error. Though I've installed Eigen 3.3.7 and compiled Autoware, I couldn't get the exact same error.

So, could you give me the results of two commands?

  1. pkg-config --cflags eigen3
  2. pkg-config --modversion eigen3

Asked by Kenji Miyake on 2019-10-31 07:28:51 UTC

@Kenji Miyake the first result is blank. the second is 3.2.8

Asked by JohnBT on 2019-10-31 20:14:10 UTC

@johnbt In Autoware docker environment, the following is the result, so there is a difference.

autoware@KM-DAIV:~$ pkg-config --cflags eigen3
-I/usr/include/eigen3
autoware@KM-DAIV:~$ pkg-config --modversion eigen3
3.2.92

How did you install Eigen3? I'll try to install Eigen 3.2.8 in the same way and to reproduce the problem.

Asked by Kenji Miyake on 2019-10-31 20:46:33 UTC

@Kenji Miyake eigen3.2.8 seems to be downloaded from http://eigen.tuxfamily.org/index.php?title=Main_Page.

$ mkdir build
$ cd build
$ cmake ..
$ make -j8 -l8
$ sudo make install

add export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/eigen3 to .profile

Asked by JohnBT on 2019-10-31 21:01:35 UTC

Did you try this step? I guess you are missing it.

cd autoware.ai
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

The output should be like this.

autoware@KM-DAIV:~/Autoware$ rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
#All required rosdeps installed successfully

Asked by Kenji Miyake on 2019-10-31 21:51:10 UTC

I could reproduce the error, so will write an answer soon.

Asked by Kenji Miyake on 2019-10-31 22:01:30 UTC

@Kenji Miyake thanks a lot . I will try your solution later.

Asked by JohnBT on 2019-11-01 20:28:17 UTC

Answers

The problem is you are using the non-supported version of Eigen.

The solution is:

# Build eigen in order to remove it correctly
cd && wget http://bitbucket.org/eigen/eigen/get/3.2.8.tar.gz #Download Eigen
mkdir eigen && tar --strip-components=1 -xzvf 3.2.8.tar.gz  -C eigen
cd eigen && mkdir build && cd build && cmake .. && make

# Option1 to remove eigen: To check what are installed and remove them
sudo make install
sudo rm -rf /usr/local/include/eigen3 /usr/local/share/pkgconfig/eigen3.pc /usr/local/include/eigen3

# Option2 to remove eigen: To remove all files listed in install_manifest.txt
sudo xargs rm < install_manifest.txt

# Install dependency using rosdep
cd autoware.ai
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

# Clean build files and rebuild Autoware
rm -rf build/ install/ log/
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

Asked by Kenji Miyake on 2019-10-31 22:08:57 UTC

Comments

By the way, Autoware.AI will release a new version(v1.13) soon, and 16.04 will be not supported.
I recommend you to upgrade to 18.04 as soon as possible.

Asked by Kenji Miyake on 2019-10-31 22:10:45 UTC