Rajeevan
Rajeevan

Reputation: 11

PocketSphinx, file is not of required architecture in iPhone Device but working in simulator?

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

Upvotes: 0

Views: 1112

Answers (2)

Rajeevan
Rajeevan

Reputation: 11

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... :)

Upvotes: 1

lucius
lucius

Reputation: 8685

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"

Upvotes: 0

Related Questions