Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang: error: linker command failed with exit code 1 (use -v to see invocation) #89

Closed
alexanderkhitev opened this issue Jul 13, 2017 · 10 comments

Comments

@alexanderkhitev
Copy link

alexanderkhitev commented Jul 13, 2017

Hello! I'm using GeoFire (2.0.0) in the Swift project, after today's update pods when the project is going to Xcode shows clang: error: linker command failed with exit code 1 (use -v to see invocation) in the Geofire framework. Tell me, how can I fix this?

I install Geofire via Cocaopods as follows
pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

Update:
ld: framework not found nanopb
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@zgosalvez
Copy link

nanopb was introduced in Firebase iOS Version 4.0.4. You can set your dependency to pod 'Firebase', '4.0.3' to workaround the issue.

@alexanderkhitev
Copy link
Author

Hi @zgosalvez I set

Firebase

    pod 'Firebase/Core', '~> 4.0.3'
    pod 'Firebase/Auth', '~> 4.0.3'
    pod 'Firebase/Database', '~> 4.0.3'
    pod 'Firebase/Storage', '~> 4.0.3'
    # Push notification
    pod 'Firebase/Core', '~> 4.0.3'
    pod 'Firebase/Messaging', '~> 4.0.3'

But it doesn't help me

@alexanderkhitev
Copy link
Author

@zgosalvez I see this in the terminal

Using Firebase (4.0.4)
Using FirebaseAnalytics (4.0.2)
Using FirebaseAuth (4.0.0)
Using FirebaseCore (4.0.4)
Using FirebaseDatabase (4.0.0)
Using FirebaseInstanceID (2.0.0)
Using FirebaseMessaging (2.0.0)
Using FirebaseStorage (2.0.0)
Using GTMSessionFetcher (1.1.11)
Installing GeoFire 2.0.0 (was 2.0.0)
Using GoogleMaps (2.3.1)
Using GooglePlaces (2.3.1)
Using GoogleToolboxForMac (2.1.1)

@zgosalvez
Copy link

@alexsanderkhitev, I only altered the 'Firebase' dependency. Paste this as is, as this will tell CocoaPods to install the specific version, not a variant of it.

pod 'Firebase', '4.0.3'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
# ...

@alexanderkhitev
Copy link
Author

@zgosalvez thank you so much. Interesting situation with subsequent updates, it turns out if you use Geofire it will not work to update Firebase on versions higher than 4.0.3

@bdomok
Copy link

bdomok commented Jul 20, 2017

You can fix this by adding nanopb as a library search path for geofire in the post_install phase.
I already had to do this for GoogleToolboxForMac:

post_install do |installer|
  installer.pods_project.targets.each do |target|
  if target.name == 'GeoFire' then
    target.build_configurations.each do |config|
      config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{config.build_settings['FRAMEWORK_SEARCH_PATHS']} ${PODS_ROOT}/FirebaseDatabase/Frameworks/ $PODS_CONFIGURATION_BUILD_DIR/GoogleToolboxForMac $PODS_CONFIGURATION_BUILD_DIR/nanopb"
      config.build_settings['OTHER_LDFLAGS'] = "#{config.build_settings['OTHER_LDFLAGS']} -framework FirebaseDatabase"
    end
  end
end

@asciimike
Copy link
Contributor

Note that we're also planning on switching Firebase 4.x dependencies to the FirebaseCommunity Pod in #95

@emido
Copy link

emido commented Sep 5, 2017

I get the same error: clang: error: linker command failed with exit code 1 (use -v to see invocation)

But none of these solutions worked for me.
Is there any other way to resolve this error?

@marioqtanjr
Copy link

In addition to coli88's answer, you will also need to add leveldb-library as a framework search path:

post_install do |installer|
  installer.pods_project.targets.each do |target|
  if target.name == 'GeoFire' then
    target.build_configurations.each do |config|
      config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{config.build_settings['FRAMEWORK_SEARCH_PATHS']} ${PODS_ROOT}/FirebaseDatabase/Frameworks/ $PODS_CONFIGURATION_BUILD_DIR/GoogleToolboxForMac $PODS_CONFIGURATION_BUILD_DIR/nanopb $PODS_CONFIGURATION_BUILD_DIR/leveldb-library"
      config.build_settings['OTHER_LDFLAGS'] = "#{config.build_settings['OTHER_LDFLAGS']} -framework FirebaseDatabase"
    end
  end
end

@morganchen12
Copy link
Contributor

Closing since this has staled. If you're still having build issues, please open a new issue and I'll address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants