Author Topic: "Set program's arguments - Host application" doesn't work  (Read 11103 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
"Set program's arguments - Host application" doesn't work
« on: March 14, 2010, 12:11:26 am »
Hello,
I have a problem with the host application option/setup.

Steps:

1. Create console project (named "console") and place it somewhere on disk
1.1. Build project
2. Create shared lib project (named "library") and place it at the same path as the console project ( console.cbp and library.cbp are in the same directory)
2.1. Build project
3. Set the "library" as active project
4. Click Project -> Set program's arguments -> Debug -> Browse -> Choose the debug executable generated for "console" project ( "bin/debug/console")
5. Hit "Build & Run"

The result is this:
Code
Checking for existence: /home/obfuscated/projects/tests/host_app/test2/bin/debug/liblibrary.so
Executing: bin/debug/console  (in /home/obfuscated/projects/tests/host_app/test2/.)
Process terminated with status 127 (0 minutes, 0 seconds)

Here is the zipped project : http://smrt.is-a-geek.org/codeblocks/test2.zip
I'm seeing this on gentoo linux amd64, C::B 6185 debugger branch (trunk has the same problem).

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: "Set program's arguments - Host application" doesn't work
« Reply #1 on: March 14, 2010, 10:01:55 am »
The problem seems to be that the working dir of the debugger is always set to the projects root-dir, not to the executing working dir you have selected in the properties.

A workaround for the moment:
use bin/release or bin/debug (in your case) as executing working dir, and ./console (for release) and bin/debug/console (for the debug target) as host application.

So running the host app works with the run-button for the release-target and with the debugger (but not the run-button) for the debug-target.

It should be not so hard to fix this, I will look into it.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: "Set program's arguments - Host application" doesn't work
« Reply #2 on: March 14, 2010, 11:29:04 am »
A much ore simple solution:
leave everything as it is and add the directory where the library is created to the linker search-dirs.
The linker search directories are added to the search-path for dynamic libraries, and so the library can be found by the executable.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: "Set program's arguments - Host application" doesn't work
« Reply #3 on: April 06, 2010, 09:43:06 pm »
The problem seems to be that the working dir of the debugger is always set to the projects root-dir, not to the executing working dir you have selected in the properties.
Should I implement this in the debugger branch?

A workaround for the moment:
use bin/release or bin/debug (in your case) as executing working dir, and ./console (for release) and bin/debug/console (for the debug target) as host application.
I don't fully understand, unfortunately :(

A much ore simple solution:
leave everything as it is and add the directory where the library is created to the linker search-dirs.
The linker search directories are added to the search-path for dynamic libraries, and so the library can be found by the executable.
I think, I've tested this and it haven't worked :(

p.s. is this linux/unix only issue?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]