Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

NSDuo

macrumors newbie
Original poster
Jan 16, 2008
18
0
I really want to use lua for scripting in my game engine. So I downloaded a framework from here: http://blog.trickyfly.com/?p=20 . I compiled the Xcode project to make the framework, included the framework in my project, compiled, and it worked except for this one warning I got:
Code:
"warning in /Users/Home/Library/Frameworks/Lua.framework/Lua, file is not of required architecture."
Because of this, when I try to use the library functions I get an error saying
Code:
"symbol(s) not found"

I have a feeling that the compiling settings for the framework xcode project don't match what is required by my system. If any one can help me with this, that would be awesome.

On the other hand, if anyone else uses Lua can anyone share their expeiriences setting it up? (I can't use "make" to save my life)

I'm using a Macbook Pro running OS X 5.6
 

NSDuo

macrumors newbie
Original poster
Jan 16, 2008
18
0
This may be a silly question, but what architecture(s) did you compile the framework for?

When I bring up the info for the project, I see that under "Architectures" it says "ppc i386." I'm very sure that this means it's compiling as a universal binary. Doesn't that mean it should work? Should I compile it as an Intel-only binary?
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Hi

Some time ago I got Lua up and running using Xcode. I recall running into a symbols not found error too. My problem was that I was using the C++ compiler and was #including Lua.h when it should have been Lua.hpp.

b e n
 

NSDuo

macrumors newbie
Original poster
Jan 16, 2008
18
0
I tried compiling the framework as an Intel-only binary, it didn't work, same warning and error. Maybe I could try a different method of installing lua.
 

NSDuo

macrumors newbie
Original poster
Jan 16, 2008
18
0
OK, I have a new idea. Would it work if I took the entire lua source, put it into my project and then compiled?

If not maybe anyone out there who has successfully implemented lua into their app could share their experiences setting it up.
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Hi

Yes, the source will compile as part of your projects without any major problems - that's how integrated Lua initially. If it would help though, I could send you my liblua.a.

b e n
 

Cromulent

macrumors 604
Oct 2, 2006
6,817
1,102
The Land of Hope and Glory
I tried compiling the framework as an Intel-only binary, it didn't work, same warning and error. Maybe I could try a different method of installing lua.

You need to compile your project as Intel only as well. As you posted above you are compiling it for PowerPC and Intel (Universal Binary) which obviously will not work with an Intel only framework.
 

NSDuo

macrumors newbie
Original poster
Jan 16, 2008
18
0
Hi

Yes, the source will compile as part of your projects without any major problems - that's how integrated Lua initially. If it would help though, I could send you my liblua.a.

b e n

I believe the xcode project also produced a liblua.a. Do I need to include that in my project with the framework? What is its purpose exactly?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Do you have the framework setup properly to be embedded inside your .app so that your app can locate it (@executable_path)?
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
I believe the xcode project also produced a liblua.a. Do I need to include that in my project with the framework? What is its purpose exactly?

Ah okay. I'm not exactly sure what's going on in your project but if you link against liblua.a you should be okay. Just drag it into the files and folder view and make sure that the .h (or .hpp) files are accessible. Simplest way is to put the lua source directory into your project directory.


b e n
 

NSDuo

macrumors newbie
Original poster
Jan 16, 2008
18
0
Well I added all the source files to my project, and...

SUCCESS!!!

All the functions are working, I'm not getting any warnings or errors
Thanks everyone for the help.

For anyone who finds this post via google with the same (or similar) problem, I just want to mention that if you include all of the lua source and compile, you may encounter a duplicate symbol error. Files "lua.c" and "luac.c" both contain "main" functions, be sure to remove these functions if you already have a main function elsewhere in your project.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.