Author Topic: CB on macosx - problem launching compiled console app (dyld)  (Read 4390 times)

didito

  • Guest
CB on macosx - problem launching compiled console app (dyld)
« on: August 15, 2008, 01:35:48 pm »

hi!

i am trying to build an application using openframeworks (which is using different other libraries available for mac).
the problem is i can compile and link everything. and i can start the application from commandline (with or without gdb).
but i can't run it directly from CB.

the build log:
Quote
Checking for existence: /path-to-working-dir/myapp_debug
Executing: osascript -e 'tell app "Terminal" to do script "/path-to-working-dir/myapp_debug "'  (in /path-to-working-dir)
Process terminated with status 0 (0 minutes, 0 seconds)

and the opened terminal window says:
Quote
/path-to-working-dir/app_debug
didito:~ didito$ /path-to-working-dir/app_debug
dyld: Library not loaded: ./libfmodex.dylib
  Referenced from: /path-to-working-dir/app_debug
  Reason: image not found
Trace/BPT trap

but libfmodex.dylib is in the same folder as the executable. althought it is not the same as the directory where the project file resides ...
but i checked the "working dir" in the project file and it seems to be fine ...

any ideas how to solve this?

thx
didito

Offline Auria

  • Almost regular
  • **
  • Posts: 152
Re: CB on macosx - problem launching compiled console app (dyld)
« Reply #1 on: August 15, 2008, 07:19:13 pm »
In ./libfmodex.dylib, "." refers to the current working directory. When you run apps other than manually from terminal, you can never assume where the CWD will be. It seems like the fmod library uses a wrong "inner path". Try changing it (libfmodex) with install_name_tool so that its inner path is relative to the executable (e.g. change ./libfmodex.dylib to @executable_path/libfmodex.dylib) then it will work no matter what's the CWD