How to build mathomatic lib for iPhone? - iphone

I want to compile the mathomatic(CAS) library for iPhone. I am not able to find any place where to define the "HANDHELD" flag which helps to compile the library for mobile devices.
You can find the library from mathomatic.
I have already compiled library but when I am trying to use that library then xcode is throwing error like "libmathomatic.a doesn't contain slice for i386" so, I have tried to get the architecture info using lipo command so, it showing x86_64. It might be looks like compiled library is for OSX not for iPhone so, what changes I need to do to compile it for iPhone? I have already taken look into make file but I am not getting how to define or change the architecture.
Help would be highly appreciated.
Thanks in advance.

Related

Linking C++ library to a view based application. [XCODE]

I am trying to link C++ based library file to an view based xcode project.
I am building a application for iPhone simulator.
So question is, is it possible to link C++ library to a objective-c project?
If yes then do I need to have an interface in between Objective-C code and the Library?
or can I use lib C++ functions/classes directly in the Objective-C class/methods.
Can some one please point to some good tutorials/examples to how to load a C++ based lib and use it in View based application in XCODE.
I have gone through this link:
http://www.eosgarden.com/en/articles/xcode-static-libraries/
There shouldn't be much you need to do. Have you renamed all files that uses the library to .mm? After that, everything should work the same. You can put C++ code on 1 line, then put Objective-C code the other line.

How to build DCMTK library to use in iPhone project?

I'm newbie to iPhone programming.I want to use DCMTK library in my iPhone project to display DICOM image but I don't know how.
I search google to use DCMTK on iPhone project.They tell me use CMake to configure and build on XCode. I have already successfully used CCmake to compile dcmtk3.6 but not build it in ios environment on XCode.It have 69 error of dcmprscp about Apple Mach-O Linker (Id) Error.
Have any idea,Thank you for answer. :)
ps.sorry for my bad english.
We can use DCMTK on iOS. The follow link will help someone who looks for information about this.
http://www.cppblog.com/kesalin/archive/2011/11/10/dcmtk_ios.html
That post is written in Chinese with many screenshots, we still can get enough information to work it out.
This is likely NOT a cmake issue, but rather an issue with trying to use DCMTK for iphone.
The "dcmprscp" module appears to be a command line tool, which I wouldn't expect to work under iOS. Start with building the DCMTK libraries under iOS & skip building the command line tools completely.

C Binary/Source Code in an iPhone XCode Project

What's the best practice to include existing C Libraries into an iPhone Project? I searched the Internet and actually found some pieces but nothing that explains the exact way to do it.
I'm trying to include the following Citrix XenServer SDK Library.
Any help is appreciated. Thanks!
You could try to build a static library and link against that.
I didn't try that myself yet, but as far as I could see, libxenserver has libxml2 as its only dependency.
libxml2 is available on the iPhone so you might have a chance.
To get started, create a Cocoa touch static library project and drag the C files into the project.
Now you have to figure out where to place the include files.
This might get a bit tricky and you will start with a lot of compile errors, but to me it seems possible to get it compiled.
The way I did it was to just create an iPhone static library project in Xcode and drop all the library's files in there. Then check if it builds and if the build settings are appropriate for the library you wish to compile. To add the newly-created library to your binary, you should follow the steps explained in the bottom part of the Three20 readme.
Note that you can only add static libraries to iPhone projects if you wish to get them into the App Store. Xcode also doesn't provide means to create dynamic iPhone libraries.

Lua on the iPhone?

I am trying to use Lua on the iPhone. On Mac OS X, in a normal (non-iOS) Cocoa application, I used the following code:
lua_State* l;
l = lua_open();
luaL_openlibs(l);
luaL_loadstring(l, "print(\"Hi from Lua\");");
lua_pcall(l, 0, 0, 0);
I downloaded Lua 5.1.4 from lua.org/ftp and compiled it for Mac OS X.
In the Xcode project, I used "Add Existing Framework" to add liblua.a and I used "Add Existing Files" to add the include directory.
This works as expected, and prints the string: "Hi from Lua".
When I try the same thing in an iOS project, it gives the errors:
"_luaL_newstate", referenced from:
_main in main.o
more of the same thing...
symbol(s) not found
collect2: ld returned 1 exit status
It seems that the .a file is not linked into the iPhone app.
Does anybody know how to make this work?
(By the way, I don't really care that Apple might not accept my app if it has Lua in it.)
You'll need to compile the Lua .a for ARM, not Intel. If the Lua library uses autoconf, you can use my favorite iphone/autoconf builder: build_for_iphoneos. If it's not autoconf, then you can use that script to get an idea of how to attack it. Sometimes you can just build a Static Library Xcode project, dump all the files into it and hit build. If the build is simple enough, it'll do most of the work for you.
I know it doesn't matter for your use, but Lua-based tools are generally shippable on the app store. You just can't download arbitrary code at run time and interpret it.
You might want to check out iPhone Wax. It is a lua/iPhone bridge that lets you write native iPhone apps in pure lua! Here is a pretty good tutorial about it.
If you want to write Lua code for iOS, then check out MOAI immediately: http://getmoai.com/
Its an absolutely enjoyable framework for developing games on iOS and Android, as well as Windows and OSX. Not only that, but it provides a pretty good idea of how to properly implement a Lua-VM based hosting environment for scripting in a cross-platform manner: from MOAI, you can learn a lot about this. I've done 4 titles with MOAI so far, and won't be stopping any time soon .. MOAI absolutely kicks ass!
Also check out LOAD81, which is a similar effort albeit with SDL as the target environment: http://github.com/antirez/load81
(I've contributed a little to the LOAD81 project, specifically giving it features of interest/value to the OpenPandora community. MOAI is more commercial, LOAD81 more hobbyist..)
For those trying to learn Lua and the different methods of integrating the Lua VM in a project for multiple platform targets, both MOAI and LOAD81 can provide a lot of great background and clues about the right way to proceed.

Stomp.framework iPhone linking. Anyone have experience?

Having trouble linking the Stomp.framework into an iPhone SDK application.
http://code.google.com/p/stompframework/
I follow the instructions, adding it to the project, adding a Build Phase for Copying the Files, and including it via #import .
I keep getting "image not found".
Anyone try this and/or have a clear idea why?
This may be better:
http://github.com/juretta/objc-stomp
I found it fairly easy to get going.
The iPhone SDK doesn't support embedding frameworks in applications. I believe it supports dylibs, though I'm not certain of that fact. However, the safest thing to do would be to take the source of that framework and compile it directly into your application.
Make sure that whatever folder contains the .framework bundle is listed in the Framework Search Paths setting of your target or project.
There's more you'd need to do if you want to embed the framework in your application but that's another question.
edit: Totally ignored the iPhone requirement there, you'll have to compile the framework as a static library and link against that.