I'm trying to add Angelscript to my development framework. Everything's hunky-dory on Windows. On Mac, I grabbed the download (2.22.0), opened the Xcode (4.2.1) project, and compiled. After correcting the architectures, I get this:
Error in backend: Inline asm clobbers must be last on the x87 stack
I saw in an earlier thread that someone else had this problem, but changed it by dropping back to the GCC compiler.
XCode 4.2.1 has dropped GCC. They only have the LLVM versions in. And when I use LLVM versions, the compile succeeds, but the .a is not produced-- there's just nothing.
I am on a completely new machine, I don't have the option of attempting to fudge it by forcing XCode to use the old compiler, and I'm not even sure I'd know how to do that in XCode anyway.
Does anyone know anything that can be done to get an angelscript static library for OSX and for iOS?
Please try with version 2.22.1 instead, which was released on December 28th. It has some fixes that reportedly corrected the problem on XCode and CLang (the front end for LLVM).
Let me know if there are still problems, and I'll look into them.
Well, downloaded the newest did get me to compile the libraries. My OSX build now works.
However, when I switch the library to iOS and Arm, and try to link the resultant .a into my test program, I get the following two linker errors:
Undefined symbols for architecture armv7:
"__Z24CallSystemFunctionNativeP10asCContextP17asCScriptFunctionPvPmS3_Ry", referenced from:
__Z18CallSystemFunctioniP10asCContextPv in AngelScript_iOS.a(as_callfunc.o)
"_strtod$UNIX2003", referenced from:
__Z18asStringScanDoublePKcPm in AngelScript_iOS.a(as_string_util.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This, however, might be an issue of me not being as smooth on XCode as I am on Visual Studio. To compile the iOS version, I just changed the architecture to ARM7, and the base SDK to iOS5 ... is there something more I need to do?
Hmm, I don't think angelscript has been compiled for iOS on your setup. It has been compiled for iOS before, but if I'm not mistaken the gnuc makefiles are usually used.
The CallSystemFunctionNative for iOS/arm is defined in as_callfunc_arm.cpp and as_callfunc_arm_xcode.s. Make sure these are two files are included in the project.
The missing strtod symbol seems to be a slight platform incompatibility. I'm sure there is a similar function for iOS, but I'm not sure which it is. Maybe it is just a matter of prefixing the function with a _ in the as_string_util.cpp file.
As it seems you're using a different setup than what has been used before there might be changes necessary to as_config.h to identify your setup. Let me know if there are more problems after fixing the two problems above, and I'll help you figure out the changes needed to as_config.h.
You were correct, I had to include the ARM files specifically.
The strtod issue remains, but I believe it's a little weirder an issue than just renaming the variable (I did try that, it error'd out). I tried commenting out strtod completely, and just had that line read res = 0, and now the linker fails without giving a reason-- just says exited with code 1, but doesn't name any other error.
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ failed with exit code 1
That's all of it-- no what, where, when, or why.
So I assume I've got either some compiler settings wrong somewhere, or am doing something else wonky. Do you happen to have a list handy of what files should be added to XCode for the iOS build? I took the OSX version and turned it into an iOS one, but maybe I'm including or not including something that should or should not be there?
strtod is a standard C runtime function. For some reason it is not available for the iOS platform. It will have to be substituted for another equivalent. Perhaps atof() can be used instead.
As for which file to include for the library. You can include all of them. The preprocessor configurations in as_config.h will eliminate what won't be used. However, I don't think you're missing any code as you don't have any other missing symbol errors.
clang++ failing with exit code 1 isn't very helpful. Perhaps there is a more verbose mode that can give a better hint as to what is missing?
Apparently the strtod problem exists with other projects as well. I did a search on google, and it seems it might be a problem with some libraries not being up-to-date. Google search terms: iOS strtod$UNIX2003
If you can't get it to work I suggest changing to strtof, at least until the proper fix is determined. strof will at least allow the engine to parse the floating numbers, even though it will loose precision.
Hm, strtof is also apparently not included. atof worked, though... for the nonce, I won't need the precision, I haven't used a double for anything yet!
Thanks for all your help. I'll hit the donate button tomorrow.
Will you be making new iPhone games with angelscript? That would be wonderful.
I got to say I really like your iPhone games. Solomon's Keep and Boneyard are probably some of the games I've played the most on my iPhone. Hoggy is also great, though the last levels are truly difficult.
Do let me know if you make any games with angelscript so I can put it on the user's list.
I will! I might be using it for the skill system in the sequel to Solomon's Boneyard, just to make things easier to edit. But the real reason I've started integrating it is that I will be adding a lot of user-created content options in future games, and I absolutely love that you made a scripting language that mimics C++. Really brilliant work. It's so good, I'm tempted to just make a portable game engine and Angelscript all game code, but I admit I'm a little afraid of the speed, even though my speed tests so far have been just remarkable.