microsoft / microsoft/vscode-cpptools
[Linux] Cannot Pass Environment Variable To Debug Session
@WardenGnaw is already working on this.
Since Feb 20, 2019.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Describe the bug
- OS and Version: Linux
- VS Code Version: 1.31.0
- C/C++ Extension Version: 0.22.0
- Other extensions you installed (and if the issue persists after disabling them): None
- A clear and concise description of what the bug is.
I am attempting to debug an application that has to link to some custom DLL's.
The application needs the proper path set in the LD_LIBRARY_PATH environment variable.
When I launch the application in debug mode, I receive the following output.
&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
/home/myuser/git/myworkspace/bin/debug/Linux/3.10.0/x86_64/myprogram: error while loading shared libraries: mySharedLib.so: cannot open shared object file: No such file or directory
The problem is simple, I just need to get the debug session to have the proper environment variable setup prior to launching my application.
In my launch.json file, I have external console set to FALSE. When I echo the LD_LIBRARY_PATH variable from this terminal it has the correct path. If I launch my program from here (non debug mode) it works fine.
I have tried the following settings in launch.json...
"args": ["${env:LD_LIBRARY_PATH}"],
"environment": [ { "name": "LD_LIBRARY_PATH", "value": "/mypath/to/lib/" } ]
"setupCommands":
[{
"description": "Additional libs",
"text": "set env LD_LIBRARY_PATH =/mypath/to/lib/",
}],
"additionalSOLibSearchPath" : "/mypath/to/lib/"
But I continue to receive the same error where it cannot find my libs. This seems like something trivial and should work. Anyone else with this issue?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.