Undefined Symbols for Architecture Armv7 for Cocoapods Libraries

Undefined symbols for architecture armv7: cocoaPods iPhone 5

In Xcode, hold the option key and select Product / Clean Build Folder. Then rebuild. I've had this exact problem and this "deep clean" resolves it for me.

Also, ensure that for your Pods project that the build setting for Build Active Architecture Only is set to NO.

Undefined symbols for architecture armv7 for Cocoapods libraries

It seems like you don't have $(inherited) in OTHER LINKER FLAGS. Please post output of the pod install

Undefined symbols for architecture arm64 - Cocoa Pods

You will have to check your CocoaPods projects. In Build Settings of each project, check the Architectures.

You should have:

Architectures: $(ARCHS_STANDARD)

Valid Architectures: armv7 armv7s arm64

This occurs when some projects aren't building to ARM64 when you are trying to compile to an 64bit device (like iPhone 5 or greater)

EDIT#1

You can also try setting Build For Active Architectures to YES
Like in the following image (ignore the valid architectures field in this image):

Image

Using custom cocoapod gives compile errors (Undefined symbols for architecture armv7:)

Officially answering the question I posted. I needed to do the following to fix it:

  • Link the C++ standard library: (Thanks to @H2CO3)

    • add s.library = 'stdc++' to the podspec
  • Link MediaPlayer framework: (Thanks to @H2CO3)

    • add s.frameworks = 'MediaPlayer' to the podspec
  • Issue with CAStreamBasicDescription was fixed by following the answer of: Trouble linking Tim Bolstad's Core Audio Example

Undefined symbols for architecture armv7

Common Causes

The common causes for "Undefined symbols for architecture armv7" are:

  1. You import a header and do not link against the correct library. This is common, especially for headers for libraries like QuartzCore since it is not included in projects by default. To resolve:

    • Add the correct libraries in the Link Binary With Libraries section of the Build Phases.

    • If you want to add a library outside of the default search path you can include the path in the Library Search Paths value in the Build Settings and add
      -l{library_name_without_lib_and_suffix} (eg. for libz.a use -lz) to the Other Linker Flags section of Build Settings.

  2. You copy files into your project but forgot to check the target to add the files to. To resolve:

    • Open the Build Phases for the correct target, expand Compile Sources and add the missing .m files. If this is your issue please upvote Cortex's answer below as well.

  3. You include a static library that is built for another architecture like i386, the simulator on your host machine. To resolve:

    • If you have multiple library files from your libraries vendor to include in the project you need to include the one for the simulator (i386) and the one for the device (armv7 for example).

    • Optionally, you could create a fat static library that contains both architectures.



Original Answer:

You have not linked against the correct libz file. If you right click the file and reveal in finder its path should be somewhere in an iOS sdk folder. Here is mine for example

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib

I recommend removing the reference and then re-adding it back in the Link Binary With Libraries section Build Phases of your target.

Undefined symbols for architecture, react native cocoapod issues

Posting the answer in case anyone else runs into something similar. It turns out that the linked libraries were wrong, since some may have been referencing the libraries in the React project from node_modules, while some may have been referencing the libraries from the React Pod.

Steps to fix:

  • Remove the links to React and any of the subspecs contained within the React project.
  • Remove all previously generated Pod files
  • add post install script to Podfile
  • run pod install
  • link all necessary React dependencies

Post install script:

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end

Undefined symbols for architecture armv7 when importing STATIC LIBRARY that contains OPENCV functions

There were two issues related to linking libraries:

  1. Firstly, although my subproject had the opencv2.framework
    correctly added and linked to it, I also had to add the framework
    to my main project. This way I got rid of the cv::* linking
    problems;

  2. The second issue was related to my cross-compiling Objective-C++ configuration. Since I was using libc++ as my Standard Library, I had to add -lc++ to my Other Linker Flags. In case you are using libstdc++ as your Standard Library, you should add -lstdc++ instead.

After those changes, it all worked perfectly!
Good luck!



Related Topics



Leave a reply



Submit