XCode linking error when targeting armv7 - xcode

I've already spent countless hours puzzling over this, utilizing Google searches and other Stack Overflow questions to no avail.
I have an iPhone/iPad universal application, which seems to compile fine when the target is armv6. However, when the device is iPad, I get this warning:
warning: building for SDK 'Device - iPhone OS 3.2' requires an armv7 architecture.
Oddly enough, the app still runs great on iPad in spite of this warning. However, I do want to do things the "right way" what ever that means in this case. When I switch the target architecture to armv7, I get linking errors:
"___restore_vfp_d8_d15_regs", referenced from:
*redacted*
"___save_vfp_d8_d15_regs", referenced from:
*redacted*
ld: symbol(s) not found
collect2: ld returned 1 exit status
The "redacted" portions of the errors are references to the static library to which I'm trying to link.
Here's what I've tried from the many suggestions online. Each of these were suggested more than once without any explanation, which leads me to believe nobody quite understands this problem:
"Never use the drop down menu in the upper left of the XCode window to choose the target. Instead, set this to Base SDK and then the Base SDK to iPhone OS 3.0 in the target configuration. Set the target device to your preferred target (iPad, iPhone OS 3.2 in my situation.)"
This yields the error "Library not found for -lcrt1.3.1.o"
"Make sure that GCC isn't linking against the wrong version of the standard library. (You'll have to make sure the LIBRARY_SEARCH_PATH doesn't have the wrong path in it.)"
My LIBRARY_SEARCH_PATH is already empty, so this doesn't seem relevant.
"Try compiling with GCC 4.0 rather than GCC 4.2."
I get a syntax error inside a UIKit header file. The error is "Syntax error before 'AT_NAME' token." The line is "UIKIT_EXTERN #interface UILocalizedIndexedCollation : NSObject."
Another project compiles just fine with the same target settings, which is really making me question my sanity. Could I be dealing with a corrupt XCode project?
If anyone knows what's actually happening and has a reference or doesn't mind explaining it, I would be so very grateful.
Cheers!

VFP between ARMv7 and ARMv6 differs in various ways. In ARMv7 its usually preferable to use NEON. The problem is your static library depends on VFP in ARMv6 - you either need to compile the library at ARMv7 or keep the whole application at ARMv6.
Reverting back to GCC 4.0 is silly - ARMv7 support was basically nonexistent back then unless Apple backported it.

I had the same errors except it was for armv6. I fixed them by unchecking "Compile for Thumb" in the project settings for the static library and the main project.

try do like this http://groups.google.com/group/three20/browse_thread/thread/31ddbc047aa1b9ae/c4c5827ab0c7a76f

As far as AT_NAME error is concerned one of the possiblity is
Check if you miss the #end in a class.
To know more about AT_NAME error visit the following link
http://iosdevelopertips.com/xcode/error-syntax-error-before-at_name-token.html

Related

Xcode 12: how to link against object files built for free standing

The issue is about linking x86_64 macOS executables statically against libavcodec, libavdevice, etc, which have some object files built against freestanding as they use YASM which isn't able to embed the macOS "tag" in the binary (see Building for macOS, but linking in object file built for free standing for detailed information on that issue).
Everything works fine under Xcode 11.6 - the following messages are here, but they are warnings.
With the Xcode 12 update they become an error.
How to make them warnings again ? I could not find anything relevant in the ld man page.
ld: in ffmpeg/lib/libavcodec.a(aacencdsp.o), building for macOS, but linking in object file built for free standing, for architecture x86_64
There is no option I have found to revert the error to a warning. Apple has been warning us about this issue for a few releases of XCode now and the warning has become an error.
Until NASM is modified, or we can use some other assembler, the only option that allows me to build and link against the libav libraries in my application is to disable assembly when compiling ffmpeg.
./configure --disable-asm
This works my my case, as the performance of the non-assembly code path is acceptable in my desktop authoring tool. The server-based renderer still uses the assembly code path as it is linux based.
You may have to configure any libaries that you are including in your ffmpeg build to also disable assembly.
Once again, this is an acceptable solution for my case, as the non-assembly code paths are fast enough for my use case.

Parse and Facebook SDK "Bolts" Framework error

