Cocoapods: ld: library not found for -lPods-[appName]

Created on 19 Nov 2018  路  15Comments  路  Source: CocoaPods/CocoaPods

Have issue only when do Archive (opening xcode with AppName.xcworkspace)
ld: library not found for -lPods-[appName]

This solution helps
https://stackoverflow.com/questions/24078597/cocoapods-ld-library-not-found-for-lpods-projectname/24100063#24100063

But is it normal that i always need to clean
grep -n 'libPods-[appName].a in Frameworks' './ios/AppName.xcodeproj/project.pbxproj'
after pod install ?
and also have issues with this in CI

easy confirmed defect

Most helpful comment

I have this issue too.

Running Pod install generates a liPods-[appName].a in Frameworks that is not needed and have to be manually removed.

All 15 comments

I have this issue too.

Running Pod install generates a liPods-[appName].a in Frameworks that is not needed and have to be manually removed.

Please add a sample project that reproduces the issue

I also having this issue with custom build configuration ( not Debug or Release ) on React Native. It also may be related to how React Native handling schemes and build configurations.

There has been quite a few issues related to cocoapods and react-native opened in several react-native modules, e.g. the react-native-svg repo (of which i'm the current maintainer) such as this one: https://github.com/react-native-community/react-native-svg/issues/621

Seems that to get archive to work correctly in xcode, it requires something like this:

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

@sercanov you might want to try that. There's even an article about it: https://sandstorm.de/de/blog/post/react-native-managing-native-dependencies-using-xcode-and-cocoapods.html

@segiddins Is there anyone in the cocoapods team who could help simplify the process for react-native developers? Or is it possible to simplify the setup outlined in e.g. that article?

I can probably provide a minimal sample. Requires running react-native init NewProjectName, setting up cocoapods, adding e.g. react-native-svg, running pod install again, and then either archive is broken (even more so if used in combination with react-native link for dependencies which are adapted to cocoapods), or starting from xcode is broken, or starting from the cli is broken.

Would be great to have a clean cocoapods setup where archive works, and starting the project from both xcode and the cli works with the same target (not currently possible without that hack afaik).

Got a fix for this long standing issue. PR soon.

PR out.

@dnkoutso Excellent! How can I test this?

It hasnt been merged yet and it will only perform a clean up for old integrated references. Hoping its the same thing/fix as you want.

Once it gets merged (or even now) you can use https://bundler.io/v1.12/git.html to point to a specific branch for a gem.

To me this issue occurs when someone switches from frameworks<=>static libraries or decides to switch a target from inherit! :search_paths to not use this. I am hoping its the same issue here.

Alright, I haven't been poking with cocoapods much, can bundler be used to override the globally installed version? Btw, I guess you're not using this in any codebase involving ReactNative?

Btw, I guess you're not using this in any codebase involving ReactNative?

No but from the StackOverflow link this has been a long standing bug in CocoaPods and I was able to reproduce and add a test for it. Hoping this is the same issue with RN.

I haven't been poking with cocoapods much, can bundler be used to override the globally installed version?

Yes bundler should just override the global one...you will need to use bundle exec pod install etc for the bundle to be used.

I tried using this:

gem 'cocoapods', :git => 'https://github.com/dnkoutso/CocoaPods.git', :ref => '77be91d3d9b451bb438f5c1935d9e3814e630ab7'

But got:

NoMethodError - undefined method `swift_versions' for #<Pod::Specification name="DoubleConversion">
Did you mean?聽 swift_version
聽聽聽聽聽聽聽聽聽聽聽聽聽聽 swift_version=

So, I tried using the latest cocopods core dependencies from their master branches as well:

def cp_gem(name)
  url = "https://github.com/CocoaPods/#{name}.git"
  opts = { :git => url, :branch => 'master' }
  gem name, opts
end

cp_gem 'cocoapods-deintegrate'
cp_gem 'cocoapods-downloader'
cp_gem 'cocoapods-plugins'
cp_gem 'cocoapods-search'
cp_gem 'cocoapods-stats'
cp_gem 'cocoapods-trunk'
cp_gem 'cocoapods-try'

But still the same: https://github.com/msand/RN059/commit/82fa7e885996553d522b4d4f44b1ee886e16abc7

@dnkoutso Any suggestions?

A few more core dependencies from the master branch seems to resolve that error:

def cp_gem(name, repo_name)
  url = "https://github.com/CocoaPods/#{repo_name}.git"
  opts = { :git => url, :branch => 'master' }
  gem name, opts
end

cp_gem 'claide',                'CLAide'
cp_gem 'cocoapods-core',        'Core'
cp_gem 'cocoapods-deintegrate', 'cocoapods-deintegrate'
cp_gem 'cocoapods-downloader',  'cocoapods-downloader'
cp_gem 'cocoapods-plugins',     'cocoapods-plugins'
cp_gem 'cocoapods-search',      'cocoapods-search'
cp_gem 'cocoapods-stats',       'cocoapods-stats'
cp_gem 'cocoapods-trunk',       'cocoapods-trunk'
cp_gem 'cocoapods-try',         'cocoapods-try'
cp_gem 'molinillo',             'Molinillo'
cp_gem 'nanaimo',               'Nanaimo'
cp_gem 'xcodeproj',             'Xcodeproj'

Now pod install and adding rnsvg worked fine. Building to see that it all works out.

All kinds of issues with react-native still but probably because of bad integration from their side. Will look at it more when I have more time available.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dawnnnnn picture dawnnnnn  路  3Comments

k06a picture k06a  路  3Comments

evermeer picture evermeer  路  3Comments

gerchicov-bp picture gerchicov-bp  路  3Comments

steffendsommer picture steffendsommer  路  3Comments