Search code examples
xcodecocoapodsxcodebuild

CocoaPods Podspec: Dependency declared, but file not found during build


I'm trying to make a new Podspec for the WLXBluetoothDevice project. I'm stuck at pod spec lint. I've declared its one dependency in the podspec file:

s.dependency 'CocoaLumberjack'

(... oddly enough if I include the current version in that declaration, lint fails quickly saying it can't fulfil the dependency.)

When I call pod spec lint, xcodebuild is triggered, and fails:

** BUILD FAILED **


The following build commands failed:
    CompileC /var/folders/yz/xbdghvnj1_7fhsrwl5v232b40000gn/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/WLXBluetoothDevice.build/Objects-normal/i386/WLXBluetoothDeviceLogger.o WLXBluetoothDevice/WLXBluetoothDevice/WLXBluetoothDeviceLogger.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
 -> WLXBluetoothDevice (0.6.1)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
    - NOTE  | xcodebuild:  WLXBluetoothDevice/WLXBluetoothDevice/WLXBluetoothDeviceLogger.h:12:9: fatal error: 'CocoaLumberjack/CocoaLumberjack.h' file not found

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error.

I've installed to another project using the pod successfully... so it just seems to be the lint build that's not happy about this. Any suggestions?


Solution

  • I used the format described in this answer to fix the issue: https://stackoverflow.com/a/23457452/2799670

    Instead of the dependency described in the question, I declare a subspec for the dependency as follows:

      s.subspec "CocoaLumberjack" do |ss|
          ss.dependency "CocoaLumberjack", "~> 2.2.0"
          ss.xcconfig = { "FRAMEWORK_SEARCH_PATHS" => "$(PODS_ROOT)/CocoaLumberjack"}
      end