-1

Okay so I was solving an issue regarding duplicate symbols in cocoa pods' architecture. After getting the pods installed with the post_install in the accepted solution, I build my xcworkspace project and I run into the following error:

Screenshot of location of file and error.

The error is: Expected end of line in preprocessor expression.
On the line: #if HAVE_FULLFSYNC
In the method: SyncFd(int fd, const std::string& fd_path)
And the location of the file is: Pods/Pods/leveldb-library/env_posix.cc

The Pod I added which started this series of issues is 'CodableFirebase' from here.

And this is my Podfile:

platform :ios, '13.2'

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited), PodsDummy_Pods=SomeOtherNamePodsDummy_Pods'
        end
    end
end


target 'ShoeSwiperMenus' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for ShoeSwiperMenus
# add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod ‘FirebaseUI/Auth'
pod 'FirebaseUI/Google'
pod 'FirebaseUI'
pod 'MaterialComponents/Buttons'
pod 'MaterialComponents/Buttons+Theming'
# pod 'MaterialComponents/schemes/Color'

pod 'Shuffle-iOS'
pod 'JGProgressHUD'
pod 'LBTATools'
pod 'CodableFirebase'

end

When removing the post_install block, I backtrack onto my original error which is:
ld: 202 duplicate symbols for architecture x86_64.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm really out of my depth here... I don't even know how to start solving this (nothing on Google). Please help!

  • Welcome to SO. Please read https://stackoverflow.com/help/minimal-reproducible-example. In this case, at least provide your Podfile. – Gereon Apr 23 '20 at 10:33
  • Not sure how to make the question more complete or reproducible... I don't know what triggers the error in the first place – Antoine Neidecker Apr 23 '20 at 10:49
  • Did you get anywhere with this? I suspect you were running into similar problems that I am getting now https://stackoverflow.com/questions/70855053/swift-package-manager-spm-and-cocoapod-dependency-conflict – Michael Jan 25 '22 at 20:09

1 Answers1

0

I just added your Podfile to an empty project, got the same errors, then removed the post_install block and was able to build without errors.

So, remove the post_install block. Whatever problem it supposedly solves, it creates this one.

Also, I would recommend adding inhibit_all_warnings! to the Podfile.

Gereon
  • 17,258
  • 4
  • 42
  • 73
  • Thank you for your answer and comments Gereon! I unfortunately need the `post_install` block. Its purpose is to remove duplicate symbols in the architecture (as explained [here](https://developerinsider.co/cocoapods-remove-duplicate-symbols-errors/)). It prevents another error I was getting when installing the CodableFirebase pod – Antoine Neidecker Apr 23 '20 at 11:29
  • Ah, `inhibit_all_warnings!`, this is a great help! – Antoine Neidecker Apr 23 '20 at 11:31
  • So I tried sparing the `leveldb-library` from the `post_install` block, but that didn't help – Antoine Neidecker Apr 23 '20 at 11:32
  • Like I said, there are no error in my project. It's also no surprise that you don't see any linker errors when the compilation step fails. – Gereon Apr 23 '20 at 11:38
  • I do see a linker error when removing the `post_install` block though... I added it at the bottom of the question. I'm really confused as to how you can build this without any errors. Is there anything else that could make it crash on my end? – Antoine Neidecker Apr 23 '20 at 11:51
  • Check your project's "Frameworks, Libraries and Embedded Content" section. Is there anything listed there except your pods framework, and in particular, anything that duplicates something from your pods? – Gereon Apr 23 '20 at 13:24