Question: how to source setup.bash before press F5 launch launch.json
oridong opened this issue · comments
how to source setup.bash before press F5 launch launch.json ? the shell where gdb running must has the foxy environment variables, otherwise
error while loading shared libraries: librclcpp.so: cannot open shared object file: No such file or directory
Are you using the provided dockerfile or did you roll your own?
I think you have 2 options here:
- Either the shell environment has the appropriate environment variables set up
- You add a pre-launch task to source setup.bash
launch.json
// Example gdb launch of a ros executable
{
"name": "(gdb) Launch (merge-install)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/install/lib/${input:package}/${input:program}",
"args": [],
"preLaunchTask": "source",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
tasks.json
{
"label": "source",
"detail": "Source the directory",
"type": "shell",
"command": "source install/setup.bash", // path to your setup.bash file
"problemMatcher": []
}