0
$\begingroup$

Rosanswers logo

I apt installed ros2 on ubuntu 20.04 and worked just fine however I need to install opencv 4.2.0 which caused removing all ros2 installation.

So I need to build install ros2 as described in the document here https://docs.ros.org/en/foxy/Installation/Ubuntu-Development-Setup.html

I followed every step in the process and when trying to colcon build, the process stuck at qt_gui_core as below

$ colcon build --symlink-install

Starting >>> ament_pyflakes
--- stderr: qt_gui_cpp                                                                
g++: error: unrecognized command line option ‘-ffile-prefix-map=/build/sip4-IM_1PV/sip4-4.19.21+dfsg=.’
make[3]: *** [Makefile:18: siplibqt_gui_cpp_sipcmodule.o] Error 1
make[2]: *** [src/qt_gui_cpp_sip/CMakeFiles/libqt_gui_cpp_sip.dir/build.make:61: src/qt_gui_cpp_sip/libqt_gui_cpp_sip.so] Error 2
make[1]: *** [CMakeFiles/Makefile2:237: src/qt_gui_cpp_sip/CMakeFiles/libqt_gui_cpp_sip.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< qt_gui_cpp [18.1s, exited with code 2]
Aborted  <<< ament_pyflakes [14.5s]                                                              
Aborted  <<< rosidl_typesupport_fastrtps_cpp [1min 42s]                                           
Aborted  <<< rviz_rendering [4min 25s]                                              

Summary: 120 packages finished [6min 38s]
  1 package failed: qt_gui_cpp
  3 packages aborted: ament_pyflakes rosidl_typesupport_fastrtps_cpp rviz_rendering
  2 packages had stderr output: qt_gui_cpp rviz_rendering
  187 packages not processed

When tried to build just qt_gui_cpp

$ colcon build --symlink-install --packages-select qt_gui_cpp
Starting >>> qt_gui_cpp
--- stderr: qt_gui_cpp                             
g++: error: unrecognized command line option ‘-ffile-prefix-map=/build/sip4-IM_1PV/sip4-4.19.21+dfsg=.’
g++: error: unrecognized command line option ‘-ffile-prefix-map=/build/sip4-IM_1PV/sip4-4.19.21+dfsg=.’
make[3]: *** [Makefile:18: siplibqt_gui_cpp_sipcmodule.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:18: siplibqt_gui_cpp_sipQList0101qt_gui_cppPluginDescriptor.o] Error 1
g++: error: unrecognized command line option ‘-ffile-prefix-map=/build/sip4-IM_1PV/sip4-4.19.21+dfsg=.’
make[3]: *** [Makefile:18: siplibqt_gui_cpp_sipQList0101qt_gui_cppPluginProvider.o] Error 1
g++: error: unrecognized command line option ‘-ffile-prefix-map=/build/sip4-IM_1PV/sip4-4.19.21+dfsg=.’
make[3]: *** [Makefile:18: siplibqt_gui_cpp_sipQMap0100QString0100QString.o] Error 1
make[2]: *** [src/qt_gui_cpp_sip/CMakeFiles/libqt_gui_cpp_sip.dir/build.make:61: src/qt_gui_cpp_sip/libqt_gui_cpp_sip.so] Error 2
make[1]: *** [CMakeFiles/Makefile2:237: src/qt_gui_cpp_sip/CMakeFiles/libqt_gui_cpp_sip.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< qt_gui_cpp [0.97s, exited with code 2]

Summary: 0 packages finished [5.74s]
  1 package failed: qt_gui_cpp
  1 package had stderr output: qt_gui_cpp

I double checked the process with my own laptop running Ubuntu 20.04
Also followed same instruction and all build ok.
There was some warnings while building qt_gui_cpp as below

--- stderr: qt_gui_cpp                                                                   
qt.shiboken: (typesystem) Unable to locate Clang's built-in include directory (neither by checking the environment variables LLVM_INSTALL_DIR, CLANG_INSTALL_DIR  nor running llvm-config). This may lead to parse errors.
(typesystem) clang_parseTranslationUnit2(0x0, cmd[25]=-fPIC -Wno-constant-logical-operand -std=c++14 -I/home/khyou/ros2_foxy/src/ros-visualization/qt_gui_core/qt_gui_cpp/include -I/home/khyou/ros2_foxy/install/pluginlib/include -I/home/khyou/ros2_foxy/install/class_loader/include -I/home/khyou/ros2_foxy/install/rcpputils/include -I/home/khyou/ros2_foxy/install/rcutils/include -I/home/khyou/ros2_foxy/install/ament_index_cpp/include -I/opt/ros/foxy/include -I/usr/include -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/usr/include/PySide2 -I/usr/include/c++/9 -I/usr/include/x86_64-linux-gnu/c++/9 -I/usr/include/c++/9/backward -I/usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include /tmp/global_cvWrCy.hpp)
qt.shiboken: (typesystem) Enum 'RCUTILS_LOG_SEVERITY' does not have a type entry
qt.shiboken: (typesystem) While traversing QOpenGLShaderProgram: setAttributeArray(int,const float*,int,int): Cannot use parameter 2 as an array: <array> modification already applied.
qt.shiboken: (typesystem) class 'QAccessibleWidget' inherits from unknown base class 'QAccessibleActionInterface'
qt.shiboken: (typesystem) class not found for setup inheritance 'QAccessibleActionInterface'
---
Finished <<< qt_gui_cpp [52.1s]

However it all build ok

Starting >>> rviz2
Finished <<< rviz2 [7.08s]                               

Summary: 311 packages finished [12min 9s]
  7 packages had stderr output: mimick_vendor qt_gui_cpp rmw_connext_cpp rmw_connext_shared_cpp ros1_bridge rosidl_typesupport_connext_c rosidl_typesupport_connext_cpp

Any help or suggestion would be much appreciated.


Originally posted by kyubot on ROS Answers with karma: 60 on 2022-04-30

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It turned out,the issue is relate to the version of gcc, g++ currently in use.
ubuntu build for Jetson nano comes with gcc v7.5 and it seems like ros2 colcon build requires gcc version at least 9.4.

In jetson nano symlink gcc is located in /usr/local/cuda-10.0/bin aiming at /usr/bin/g++-7
To solve this issue, I first installed gcc-9, g++-9

$ sudo apt install g++-9 gcc-9

Then removed gcc, g++ in /usr/local/cuda-10.0/bin

$ sudo rm /usr/local/cuda-10.0/bin/gcc
$ sudo rm /usr/local/cuda-10.0/bin/g++

And created symlink to /usr/bin/gcc-9, /usr/bin/g++-9 as below

$ sudo ln -s /usr/bin/gcc-9 /usr/local/cuda-10.0/bin/gcc
$ sudo ln -s /usr/bin/g++-9 /usr/local/cuda-10.0/bin/g++

After this check currently using gcc, g++ by

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

Originally posted by kyubot with karma: 60 on 2022-05-09

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.