I have an app with both the Parse and Facebook frameworks installed. Parse was installed by dragging the files to the "Frameworks" folder of the project and selecting "copy if needed", while the Facebook SDK was installed by dragging and not selecting the copy option. Both appear under the Linked Binaries list. The problem appears to be that Bolts is included in both SDKs. I tried just using the Facebook one, producing the following Link-O errors:
Undefined symbols for architecture x86_64:
"_BFTaskMultipleExceptionsException", referenced from:
___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke214 in Parse(PFObject.o)
___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke311 in Parse(PFObject.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I deleted the link to the Facebook one and tried dragging the Parse one, but the error persisted. I also got the warning that
ld: warning: ignoring file /Users/milesper/Documents/FacebookSDK/Bolts.framework/Bolts, missing required architecture x86_64 in file /Users/milesper/Documents/FacebookSDK/Bolts.framework/Bolts (2 slices)
even though I had deleted the file from the Facebook SDK.
How should I clean up the project and link to the Parse version of Bolts? Is there something else i should be doing?
Turns out the order in which you include/search the frameworks in your project matters.
Here is what I did to work with Parse 1.6.4 and FacebookSDK without CacoaPods
Use the latest version of Bolts. (1.1.4)
Your include paths should be ordered to find Bolt first, then FacebookSDK, then Parse
Well I found it. The problem was that old files (which were now deleted) were being referenced in the "Library Search Paths Flag". Thanks to this post for giving me the idea. All I had to do was delete the old paths and it now works again.
EDIT: It appears that for some situations the order of the search paths matters as well (see below).
That worked for me Temporary workaround for Parse 1.6.4 and Facebook SDK 3.23
Add to your AppDelegate.m or another class following constant after imports and before implementation section:
NSString *const BFTaskMultipleExceptionsException = #"BFMultipleExceptionsException";
The explanation of the bug https://stackoverflow.com/a/29136507/1345244
One hack I found for working around missing symbols, was just redefining the missing symbol again in my code.
The BFTaskMultipleExceptionsException string is defined here like this:
NSString *const BFTaskMultipleExceptionsException = #"BFMultipleExceptionsException";
So maybe just try putting that one line into your code?
From the history on github, it looks like this was just added to Bolts about 19 days ago. Version 1.1.4 of Bolts was released 14 days ago (1.1.3 was from October last year). So it probably is caused by the version mismatch of Bolts that you noticed.
Another option might be to get an older version of Parse from before Bolts 1.1.4 was released.
Presumably this will be fixed once a new Facebook SDK is available with Bolts 1.1.4.
same problem here.
I had both frameworks included with no problem, until I added SponsorPay SDK which needs to add the -ObjC in "Other Linker Flags" on target "Build Settings".
So, in my experience this issue only happens when the flag -ObjC is present.
I tried all the solutions exposed in here but nothing worked for me, I hope anyone can bring more light on how to solve this issue even with the -ObjC flag active.
EDIT:
There's a question related to this, I'll put the link here in case is helpful to someone: Contradicting frameworks on -ObjC
i had some issue, i just remove Parser.framework in
Linked Framework and Libraries and work well.

Unity build to xcode with gives error: Apple Mach-O Linker

I tried to google for the solution. I tried to delete the DerivedData folder but it still doesn't work... Why is this still happening? I am using Xcode version 6.2. Thanks.
Edit: Under the one error has 70 different errors saying various things. There is a warning saying
ld: warning: ignoring file /Users/Kevin Chen/Desktop/Parking Director/Libraries/libiPhone-lib.a, missing required architecture arm64 in file /Users/Mushrooms4Eva/Desktop/Parking Director/Libraries/libiPhone-lib.a (2 slices)
All of the following links and solutions did not work for me:
https://teamtreehouse.com/forum/apple-macho-linker-error-xcode-61
Apple Mach-O Linker Error when compiling for device
Sounds like your library libiPhone-lib.a is not compiled for arm64, but your project is set to be compiled for this architecture.
I think all the errors are triggered by this "warning" as the library is ignored, and therefore you may have a lot of missing references.
Your options:
Get a version of the lib compiled for arm64, or do it yourself, if you have the code
Remove arm64 architecture from your project (which I don't recommend, as you'll need to provide an 64bit build for the App Store, but that's another story)
How to make 64bit builds (available from Unity 4.6.2+)
iOS platform
Other Settings
Scripting Backend => IL2CPP
Architecture => Universal (to target both 32 and 64 bit)
How to build for simulator
Player Settings
iOS platform
SDK Version => Simulator SDK

ld: library not found for (on Simulator only)

Suddenly began getting this error when running my app on iOS 7 Simulator.
ld: library not found for -lacmobileshim
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
On Device this problem doesn't happen and the app runs OK.
Have already searched for this library inside SDK but couldn't find it. Have no idea what's going on cause it was running OK both on Simulator and Devices before and haven't added any additional library to my project.
Is there a way to set Library Search Path in Build Settings just for this library?
Should reinstall SDK be a workaround?
These are the libraries i'm including in my project:
After get the same headache as updated to Xcode 6/iOS 8 sdk, just found a simple way to solve this issue with libacmobileshim.dylib and also other dynamic libraries that were causing the same problem when building the app on simulator. Just delete the dynamic libraries from Build Phases settings and the app is running perfectly again on simulator. Hope it may help someone with the same problem.
libacmobileshim.dylib is in the iOS Device SDK, but it is not in the simulator SDK. External developers should have no need for this library, so I'm confused as to why you're linking against it.
Looking at that list of libraries that you're linking against, I suspect a bunch of them aren't even needed by your project. You should audit that list and eliminate unnecessary linkage.

Undefined symbols for architecture armv7 - Static Library

I'm from Argentina and my English is very limited. Sorry about that.
I tell them about my problem:
I downloaded the SDK for iOS Hikvision cameras from this link: http://www.hikvision.com/en/download_more.asp?id=1207
This includes static library file called "libPlayCtrl.a" and two headers "ApplePlayM4.h" & "PlayM4.h"
The problem is that to include the library in my project, I get the error:
"Undefined symbols for architecture armv7"
I followed the suggestions in this link: Undefined symbols for architecture armv7 and I could not compile the project in any way.
Has anyone worked with this program and can help me?
Thank you.
This question was posted awhile ago. I recently attempted to integrate the HikVision iOS Player SDK for a project as well. I ran into similar errors, symbols not defined for armv7 architecture, as well as a few others. The HikVision documentation for the sdk does not give you the dependent libraries for clean and easy integration. I have included the following libraries, CoreAudio, CoreVideo, AudioToolbox, and OpenAL, as well as the libstdc++.6.0.0.dylib. With all these included in a test project within my environment using XCode 7 with iOS 9 via swift. I created a bridging header (because of swift), imported the ApplePlayM4.h and was able to call the PlayM4_GetPort method. Please note the HikVision library is only compiled for device architectures, amrv7/armv64 and not i386 that is why it won't work in the simulator and only on a physical device.

Resources