tags:

views:

238

answers:

2

Hello all,

I'm new to apple development, For my Uni project I try developing an application for iPhone using PocketSphinx to recognise speech commands...

I used the "build_for_iphoneos.sh" script available in PocketSphinx SVN and SphinxBase. Program working without any issues when i try it on simulator, today I try to deploy on device and it's giving me this error? can any one help me solve this please?

Error:

ld: warning: in /Users/me/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/lib/libpocketsphinx.a, file is not of required architecture
ld: warning: in /Users/me/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/lib/libsphinxbase.a, file is not of required architecture

and the rest of the references to functions report undefined error!

any help? Thanks. Jeevan

A: 

Usually that error occurs when you have a static library built only for Intel when you need to build for arm. You can have a fat binary for both architectures if you use the lipo tool.

Edit: Oops, I meant the "lipo" tool, which was autocorrected to lip. To create a fat binary iPhone static library for both the iPhone OS device (arm6/arm7) and Simulator (i386), use something like this:

lipo -output libOAuthConsumerTouch.a -create Release-iphoneos/libOAuthConsumerTouch.a Release-iphonesimulator/libOAuthConsumerTouchSim.a

That was for a library called "OAuthConsumerTouch"

lucius
thanks for the reply, see I;m totally new to this development environment. could you please give me some more details or websites on how to use this "lip tool"?
Jeevan
Jeevan
I don't understand enough of shell scripting, and there's probably an argument to the script that needs to be checked, to understand why it's not working.
lucius
Thanks... I figured out... Just needed to compile the device with make clean after the simulation part... because simulation is i386 architecture based and when device build is called without cleaning, it's ignoring the platform change and keeping the previous configuration... something like that... calling `make clean` between them solve the problem...
Jeevan
A: 

Solved... When following instructions given by Sphinx, everyone will go through the order mentioned in their Readme File. Which is:

./build_for_iphoneos.sh simulator
./build_for_iphoneos.sh device

Because Simulator is i386 architecture based, when calling "./build_for_iphoneos.sh device" it's still keeping ht previous cache and ignoring armv6 architecture change...

To solve this problem, Call "Make Clean" between them...

./build_for_iphoneos.sh simulator
make clean
./build_for_iphoneos.sh device

Hope this helps others... Thanks "lucius" for his help.. i've learned something about Lipo tool... :)

Jeevan
Thanks for the notice, I'll update the README. I've been working on improving Sphinx support on iPhone.
Brian King
Hi Jeevan, I'd like your input on my project. http://github.com/KingOfBrian/VocalKit/ -- I'm going to be working on a few more features and text to speech. Hope this can help!
Brian King
sorry, been busy with the demo of my project and etc... Good luck with simplifying things...
Jeevan
Okay, I've written something about how to get PocketSphinx working inside iPhone using pre-recorded audio and added my xcode project to be downloaded… My english is not in professional level, but I'm sure you can manage.http://www.rajeevan.co.uk/pocketsphinx_in_iphone/
Jeevan