Specify shared library path to GDB
-
- CodeLite Enthusiast
- Posts: 21
- Joined: Mon Jan 09, 2012 11:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Specify shared library path to GDB
I have a workspace in which the active project links against several of the other projects, one of which is a DLL. The only way I have successfully managed to use the debugger is by copying the DLL to the same directory as the executable. (Note: It should be possible to automate this as a post-build command, but this is not really what I want). If I don't copy the DLL, I get a message box: Debugger exited with the following error string: "During startup program exited with code 0xc0000135".
It seems as though it should be possible to point GDB to my DLL. Something similar seems to happen with the wxWidgets DLL (because this is not in the system path) but from the debugger output I can't see exactly how. I have not had any success playing with the settings - e.g. I tried adding 'set solib-search-path <my_dll_path>' under debugger startup commands, among other things. Ideally, perhaps CodeLite could do what I want automatically for any library paths given to the linker for the active project. Anyhow, for now I would appreciate any pointers on how to let GDB know where this DLL is located.
Thanks, Matt
CodeLite: v4.0.5589 with GDB 7.4 (installed as binary package with wxWidgets)
OS: Windows XP Pro / Windows XP Pro x64
It seems as though it should be possible to point GDB to my DLL. Something similar seems to happen with the wxWidgets DLL (because this is not in the system path) but from the debugger output I can't see exactly how. I have not had any success playing with the settings - e.g. I tried adding 'set solib-search-path <my_dll_path>' under debugger startup commands, among other things. Ideally, perhaps CodeLite could do what I want automatically for any library paths given to the linker for the active project. Anyhow, for now I would appreciate any pointers on how to let GDB know where this DLL is located.
Thanks, Matt
CodeLite: v4.0.5589 with GDB 7.4 (installed as binary package with wxWidgets)
OS: Windows XP Pro / Windows XP Pro x64
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
There are several ways to fix this, you can alter the PATH environment variable in the project level ,workspace level or globally
To modify it on the project level (IMO, the recommended way):
right click on your project: Settings -> Common Settings -> Environment -> Additional environment variables
and add the following:
Or you can do it globally (i.e. it affects all workspaces / projects):
Settings -> Environment Variables -> Default
( I am assuming here that you did not create an additional environment set and you are using the 'Default' set)
Add this line at the end:
Eran
To modify it on the project level (IMO, the recommended way):
right click on your project: Settings -> Common Settings -> Environment -> Additional environment variables
and add the following:
Code: Select all
PATH=\path\to\my\dll;$(PATH)
Settings -> Environment Variables -> Default
( I am assuming here that you did not create an additional environment set and you are using the 'Default' set)
Add this line at the end:
Code: Select all
PATH=\path\to\my\dll;$(PATH)
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 21
- Joined: Mon Jan 09, 2012 11:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
Many thanks for this. Although, perhaps the syntax is not quite right, because it does not have the desired effect (i.e. the DLL is still not found).
If I place the DLL together with the executable, and just leave the environment variables box empty, it will launch. If I then add the following to the environment variables box (leaving the DLL with the executable), it will fail as before.
So something is happening with this setting that is not at all obvious to me. I tried clearing the path completely to see what happens, but that gives the message box: Failed to locate gdb
i.e:
As a side note, I updated to the latest CodeLite release, and it no longer shows a message box indicating the 0xc0000135 error code. The debugger just exits immediately now. However, looking at the output the problem is the same.
If I place the DLL together with the executable, and just leave the environment variables box empty, it will launch. If I then add the following to the environment variables box (leaving the DLL with the executable), it will fail as before.
Code: Select all
PATH=$(PATH)
i.e:
Code: Select all
PATH=""
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
It is correct.mattday wrote:Many thanks for this. Although, perhaps the syntax is not quite right, because it does not have the desired effect (i.e. the DLL is still not found).
Can we see what did you write in the environment variables that failed?
Do not clear PATH, it will probably fail perform almost everything. Whenever you modify PATH from within codelite, make sure you prepend or append your path to the current contentmattday wrote:So something is happening with this setting that is not at all obvious to me. I tried clearing the path completely to see what happens, but that gives the message box: Failed to locate gdb
But like I said before, if it failed - show us what you placed in the PATH that failed, otherwise I wont be able to assist you
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 21
- Joined: Mon Jan 09, 2012 11:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
Initially, I tried exactly as you advised. When a relative path didn't seem to work, I tried a fully specified path. So it looked like this:
I tried the following, only to try and figure out what was happening, because if I understand correctly, it should not change anything:
However, it does have some effect. The library loads from the same location as the executable without it, but it does not with it.
Many thanks for you swift assistance Eran - I appreciate it.
Code: Select all
PATH=D:\somefolder\myproject\mydll\debug;$(PATH)
Code: Select all
PATH=$(PATH)
Many thanks for you swift assistance Eran - I appreciate it.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
Where did you place this line? in the global settings (Settings -> Environment variables ) or in the project level?mattday wrote:Initially, I tried exactly as you advised. When a relative path didn't seem to work, I tried a fully specified path. So it looked like this:
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 21
- Joined: Mon Jan 09, 2012 11:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
For the active project
-
- CodeLite Enthusiast
- Posts: 21
- Joined: Mon Jan 09, 2012 11:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
Just tried adding to the global settings, and that works! However, I would rather not do that because this copy of the DLL code was checked out as a SVN external as part of this application.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Specify shared library path to GDB
In this case this sounds like a bug to memattday wrote:Just tried adding to the global settings, and that works!
I understand. To workaround this (i.e. change the PATH only for the current project) you can use the "Environment Variables Set" feature of codelite:mattday wrote: this copy of the DLL code was checked out as a SVN external as part of this application
- Create a new environment variable set from: Settings -> Environment variables -> New Set...
- Give this set a name
- Copy the content of the "Default" set to the new set
- Add the PATH changes to the newly created set
- Click OK and close the environment variables dialog
- Open the project settings dialog -> "Common Settings -> Environment -> Environment variables set to use" and select the new set name
- Click OK and close the project settings dialog.
To confirm that you did it right, at the bottom right of codelite's status bar, you should see a little message that says:
Env: <set name>, Dbg: Default
Now whenever you load this project the newly created environment variables set will be the active
Eran
Make sure you have read the HOW TO POST thread