Compile existing Lua app using XCode for iOS5 - iphone

We had a freelance developer that went rogue and now I'm left with a Lua-based app with no build files.
I have a degree in computer science, but have no experience with Lua, so I'm wondering how I can compile this (or any Lua app) with XCode for iOS.
It's a fairly simple app. It appears as though it loads in images for navigation and displays other images as content.
How do I tell XCode to compile Lua for iOS though? I have all the files in XCode and it's compiling, but clearly its ignoring the .lua files and compiling the application shell.
I have Lua downloaded by source and also installed it via MacPorts. I read that I need to link lua.h and luac.h but I don't see how to add it as a build target.
Any advise or direction would be much appreciated.
These are the files I have:
Source Code/
build.settings
Clinical_Data/
page4a_2_Anim.lua
page4a_3_Anim.lua
page4a_4_Anim.lua
page4a_5_Anim.lua
page4b_2_Anim.lua
page4b_3_Anim.lua
page4b_4_Anim.lua
page4d_2_Anim.lua
page4d_3_Anim.lua
page4d_4_Anim.lua
config.lua
home.lua
Icon-72.png
images/
<*.png files>
main.lua
manifests/
CaseStudy.manifest.txt
ClinicalData.manifest.txt
Experience.manifest.txt
Home.manifest.txt
NavElements.manifest.txt
Pathology.manifest.txt
References.manifest.txt
Restasis.manifest.txt
menu.lua
page4a_2_Anim.lua
page4a_3_Anim.lua
page4a_4_Anim.lua
page4a_5_Anim.lua
page4b_2_Anim.lua
page4b_3_Anim.lua
page4b_4_Anim.lua
page4d_2_Anim.lua
page4d_3_Anim.lua
page4d_4_Anim.lua
parser.lua
pdfs/
<*.pdf files>
section.lua
slide.lua
slideView.lua
ui.lua

It's probably linking lua from your installed lua code. There'll be a -llua in your link code. Somewhere in your source files there'll be a
luaL_loadfile(L, file);
command. This loads the lua file.
If it's corona it might have a different way to load - haven't used it.
If you need an IDE http://www.eclipse.org/koneki/ldt/ is superb. You can remote debug your app very easily.

It looks like it may be corona from anscamobile.com.
You can download a trial version from their site to see if it compiles.

Related

Cannot include boost libraries in Ogre iPhone SDK version

I installed the Ogre3D iPhone SDK and tried to compile the sample project in XCode4. I ran into "lexical or preprocessor issue" which many people have been experiencing in XCode4. In my case, XCode was not able to fine "OgreCamera.h".
I managed to solve this problem by creating an "Indexing" group folder in my project and dragging the header files into it as suggested in this thread:
Compile, Build or Archive problems with Xcode 4 (and dependencies)
However, I ran into the same issue again in a different form. There are no more errors about "OgreCamera.h", but now I'm getting "'boost/thread/tss.hpp' file not found". I've dragged the boost folder and the individual boost header files into the Indexing group, to no effect.
All my include paths are configured correctly, XCode should be able to find these files based on my build settings.
I don't know what to do. I've searched for solutions to this and failed to find any. My best guess is that the contents of the Indexing group need to be a flat hierarchy with no sub folders, but Ogre references the boost headers files using a file path: "boost/thread/tss.hpp", and this causes problems for some reason. But I don't know how to go about fixing it.
Does anyone have any suggestions?
Thank you.
I had the same problem. I was copying boost into the root of the OgreSDK and then adding the following to my header search paths
$(SRCROOT)/boost
You'll notice the file being included is "boost/thread/tss.hpp". So using the above header search path it would be looking for $(SRCROOT)/boost/boost/thread/tss.hpp.
Assuming you have $SRCROOT/include in your header search paths - the solution is just to move the boost folder to your include directory.
PS... if you don't have a boost folder you'll need to download boost and copy it in there.

How to run phone gap with xcode4?

