[ODE] how to compile an independent ode app on macosx
tanglihua821229 at sjtu.edu.cn
Wed Jun 20 09:55:19 MST 2007
After some tests, I find out some reasons why my ode app cannot run, from the eye of a macosx newbie.
to explain it clearly, see any one mac app first, such as ¡°cog¡±. On macosx, an app is an executive package, just like .jar file.
If I directly double-click the ¡°cog¡± app, see the pic1: http://files.myopera.com/tolly8210/albums/292170/cog1.png
the result is the cog main window, without a terminal message window.
If I open and show the app package ->Contents->MacOS->cog, there is an unix executive file. double-click it, see the pic2:
the result is the cog main window, with a terminal message window.
then, as to my own program with ode. Because I use the drawstuff lib, so, the program will open an OPENGL window and an drawstuff terminal message window. If I close the terminal message window, the whole program will close(these are the conclusion on Windows OS). Now, it is clear that the reason why my ode app cannot run is that directly double-click app will not open an terminal message window, that means terminating the whole program.
then, it is easy for us to think about directly running the unix executive file(in our app package). I copy it out to the destination directory, for example ¡±Release¡± , and copy drawstuff textures files here, such as ¡°sky.ppm¡± ¡°ground.ppm¡± ¡°wood.ppm¡± .etc (In the program, these files are set relative path). see the pic3:
directly double-click the unix executive file ¡°Mytank¡±, the program also crashed. This results from the program cannot find the file ¡°T72_params.db¡± and texture files under ¡°Release ¡± directory. see the pic4:
This tells me, the relative path is set to the same with that in the terminal window, that is, ¡°/Users/tlh¡±, not the curret directory ¡°Release¡± as I supposed. If I open a new terminal window, cd to the ¡°Release¡± directory, and run the unix executive file ¡°Mytank¡±, then the program runs.
So in conclusion:
The ode app crashs for combined reasons: the app don't know the relative path for texture or other files. And even they are set as absolute path, app still cannot run because ode program need the drawstuff terminal message window, while directly app cannot open it.
Way to run ode program:
At present, the only way to run ode program seems to open an terminal window and cd to the unix executive file directory and run it.
In the future:
the better way to setup an independent ode app on MacOSX is to give up the drawstuff lib and develop a new visual system, which just create an OPENGL window and render all the objects each time step and the app should know the texture file relative path ¡°./¡±
Thanks for the warm-hearted oders in the mail-list, anyway. If you have done some work to setup ode app on MacOSX, please tell me something about your visual system for rendering.
Shamyl Zakariya <shamyl at zakariya.net>
> You can build it in the old fashioned way with the ./configure -- enable-release --enable-foo && make && make install. Works on my Macbook Pro.
> This will put ODE headers in /usr/local/include and libs in /usr/ local/lib -- furthermore, all the demos will work from the command line.
> Then, you can build an app in Xcode which uses ode by dragging /usr/ local/lib/libode.a into the project ( or adding it from Xcode ) and adding /usr/local/include to the header search paths for the project (or target if that's what you want).
> This will get you ODE. That being said, I don't use drawstuff, so I don't know if there's a libdrawstuff.a floating around.
> Now, that being said, I don't know how I'd build a universal version of ODE -- I've tried cross-compiling but not had any real luck. You might be best off building ODE on two machines, one a PPC and one Intel and then using lipo to merge the binaries. Finally, Xcode has a "feature" where if a .dylib is available alongside a static ".a" library, it will simply *refuse* to use the static lib. So if you don't need the dylibs, delete them. This will guarantee that the static libs will be directly linked into your app executable. If that's not what you want, there's other finagling you can do. Check out install_name_tool to massage dylibs to be embeddable into .app packages.
> shamyl at zakariya.net
> "shaking fist at indifferent cosmos"
> On Jun 18, 2007, at 5:37 PM, Tang Lihua wrote:
>> Hi, all
>> It's me again. I write an ode program with carbon c++ of xcode on
>> macosx. I can build and go in debug mode. but when i run the app
>> directly in "debug" directory, it refuses to work. The app exit
>> quickly without giving any error info. it seems cannot find drawstuff
>> and ode library.
>> Is there any oder having the experience about creating ode app on
>> macosx? who can give me some hints about setting the ode library? thanks
>> in advance.
>> ODE mailing list
>> ODE at ode.org
More information about the ODE