Xcode error: library not found for -lGoogleToolboxForMac

Charlie Seligman picture Charlie Seligman · Dec 4, 2016 · Viewed 9.1k times · Source

I am trying to install admobs in my iPhone App (written in objective-c). I have implemented this many times using swift projects, but currently I keep getting the following build error:

ld: warning: directory not found for option '-L/Users/charlieseligman/Library/Developer/Xcode/DerivedData/ThamesClippers-csissodainpbbjenykdyxuutzxtg/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: warning: directory not found for option '-L/Users/charlieseligman/Documents/GIT/iOS.ThamesClippers/build/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am definitely opening the .xcworkspace file (and not the .xcodeproj file).

I have also tried deleting 'DerivedData' folder contents & 'Cleaning' the project and doing a 'Clean Build Folder'. None has resolved the issue.

My podfile only includes the following pods:

# Pods for ThamesClippers
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/AdMob'

# Trying to fix GoogleToolboxForMac missing error
pod 'Firebase/Messaging'
pod 'GoogleToolboxForMac/Logger' 
pod 'GoogleToolboxForMac', '~> 2.1'

I have tried adding the bottom 3 one-by-one but kept getting the same build error.

Can anyone help? At a complete loss on this one. Seen these two questions but their accepted solutions have not resolved this issue:

Framework not found GoogleToolboxForMac ld: library not found for -lGoogleToolboxForMac

Answer

Charlie Seligman picture Charlie Seligman · Dec 5, 2016

Finally worked out a fix:

  1. Xcode > Product > Scheme > Manage Schemes
  2. Select to 'Show' the scheme that was failing (GoogleToolboxForMac)
  3. Select this scheme in the dropdown, just to the right of the 'Stop' button
  4. Build this scheme
  5. Then select the original scheme (in the dropdown mentioned in step 3) and rebuild

All built correctly.

So it looked like I had to build the separate scheme manually.

Note: To build these automatically, use Product > Scheme > 'Edit Scheme' > Build > And make sure all targets are added with your project target at the bottom.