Since moving to XCode4, I have been getting errors like:
/VERSION: No such file or directory
cp: /javascripts/phonegap..js: No such file or directory
cp: /javascripts/phonegap..min.js: No such file or directory
error: /VERSION: No such file or directory
for projects that were working under XCode3.
Open XCodes Preferences, and navigate to Source Trees. If there is no PhoneGapLib entry there, try adding a new setting with the following values:
Setting Name: PHONEGAPLIB
Display Name: Phone Gap Lib
Path: /Users//Documents/PhoneGapLib
Note that the path should be to the location of your PhoneGapLib folder, and that it may not be in your documents folder, depending on how you installed PhoneGap.
I just learned about a great web service recently made available by Nitobi (makes of PG), which will automatically generate the necessary PhoneGap files you need for use in Xcode 4.
Just enter your project name, hit a button and they'll generate a zip file for you to download. This lets you set up a new project without messing with the command line.
You could set up a new project, then migrate your older project files over.
Did you search Google for this error?
I'm a bit of a noob with PhoneGap and Xcode still, but I know there have been recent issues with PG and Xcode 4. Perhaps you're experiencing the same issues as the commenters to this post: PhoneGap + XCode4 (and more specifically, here).

dyld: Library not loaded - When app run from the command line

I face some difficulties when adding a framework to my project when i run an iPhone app from the command line.
My final goal is to run applications tests from an automated build process.
When i run my app from xCode :
I add a "Copy File" build phase to my target and everything goes fine.
The copy is set to $(BUILT_PRODUCTS_DIR) as "Absolute path"
When i run my app from the terminal (using iphonesim project) i get this error :
dyld: Library not loaded: #rpath/OCMock.framework/Versions/A/OCMock
UIKitApplication:indemnisation[0xb894][26380] Referenced from: /Users/Admin/Library/Application Support/iPhone Simulator/User/Applications/CD5729B5-A674-49B2-91F6-AD398094B6F8/indemINT.app/indemINT
What i dont understand is that the copy build phase just copies the framework files in the same directory as the app.
When i run the app from the command line the framework files are already in the same directory. Does anyone knows why it doesn't work ?
I've also tried to add the OCMock.framework in the following directories (without success) :
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library
/Library/Frameworks
/Users/Admin/Library/Application Support/iPhone Simulator/User/Applications/CD5729B5-A674-49B2-91F6-AD398094B6F8
Thanks in advance,
Vincent.
I just had this same exact error in Xcode 4.2 (4D199) on Lion. I dragged/dropped the OCMock.framework folder into my project and selected the "copy files" checkbox. I saw the above answers and realized I neglected to add a "Copy Files" build phase to move the framework into place. I added one and dragged it right after the compile files build phase and tried to run my tests again. I couldn't get it to work until I had changed the destination in the "Copy Files" phase to the "Products Directory". Using "Frameworks" or "Shared Frameworks" did not work.
The iPhone does not support traditional Mac OS X frameworks. While the iPhone does use folders that end in ".framework", these folders are structured differently than typical Mac OS X frameworks. Most notably, iPhone frameworks are only permitted to use static libraries, while typical Mac OS X frameworks are dynamically loaded. That the message comes from dyld indicates that you are using a shared libary; however, applications targetting the iPhone may only be statically linked.
OCMock is distributed as a framework, and the iPhone does not allow you build your own arbitrary frameworks (there are good reasons to do this on a device with only 128MB of RAM and no swap).
The solution I see in a lot of places around the web is to put OCMock.framework in /Library/Frameworks or anywhere else in the standard framework search paths. This isn’t a very good solution: your build system is now dependent upon the state of your particular machine. Not good.
Another option would be to add the source for OCMock to your unit test target. This would work but is unnecessary, as your tests will never run on the iPhone,2 so why bother building them for ARM? Executables built for the iPhone simulator, being Mac OS X binaries, can link against dynamic libraries just fine. We can use this to our advantage.
What follows is what I believe is the best way to get OCMock working with iPhone projects:
First, add OCMock.framework to your project. Make sure that it’s being added to your Unit Tests target, not your application.
Next, add a Copy Files phase to your Unit Tests target. Set it up like so:
Destination :Absolute Path
Full Path :$(BUILT_PRODUCTS_DIR)
Now, drag OCMock.framework onto your new Copy Files phase to add it to the list of files to be copied.
Finally, drag the Copy Files phase, which I renamed it to “Copy OCMock”, between the Compile Sources and Link Binary With Libraries phases.
That’s it! Run (and by run I mean build) your tests and everything should work correctly.

