Xcode : Apple Mach-O linker Error - ios

I made the app in Xcode 4.6 and tested in device. The app is made for both iPhone and iPad. When I try to archive it to make .ipa file, I get this error :
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/admin/Desktop/appName/appName/libzbar.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to set the architecture for this in Build Settings? Or is there some different issue?

libzbar.a library needs to be built for armv7s architecture. If you cannot do that (because you don't have source code for this library) than you should remove armv7s from valid architectures.
You can change valid architectures by following steps:
select project name from the Project Navigator
select project target
open Build Settings tab
change valid architectures field

Related

SDL2 iOS app: Entry point (_main) undefined for architecture armv7

I built a small game using SDL2, SDL2_ttf, and SDL2_mixer. I ported it to Xcode and was able to run it with the iOS simulator just fine. I successfully built all of the SDL2 libraries with the target set to "iOS Device" and imported them into the Frameworks directory of my project. However, when I tried to archive the project with the target set to "iOS Device" I get the following error:
ld: entry point (_main) undefined. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is this issue casued b7 the SDL libraries I'm trying to link to or is it something else entirely?
I bet the SDL lib doesn't contain a valid armv7 slice but your app is being built for arm7 and arm64.
Check the SDL build settings and make sure that the 'valid architectures` include armv7

missing required architecture x86_64 in ...libMumbleKit.a (3 slices)

I am trying to include MumbleKit as a library instead of having to compile it each time by following the suggestion of a member of this forum. Yet when I try to compile on the simulator I get:
missing required architecture x86_64 in …libMumbleKit.a (3 slices)
I think I added all the necessary versions to MumbleKit before generating the library:
arm64 armv7 armv7s armv7k arm7s x86_64 i386
notwithstanding, when I execute:
lipo -info libMumbleKit.a
I get:
Architectures in the fat file: libMumbleKit.a are: armv7 armv7s arm64
as well as configuring Build Active Architecture to NO.
I generated the library for MumbleKit both using the Generic iOS device and a iOS 9 physical device.
When I try to archive using the Generic iOS Device option after having extracted the Mumble library in the same way, I instead get error:
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(CryptState.o)' was
built without full bitcode. All object files and libraries for bitcode
must be generated from Xcode Archive or Install build for architecture
armv7
Same when using my physical device after also generating the library in the correspondent way:
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(CryptState.o)' was
built without full bitcode. All object files and libraries for bitcode
must be generated from Xcode Archive or Install build for architecture
arm64
And finally the installation on my iOS 9 iPhone 6S went fine with just the same contents in the warning:
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(CryptState.o)' was
built without full bitcode. All object files and libraries for bitcode
must be generated from Xcode Archive or Install build for architecture
arm64
CryptState.cpp if a c++ file in the library.
Check architectures it has with lipo tool. Open terminal, navigate to folder where your library is and do:
lipo -info yourlib.a
If you don't have x86_64, than you should find/compile lib that will have it.
x86_64 is an architecture for Simulator, not for generic iOS device.
I applied the suggestion at:
Xcode 7 'CrashReporter does not contain bitcode' linker error
by adding option -fembed-bitcode to the other linker flags field. And now the problem has moved to a c file: band.c, notwithstanding of course I have added this option for the c and c++ files.
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(bands.o)' was built
without full bitcode. All object files and libraries for bitcode must
be generated from Xcode Archive or Install build for architecture
arm64
What might be still missing?
I aborted the attempt. There must be something faulty in the original mumble kit project not allowing to import its library into another project, or I do not know how to do it anyway.

Facebook sdk is compiling on my IOS device, but no my simulator

I've downloaded the Facebook SDK, and gotten it to work on the simulator to post from my app, but it won't even compile on my device.
clang: error: no such file or directory: '/Users/justking14/Library/Developer/Xcode/DerivedData/Descover-fqkbngyllggoxkcskmhhzgmkffxe/Build/Products/Debug-iphoneos/libPluginFacebook.a'
clang: error: no such file or directory: '/Users/justking14/Library/Developer/Xcode/DerivedData/Descover-fqkbngyllggoxkcskmhhzgmkffxe/Build/Products/Debug-iphoneos/libPluginProtocol.a'
libPluginFacebook.a and libPluginProtocol.a are in red in the Link Binary with Libraries, and when I remove them it still won't compile saying
ld: file is universal (4 slices) but does not contain a(n) armv7s slice: /Users/justking14/Desktop/IR/cocos2d/plugin/plugins/facebook/proj.ios/sdk/FacebookSDK.framework/FacebookSDK file '/Users/justking14/Desktop/IR/cocos2d/plugin/plugins/facebook/proj.ios/sdk/FacebookSDK.framework/FacebookSDK' for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The FacebookSDK you use doesn't have machine code for the architecture armv7s
That architecture WAS top of the line but now, apps mostly only use armv7 and arm64
Change your app build settings to only use those architectures (just use the default)

File does not contain an armv7 slice

I cannot build and test on devices because Xcode gives me this error:
ld: file is universal (2 slices) but does not contain a(n) armv7 slice: /Users/------/Desktop/Running APP/------/-----/YACropImage.a file '/Users/------/Desktop/Running APP/------/-----/YACropImage.a' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If you want to remove the support for any architecture, for example, ARMv7-s in your case, use menu Project -> Build Settings -> remove the architecture from "valid architectures".
You can use this as a temporary solution until the library has been updated. You have to remove the architecture from your main project, not from the library.
Alternatively, you can set the flag for your debug configuration's "Build Active Architecture Only" to Yes. Leave the release configuration's "Build Active Architecture Only" to No, just so you'll get a reminder before releasing that you ought to upgrade any third-party libraries you're using.

Mach O Link Error- linker command failed with exit code 1 (use -v to see invocation)

When I try building for archiving for my app in Xcode (version 4.5) I get an error that says:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/[myrealname]/Downloads/[myappname]/BT_Objects/TwitterOAuth/SAOAuthTwitterEngine/libOAuth.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It then says under it:
(null): File is universal (3 slices) but does not contain a(n) armv7s slice: /Users/shakerite/Downloads/shakeritetestnotrealone_v15_iOS/BT_Objects/TwitterOAuth/SAOAuthTwitterEngine/libOAuth.a for architecture armv7s
Does anyone know how to solve this?
I received a very similar message just the other day when I tried running my app on my iPad after several successful attempts on the simulator. I found out that under the build settings I had to make "build active architecture only" to yes. Then my app would compile on my device. Hope this helps.
Yeah, I had this same exact problem. Click on your project in xcode. Then, click on the target. Go to build settings and look for valid architectures. Delete armv7s from the list of valid architectures and just leave armv7.
Let me know if you have any questions!
here I provide you one temporary solution that can solve this error hope its help you,
go to Project->Build Settings->Build Active Architecture Only->yes
thats it.

Resources