0

After update to Xcode 12 project would no longer build.

undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_DDLog", referenced from:
      objc-class-ref in Bouncer.o
ld: symbol(s) not found for architecture x86_64

DDLog is defined in CocoaLumberjack. which is a dependency of FrameworkA which is a dependency of FrameworkB (the Test Project)

Podspec extract FrameworkA:

Pod::Spec.new do |s|
    [...]
  
  s.default_subspec = 'Core'
  
  s.subspec 'Core' do |co|
      co.source_files = 'FrameworkA_Objc_DependencyIssue/Classes/**/*'
      co.dependency 'CocoaLumberjack', '~> 3.1'
  end
end

Podspec extract FrameworkB:

Pod::Spec.new do |s|
  [...]

  s.source_files = 'FrameworkB_Objc_DependencyIssue/Classes/**/*'
  s.dependency 'FrameworkA_Objc_DependencyIssue/Core', '~> 0.1.2'
#  s.dependency 'CocoaLumberjack' # Adding direkt dependency fixes problem!
end

This setup does compile with Xcode 11.

clauswey
  • 1,706
  • 1
  • 12
  • 15
  • you can check my demo projects that show this problems here:https://github.com/cweymann/FrameworkB , https://github.com/cweymann/FrameworkA – clauswey Sep 23 '20 at 10:12

2 Answers2

1

It seems that it was a "bug" that this would compile in Xcode 11. Adding the dependency to FrameworkB solves the issue (see comment in podspec extract FramworkB of updated question)

clauswey
  • 1,706
  • 1
  • 12
  • 15
  • Thanks for the solution, this worked for me as well, is there any specific changes in Xcode 12 w.r.t to dependency? just wanted to understand more about the cause of the issue. Please share if you have any doc regarding this fix. – Prasad Devadiga Oct 05 '20 at 09:03
  • I am still facing the same problem. By Xcode and CocoaPods are updated. Any suggestions? Thanks! – Tulon Mar 17 '21 at 05:39
1

First Way: To do that, navigate to Build Settings of your project and add Any iOS Simulator SDK with value arm64 inside Excluded Architecture

or

If you are using custom XCConfig files, you can simply add this line for excluding simulator architecture.

EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64

Second Way : You can manually add the Excluded Architecture in your Pod project's Build Settings, but it will be overwritten when you use pod install.

In place of this, you can add this snippet to your Podfile. It will write the necessary Build Settings every time you run pod install

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings[‘EXCLUDED_ARCHS[sdk=iphonesimulator*]’] = ‘arm64’
  end
end

Please try and let me know if it helps

Virajkumar Patel
  • 1,533
  • 12
  • 19
  • Thanks for your suggestion. Didn't work for me, but i think it might help with a similar looking problem as that is described in https://stackoverflow.com/questions/63391793/xcode-12-build-target-in-wrong-order which i stumbled upon when looking for a solution to my problem. But I'll add more information to my question so it is reproducible for others. – clauswey Sep 23 '20 at 10:04
  • This is exactly what I am looking for. In my case I need my pod to be compiled with M1 Xcode 13 iOS Simulator. Thank you. – uspython Dec 30 '21 at 10:44