Page 1 of 1

using SimTK with XCode (Mac)

Posted: Thu Aug 28, 2008 11:02 am
by dwwagner
I am having a hard time running the demo problems using Xcode. I am able to compile and run the examples through the command line (i.e. make all, then ./ExamplePendulum from the terminal),

but I can't seem to get the same program to run using Xcode. I am able to build a project when I include the appropriate .dylib files, however when I run, I get this:

dyld: Library not loaded: libSimTKAtlas_Mac_Intel.dylib
Referenced from: /Users/aSampleUser/ExamplePendulum3/build/Debug/ExamplePendulum3
Reason: image not found

However, I can't seem to find libSimTKAtlas_Mac_Intel.dylib anywhere. Any help would be much appreciated.

RE: using SimTK with XCode (Mac)

Posted: Thu Aug 28, 2008 11:15 am
by peastman
Hi David,

If you can run successfully from the command line but not from Xcode, that probably means it isn't setting the library path correctly. That's the DYLD_LIBRARY_PATH environment variable, which you presumably are setting on the command line since you're able to run successfully? I haven't used Xcode much, but I assume it has a way to specify environment variables when launching programs.

The actual name of the library might be different from what you're seeing. It checks for several different names, so it might be called libSimTKAtlas_Mac_Intel.dylib, libSimTKAtlas.dylib, or possibly some other variations on that.

Peter

RE: using SimTK with XCode (Mac)

Posted: Thu Aug 28, 2008 11:55 am
by dwwagner
Hi Peter,

You are right. I am setting the DYLD_LIBRARY_PATH when I run from the command line. I am trying to find a way to get xcode understand the same path. I will keep testing and let you know if I come up with anything...

RE: using SimTK with XCode (Mac)

Posted: Thu Aug 28, 2008 12:00 pm
by dwwagner
Another thought, maybe it will spark some ideas...

When I don't run the command
export DYLD_LIBRARY_PATH=/Developer/SimTK/core/lib
in the terminal before I run the ExamplePendulum program, I get the following error:
dyld: Library not loaded: libSimTKmolmodel.dylib

which is very similar to my error from XCode of:
dyld: Library not loaded: libSimTKAtlas_Mac_Intel.dylib

Do you think they are different for any particular reason?

Thanks,
David

RE: using SimTK with XCode (Mac)

Posted: Thu Aug 28, 2008 3:18 pm
by dwwagner
Ok, I have things working now. Here was the problem (not exactly sure what this means though...).

When I included the libraries from SimTK into the Xcode project, I included all the dynamic libraries (anything with an extension .dylib in the /Developer/SimTK/core/lib folder). This was causing the problem listed above. When I removed the file "libSimTKAtlas.dylib" everything worked. I looked back into the make file for the examples and saw that this dynamic library isn't even used, so I guess I am not missing much (or probably shouldn't have even included it!!)

But this does seem odd that when I include libSimTKAtlas.dylib, everything compiles, but the program actually looks for the dynamic library "libSimTKAtlas_MAC_INTEL.dylib"

Hopefully I will never have to use libSimTKAtlas (I am a fairly new user and don't know what this library is used for).

Hope this helps someone besides me.

RE: using SimTK with XCode (Mac)

Posted: Thu Aug 28, 2008 3:40 pm
by peastman
You actually are using it - you just don't realize it! One of the libraries you link to directly is libSimTKlapack.dylib. When that library is loaded, it searches for and attempts to dynamically load libSimTKAtlas.dylib. So if you call any Lapack routines, or use any SimTK features that use Lapack, you're using Atlas. It's just that the linking is done dynamically.

Peter