gz-sim
gz-sim copied to clipboard
Including ignition-gazebo6 package adds HOME directory to search path in Clion
Environment
- OS Version: Ubuntu 20.04
- Binary build version: ignition-fortress - [x] running on a dual GPU machine (integrated GPU + discrete GPU) - [ ] running on a multi-GPU machine (it has multiple discrete GPUs) - [x] running on real hardware - [ ] running in virtual machine - [ ] running in Docker/Singularity - [ ] running remotely (e.g. via SSH) - [ ] running in a cloud - [ ] using VirtualGL, XVFB, Xdummy, XVNC or other indirect rendering utilities - [ ] GPU is concurrently used for other tasks - [ ] desktop acceleration - [ ] video decoding (i.e. a playing Youtube video) - [ ] video encoding - [ ] CUDA/ROCm computations (Tensorflow, Torch, Caffe running) - [ ] multiple simulators running at the same time
Description
When adding ignition-gazebo6 package to a project, the HOME directory gets included in the search path, so a CMake-aware IDEs (e.g. CLion) may get stuck indexing too many files.
Steps to reproduce
- install ignition-fortress from binary
- open empty c++ library project in Clion and paste code below to CMakeLists.txt
cmake_minimum_required(VERSION 3.23)
project(test_project)
set(CMAKE_CXX_STANDARD 20)
find_package(ignition-gazebo6 REQUIRED)
add_library(GazeboPlugin SHARED main.cpp)
target_link_libraries(GazeboPlugin
ignition-gazebo6::ignition-gazebo6
)
- reload cmake in Clion
- added home directory should be visible in the External Libraries tab on the left
Output

I just tried to reproduce this locally. I don't have CLion, but I assume it's something in the CMake that's causing this anyway:
Looking at the compliation database that gets generated with -DEXPORT_COMPILE_COMMANDS=1, I get the following result:
/home/mjcarroll/mambaforge/envs/gz-ws/bin/x86_64-conda-linux-gnu-c++
-DGazeboPlugin_EXPORTS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/gazebo6
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/math6
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/plugin1
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/cmake2
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/common4
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/uuid
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/fuel_tools7
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/msgs8
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/gui6
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/utils1
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/eigen3
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/transport11
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtCore
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/./mkspecs/linux-g++
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtQml
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtNetwork
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtQuick
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtGui
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtQuickControls2
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include/qt/QtWidgets
-isystem /home/mjcarroll/workspaces/ign_fortress/install/include/ignition/sdformat12
-isystem /..
-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe
-isystem /home/mjcarroll/mambaforge/envs/gz-ws/include -fPIC
-I/home/mjcarroll/mambaforge/envs/gz-ws/include/uuid
-I/home/mjcarroll/mambaforge/envs/gz-ws/include -fPIC
-std=c++2a -o CMakeFiles/GazeboPlugin.dir/main.cpp.o -c /home/mjcarroll/test/main.cpp
I think that the suspect include here is the -isystem /.. call. Can you see if you have a compile_commands.json in your build folder (I assume that's how CLion does the resolution) and also if you have something equally suspcious? I would think it's either going to be a relative include or explicitly set to your $HOME directory.
In the meantime, I'm going to figure out where that relative include comes in.
My suspicion is that it is this line: https://github.com/gazebosim/sdformat/blame/sdf12/src/CMakeLists.txt#L126
@Jakub-Krakowiak can you take a look at https://github.com/gazebosim/sdformat/pull/1170 and see if it fixes this for you.
the issue is resolved, thank you.