Developing for the iPhone outside Xcode

I'd like to develop and run my iPhone applications from the command line and my personal editor instead of having to use Xcode.
So far I've been able to edit all the files in Emacs and run xcodebuild in the project to compile/link/etc.
The next step would be to create a Makefile task to launch the iPhone Simulator with my current application. Any ideas of how can I do that?
Update: I'm not interested in XCode calling my editor, I just want to forget about the IDE as much as I can.
All you need to do is copy the built .app from wherever XCode puts it to ~/Library/Application Support/iPhone Simulator/[some version]/Applications/[somefolder]/.
Then, launch /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app. Not sure how to get it to launch a specific application, but that'll take you to the home screen.
Note also that you can set up XCode to use external editors, even for source code. In this setting, you'd open XCode to look at the treeview displaying the files and other items making up your project, but once you double-click a sourcecode file it would open in e.g. Emacs.
There's a screencast over at Mac Developer Network demonstrating this: link
I doubt it. If you jailbreak your phone and install SSH on it you could set up something to >>copy the .app over wifi, but that's a fair bit of work. – Noah Witherspoon Jan 13 '09 at 5:24
I did all of my beginning iphone development work this way. Just ssh'ing over the binary executable and whatever other files you might need (after you locate the App folder on your phone) is actually much faster than installing the application from xCode. Note that I wasn't running the debugger.

Adding a static library to an iPhone project

The motivation for this question is me trying to get LDAP functions to work with an iPhone application which is a project I'm attempting for part of my dissertation.
When I was developing the application I used the ldap.framework framework that is part of Mac OS X. This works fine in the simulator, but when I try to now get the app on a device it tells me that I'm not allowed to use this framework.
After some research I found that I could build openldap using the arm architecture and add the static library to my application destined for my device.
I eventually managed to compile configure and build openldap by setting variables as mentioned here and using the following commands...
Ade$ ./configure CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 \
LD=$DEVROOT/usr/bin/ld --host=arm-apple-darwin --with-yielding_select=yes
Ade$ make depend
Ade$ make
I was told that the file I'm looking for will have an extension of '.a' so I searched for a '.a' file that mentions ldap...
Ade$ sudo find / -name *ldap*.a
Password:
/Users/Ade/Desktop/openldap-2.4.16/libraries/libldap/.libs/libldap.a
/Users/Ade/Desktop/openldap-2.4.16/libraries/libldap_r/.libs/libldap_r.a
So I assume these are the files I need?
My question is what do I do next? I know I need to add the library to the Xcode project and probably add a load of '.h' files too?
If anyone can give me a pointer to documentation or shed any light on the next stage I would be really grateful.
Many thanks,
Ade
ps. I have also talked about this process on my blog at www.greenpasta.com.
I've done this same thing to build an LDAP client for the iPhoneOS 2.2. You just to drag the .a into the "link with libraries" build stage. I recommend using the regular (non _r) version of the library, unless you specifically need reentrancy on your ldap stuff (which I don't recommend). You can also add the .h's to your project, which is generally the easiest way to access them.
Simply drag the .a files into the Xcode project and choose "copy files into project". I'm not familiar with OpenLDAP but I think the _r version is just a threadsafe version. I would recommend using that and not copying the other. You should probably not copy both files into Xcode or you will get link errors.
Then do the same for the .h files that define the client APIs of OpenLDAP - again I'm not sure which these are but I'm sure you can find out easily.
I would advise organising the .a and .h files together in a Xcode group under resources.
Include the header files in your source and you should be good to go.
You may also need to add -lldap to your linker command (in the build settings pane).