Hi,
First of all, thanks for making this library which sounds amazing. If I can solve my problem, I'm probably going to use it for a while.
Sadly, I got a
bus error when trying to get the pointer returned by orxObject_CreateFromConfig. If I remove the assignment, it works perfectly.
This line causes the fault.
orxOBJECT* object1 = orxObject_CreateFromConfig("Object1");
I use the precompiled version for Mac (I'm under Mac OS 10.7). As I don't like xcode so much, I'm trying to use the library through a makefile. My .ini configuration file is the same as in the first tutorial. However
orxd doesn't help and crashes as well.
Here are my compile lines:
g++ -W -Wall -g -ggdb -O0 -arch i386 -c src/main.cc -o src/main.o
g++ -W -Wall -g -ggdb -O0 -arch i386 -lorx -shared src/main.o -o test.so
Do you have any idea to solve my problem ? Maybe some g++ flags I forgot ? (I already tried -D__orxDEBUG__ etc.)
Thanks in advance.
Ps: I cannot provide a valgrind report for now because of compiling issue on Mac OS Lion (crap why did I upgrade ?)
Comments
Your code... ...is pretty much the most basic and frequently-used line out there, so something really exceptional must be happening. This is a complete shot in the dark, but can you try replacing "-arch i386" with "-m32"? My reading is that there's a slight semantic difference between the two.
I don't honestly expect it to make a world of change, but your program/Makefile look really straightforward, so it's worth a shot...?
Maybe I should compile the library for my x86_64 architecture. I'll let you know if it's better.
Have you tried running the tutorials? They're on the download page under orx-tutorial-mac1.3rc0.zip, I believe.
(EDIT: I see you used the .ini file from the tutorial, but do the programs themselves run? Also, do you know if you're running your application as an Orx plugin, or as a stand-alone application?)
Your problem looks a lot the one I had when I decided to switch from gcc 4.4 to gcc 4.5 on linux and mingw. Unfortunately those two versions of gcc don't create objects that are binary compatible.
My guess is that the same thing is happening here. I'm still on OS X 10.6 which uses the darwin10 gcc 4.2.1. Do you know which version you're using?
If this turns out to be the problem, there's an actual easy solution albeit a bit tedious. As I presume it won't be easy to use an older version of gcc on 10.7, you'll have to sync orx's SVN (which is the way to go as the latest release is getting pretty old anyway ) and recompile orx and all its dependencies.
Luckily you shouldn't have to make any code change, simply open the project files and recompile them. That should be about 15 mins of work if everything goes well.
There are some dependencies you don't need to care of. Here's the list of the ones you need to recompile:
- Box2D: the XCode project file is in extern/Box2D_2.1.3/build/Xcode
- libsndfile: the XCode project file is in extern/libsndfile-1.0.22/build/Xcode
- SOIL: the XCode project file is in extern/SOIL/build/XCode
- GLFW: the XCode project file is in extern/glfw-2.7/build/Xcode
And finally orx itself whose project file is in code/build/mac/xcode and is named orx-embedded (not the regular orx one!).
There's only one version to compile for all the external dependencies, whereas you'll have to compile all 3 versions of orx.
Then you should be all set! Let me know if you try it and that was the issue or not.
Sorry for the inconvenience!
I'm trying to compile the trunk version of orx (with xcode 4), every externals have been recompiled but I get this error when linking the library (orx and orx-embedded produce the same error):
Everything has been compiled for the i386 architecture so I don't think it's the problem. Ex. for orxJoystick.o, nm effectively says _orxPlugin_JOYSTICK_Init is undefined, and I couldn't find this symbol in any other object file.
I've looked into the sources but I lost myself into your macros
EDIT:
OK, I think I found what's going on. __orxIPHONE__ is defined, comming from TargetConditionals.h (Apple file). I'm looking for a way to change the targeted OS in xcode.
EDIT:
I couldn't find how to change the targeted OS so I just replaced the #define __orxIPHONE__ by __orxMAC__ (please don't heart me :laugh:).
I got a brand new error:
I found the solution on this topic, maybe this will help somebody. In the project settings (for every target), set:
Inline Method Hidden to Yes
Symbol Hidden by default to No
And my original problem is resolved too ! Thank you guys
Please let me know if you want me to make a distribution for Mac OS 10.7
Btw, I was about to check your issue on my side as I didn't know you solved it on yours and I stumbled upon the SOLVED tag while replying to someone else. The reason for thst is that we don't get email notifications when a post is edited, so don't hesitate to post new replies instead of editing your last message this way people will get notified of your new discoveries.
Defining manually __orxMAC__ is totally fine but I'd still like to fix the platform automated guess so that others won't run into the same problem later on. If you feel like helping me with that, please drop me a line by email or in PM.
As for the release package for 10.7, that'd be great but I'll contact you again when I'll be making a new release. It might take a while as doing the whole packaging/release takes me about 6 hours as nothing is automated and getting motivated for that is getting harder and harder.
I'm looking at the platform selection issue, the bad thing is if you create a Mac OS project (a tried with a "console utility"), and include the "TargetConditional" header, TARGET_OS_IPHONE is still defined. So it's probably not just a project setting to change. I'll let you now if I find a way to get out of this (by replying ! ).
About your macros, I'm more impressed than disgusted ! It's very instructive to read this kind of code.
When you include the header, TARGET_OS_MAC and TARGET_OS_IPHONE are always defined. The only thing that differ is there values (here).
Here is the fix:
Thanks for the TARGET_OS_IPHONE info! Apparently what I have written for guessing if we're on iPhone or not has been broken since 10.6 and I didn't even realize! Oops! ^^ I'll update the SVN tonight.
Glad it helped you. We should probably add a FAQ to orx's wiki and put that info there. I'll try to start a FAQ in a few days but I seriously lack of time lately.