ld: symbol(s) not found for architecture i386 Xcode unit tests - xcode

I am getting this error when I try to run my unit tests. The entire error is:
Undefined symbols for architecture i386:
"_CGImageRelease", referenced from:
_releaseImages in UIImage+animatedGIF.o
"_CGImageSourceCopyPropertiesAtIndex", referenced from:
_delayCentisecondsForImageAtIndex in UIImage+animatedGIF.o
"_CGImageSourceCreateImageAtIndex", referenced from:
_createImagesAndDelays in UIImage+animatedGIF.o
"_CGImageSourceCreateWithData", referenced from:
+[UIImage(animatedGIF) animatedImageWithAnimatedGIFData:] in UIImage+animatedGIF.o
"_CGImageSourceCreateWithURL", referenced from:
+[UIImage(animatedGIF) animatedImageWithAnimatedGIFURL:] in UIImage+animatedGIF.o
"_CGImageSourceGetCount", referenced from:
_animatedImageWithAnimatedGIFImageSource in UIImage+animatedGIF.o
"_kCGImagePropertyGIFDelayTime", referenced from:
_delayCentisecondsForImageAtIndex in UIImage+animatedGIF.o
"_kCGImagePropertyGIFDictionary", referenced from:
_delayCentisecondsForImageAtIndex in UIImage+animatedGIF.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did all the instructions here:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
Also added the library to "Compile Sources" in Build Phrases of the test target. Still no luck.

Looks like you need to add "CoreGraphics.framework" and "ApplicationServices.framework" to your unit test target membership.
Here's how it's done for a file:
Just go to "CoreGraphics.framework" in the list of files and folders on the left side and make certain the checkmark is "ON" for the unit tests target.

Go to build phases of target, Add ImageIO.framework

Related

Undefined symbols for architecture arm64: previous solution doesn't work in Xcode 12.5.1

I am working on a flutter project. My project includes tflite and amplify packages. it works fine with android but whenever I try to build it in Xcode I am getting this following errors:
Undefined symbols for architecture arm64:
"OBJC_CLASS$_FlutterStandardTypedData", referenced from:
objc-class-ref in tflite(TflitePlugin.o)
enter code here
"_FlutterMethodNotImplemented", referenced from:
-[TflitePlugin handleMethodCall:result:] in tflite(TflitePlugin.o)
"OBJC_CLASS$_FlutterMethodChannel", referenced from:
objc-class-ref in tflite(TflitePlugin.o)
"OBJC_METACLASS$_FlutterAppDelegate", referenced from:
OBJC_METACLASS$_AppDelegate in AppDelegate.o
"OBJC_CLASS$_FlutterAppDelegate", referenced from:
OBJC_CLASS$_AppDelegate in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help me with this. I have been stuck with this issue for more than a week now. Thank you.
I have added a snippet from Xcode which shows the current settings for Architectures. There are past suggestions to add arm64 as a Valid architectures. However, as you see there is no option for that. I added arm64 in excluded architectures as shown in the picture. It didn't work for me.

How do I compile tree-sitter parsers?

I'm trying to compile the typescript, tsx, and python parsers for use with neovim, but when I run gcc -o parser.so -shared src/parser.c -Os -I./src as instructed by the tree-sitter tracking issue I get:
Undefined symbols for architecture x86_64:
"_tree_sitter_tsx_external_scanner_create", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_deserialize", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_destroy", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_scan", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_serialize", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.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've run the npm build steps, and tried the make file in build, but I'm not able to get the final .so files.
the error undefined symbol: tree_sitter_parsername_external_scanner_create also appears, when there is a mismatch between parser name and function names
// grammar.js
name: 'parsername',
// scanner.cc
void *tree_sitter_oldparsername_external_scanner_create() {
return new Scanner();
}
quickfix: replace name in scanner source
sed -i -E 's|(tree_sitter)_oldparsername_|\1_parsername_|g' src/scanner.*
Some grammars have external scanners - hand written C/C++ source files that are by convention called scanner.c or scanner.cc, which need to be compiled along with parser.c.

Undefined Symbol for architecture i386 armv7, armv7s MedioEvent k-invite sdk

I have tried removig the following error by following many solutions here and on other forums.
Undefined symbols for architecture armv7:
"_kABPersonPhoneProperty", referenced from:
+[InviteHelpers findPhoneNumbersForContact:] in libMedioEvent.a(InviteHelpers.o)
"_ABPersonCopyArrayOfAllLinkedPeople", referenced from:
_CopyValuesFromLinkedContact in libMedioEvent.a(InviteHelpers.o)
"_ABMultiValueCopyLabelAtIndex", referenced from:
_CopyValuesFromLinkedContact in libMedioEvent.a(InviteHelpers.o)
"_ABMultiValueAddValueAndLabel", referenced from:
_CopyValuesFromLinkedContact in libMedioEvent.a(InviteHelpers.o)
"_ABMultiValueCopyValueAtIndex", referenced from:
+[InviteHelpers findEmailsForContact:] in libMedioEvent.a(InviteHelpers.o)
+[InviteHelpers findPhoneNumbersForContact:] in libMedioEvent.a(InviteHelpers.o)
_CopyValuesFromLinkedContact in libMedioEvent.a(InviteHelpers.o)
+[InviteHelpers findContactTwitter:] in libMedioEvent.a(InviteHelpers.o)
I have already included the MedioEvent SDK and its precompiled source in the project, and also included it in Framework and Library search paths. What bothers me is that it is coming from inside libMedioEvent.o.
Do I have to include "InviteHelpers" sdk as well?

Linking to libiconv

I've created a clean build of libmariadbclient and integrated it into my project. Whenever I try to build said project I fail with an error:
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_mariadb_convert_string in libmariadbclient.a(my_charset.c.o)
"_libiconv_close", referenced from:
_mariadb_convert_string in libmariadbclient.a(my_charset.c.o)
"_libiconv_open", referenced from:
_mariadb_convert_string in libmariadbclient.a(my_charset.c.o)
ld: symbol(s) not found for architecture x86_64
I then add libiconvlib.dylid to my project, cleaned it and tried to build again, but I still get the same error. Any ideas?
I filed a bug report with the developers and the issue was promptly fixed.

Zxing 'undefined symbols for architecture x86-x64' error

I use zxing lib in my OS X application. I've included zxing-objc to my project and simply copy-pasted code from zxing demo (zxing-root/objc/examples/demo) to the separate ViewController class. When trying to compile project, I get the following linker errors:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_QTCaptureDevice", referenced from:
objc-class-ref in ScanViewController.o
"_OBJC_CLASS_$_ZXCapture", referenced from:
objc-class-ref in ScanViewController.o
"_QTMediaTypeMuxed", referenced from:
-[ScanViewController performVideoSourceScan] in ScanViewController.o
"_QTMediaTypeVideo", referenced from:
-[ScanViewController performVideoSourceScan] in ScanViewController.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've carefully checked all code and compared my project properties (including c++ compiler options) to demo project properties, and everything is done right.
You need to add the necessary frameworks to your app target. You can look in the sample app for an example. Select the target in Xcode, select Build Phases, and open the Link With Libraries entry. You'll see that it includes both QuartzCore and zxing-objc-framework. It sounds like you don't have those in your project.

Resources