Undefined symbols for architecture armv7: "std::__1::__libcpp_debug_function" - boost

I'm trying to build my app with Xcode 9.0 beta 2 for iOS 11. The problem is the linker fails to find this __libcpp_debug_function definition. Do you have a workaround?
UPDATE: The project had _LIBCPP_DEBUG=0 preprocessor macro defined. When I remove it, it links successfully. Anyway, I still wonder why this linker error occurs when _LIBCPP_DEBUG=0 is defined.

Related

Native linking failed after upgrading to Xcode 11

I upgraded from Xcode 10.2 to Xcode 11 and encountered the following linker error.
Native linking failed, undefined Objective-C class: CTTelephonyNetworkInfo. The symbol '_OBJC_CLASS_$_CTTelephonyNetworkInfo' could not be found in any of the libraries or frameworks linked with your application.
I used the Xamarin.Essential Connectivity module as follow:
result = (Connectivity.NetworkAccess == NetworkAccess.Internet);
There is a change in CTTelephoneNetworkInfo in iOS (https://learn.microsoft.com/en-us/xamarin/ios/release-notes/api-changes/ios-12-14-0-12-99-4)
Could this be the issue? Thanks.
After troubleshooting for 3 days by stripping down the code, nuget packages etc, the cause of "Native linking failed" is the binding library (dll) created and used in the project. I just need to recompile the binding library (a separate project) using Xcode 11 and transfer the new dll into the current project.

Binding a static library into a Xamarin iOS project

I've decided to take a step back and just try to get a very simple proof of concept to work.
I've progressed a little further thanks to one of the Xamarin Lightning Lectures around this topic. I’ve been following this tutorial:
https://university.xamarin.com/lightninglectures/ios-bindings-in-cc
Here’s what I’ve done so far:
1) I have a simple C file “example.c” with 3 functions: addOne(int n), subtractOne(int n), get_time()
2) As shown in the tutorial, I used SWIG to create a C wrapper class - “example_wrap.c” (along with the C# wrapper classes).
3) I created the static library in Xcode and built a FAT binary with all architectures (lipo used to combine libs).
The tutorial talks about creating 2 projects - one with the C# wrapper classes and the other a single view iOS app. The iOS project has the libexample.a static library(as a BundledResource). Everything was going well until trying to build the iOS app. I can't get the iOS app to compile. I've removed any calls to the static library for now to isolate the issue....I'm just trying to get it to compile and link correctly. So all I have now is just a blank iOS app with the bundled static library. But I'm still having problems.
I have the following added to the mtouch arguments:
-cxx -gcc_flags "-L${ProjectDir} -lexample -force_load ${ProjectDir}/libexample.a"
When compiling, I get these errors:
Undefined symbols for architecture x86_64:
"subtractOne(int)", referenced from:
_CSharp_subtractOne in libexample.a(example_wrap.o)
"addOne(int)", referenced from:
_CSharp_addOne in libexample.a(example_wrap.o)
"get_time()", referenced from:
_CSharp_get_time in libexample.a(example_wrap.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 double checked the symbols in the libexample.a file by running “nm -arch x86_64 libexample.a” from the command line. It appears that all the symbols are listed for that architecture.
Here’s a link to the zip file with my libexample.a and C files:
https://drive.google.com/open?id=0B2WtJ38rvldKYmlZckU3QjNBeUE
I’m sure this is just a configuration error but I can’t seem to pinpoint where I’m going wrong.
Thanks.
I thought I'd answer my own question here - after getting some help from Xamarin support, it looks like I might have mixed up how I created the static library - I had to make sure the files were compiled as 'C' files, instead of C++. After I generated the static library correctly, the compiler was able to recognize the missing symbols.

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

iOS AudioQueueNewInput function - how to link it in?

I am trying to use AudioQueueNewInput, which is supposed to be in framework AudioToolbox. When I add AudioToolbox to my project and try to build, I get warnings to the effect that file /AudioToolbox.framework/AudioToolbox is being ignored because it missing both architectures armv6 and armv7, and errors because the referenced function _AudioQueueNewInput is not defined.
If I remove the framework, I just get the undefined symbol errors.
Can anyone suggest what I am doing wrong?
I figured it out, by comparing with Apple's "Speak Here" demo app. I had used a path to a 2009 version of the toolbox to add it to the project, whereas I needed a path to the March 6, 2011 version.

XCode linking error when targeting armv7

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

Resources