Undefined Symbols For Architecture Arm64

Undefined symbols for architecture arm64

If your Architectures and Valid Architectures are all right, you may check whether you have added $(inherited) , which will add linker flags generated in pods, to Other Linker Flags as below:
Sample Image

Undefined symbols for architecture arm64: Xcode 12

I found the issue.

My project supports lower minimum deployment target than the framework, and that caused the issue. I had to include the framework starting from a specific iOS version.

Here is the scenario and the issue: my project supports iOS 9 and the framework supports starting from 9.1. For that reason I was not getting the latest framework, instead Cocoapods was downloading the older version of the framework which doesn't support arm64.

So for the time being I just included the framework only for iOS 9.1 and above:

platform :ios, '9.1'
pod 'PodName', '~> 3.2'

Then the project compiled properly, thanks for those who tried to help. I spent half day because of this and Im putting this here for anyone who might face the same problem.

Symbol(s) not found for architecture arm64 - XCode

For react-native 0.67+: After a lot of research, I found the next solution from Vegaro:

SOLUTION LINK

First step is to upgrade the react-native-purchases by Revenuecat package to the latest version.

Clean your pods:
REFERENCE LINK TO PROPERLY CLEAN PODS

Declare a pods post install process:
Add the next to your Podfile:

 post_install do |installer|
react_native_post_install(installer)
fix_library_search_paths(installer)
end
end

def fix_library_search_paths(installer)
def fix_config(config)
lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
if lib_search_paths
if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
# $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
# since the libraries there are only built for x86_64 and i386.
lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
# however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
end
end
end
end

projects = installer.aggregate_targets
.map{ |t| t.user_project }
.uniq{ |p| p.path }
.push(installer.pods_project)

projects.each do |project|
project.build_configurations.each do |config|
fix_config(config)
end
project.native_targets.each do |target|
target.build_configurations.each do |config|
fix_config(config)
end
end
project.save()
end
end

Undefined symbols for architecture arm64 - What does this mean?

Undefined symbol means that the symbols is declared but not defined.

For example in the class definition you have the following member function without parameters

void addGrowth();

But then you defined a function with the same name but now with one parameter

void Plant::addGrowth(int x) {
plantSize += x;
cout << "You have added " << x << " leaves to your plant. Well done!";
}

So the function declared in the class definition Plant is still undefined.

Also there is no definition of the constructor

 Plant(string x, int y);

in the provided by you code.

And if you are using the name string from the standard library in the header plant.h then you need to include the header <string>

#include <string>

Undefined symbols for architecture arm64 using g++ compiler

My guess is that you have missed to add vector2d.cpp to your project. After adding that (with whatever build system you use) the errors should go away.

The errors indicate that the compiler tries to link the program without the symbols from that file present.

I cannot help with exactly how to add it since it is not specified in the question how the project is built, but if you would like to just compile from terminal it could be as simple as

g++ main.cpp vector2d.cpp -o program_name
## ^---- this was probably missing


Related Topics



Leave a reply



Submit