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

Already on GitHub? Sign in to your account

Pods.xcodeproj causes build error with `xcodebuild -target Pods' since CocoaPods v0.21.0 #1165

Watson1978 opened this Issue Jul 3, 2013 · 8 comments


None yet
4 participants

If I build the library using Pods.xcodeproj with xcodebuild -target Pods,
it will causes build error since CocoaPods v0.21.0.

  • Podfile
platform :ios
pod 'JSONKit'
  • Reproduce
% gem install cocoapods -v '= 0.21.0'
% pod install
% cd Pods
% xcodebuild -target Pods
---- snip ----
Libtool build/Pods.build/Release-iphoneos/Pods.build/Objects-normal/armv7s/libPods.a normal armv7s
    cd /Users/watson/tmp/TestCocoaPods_v0.21/Pods
    setenv PATH "/Applications/Xcode5-DP2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode5-DP2.app/Contents/Developer/usr/bin:/Users/watson/.rbenv/shims:/Users/watson/.rbenv/bin:/usr/local/bin:/usr/bin:/Users/watson/bin:/Users/watson/bin/rsense:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/watson/.rvm/bin"
    /Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7s -syslibroot /Applications/Xcode5-DP2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/watson/tmp/TestCocoaPods_v0.21/Pods/build/Release-iphoneos -filelist /Users/watson/tmp/TestCocoaPods_v0.21/Pods/build/Pods.build/Release-iphoneos/Pods.build/Objects-normal/armv7s/Pods.LinkFileList -framework Foundation -lPods-JSONKit -o /Users/watson/tmp/TestCocoaPods_v0.21/Pods/build/Pods.build/Release-iphoneos/Pods.build/Objects-normal/armv7s/libPods.a
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-JSONKit
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-JSONKit is not an object file (not allowed in a library)
Command /Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1


The following build commands failed:
    Libtool build/Pods.build/Release-iphoneos/Pods.build/Objects-normal/armv7/libPods.a normal armv7
    Libtool build/Pods.build/Release-iphoneos/Pods.build/Objects-normal/armv7s/libPods.a normal armv7s
(2 failures)

Looks like Pods.xcodeproj is missing the Target Dependencies.
If I added Target Dependencies in Pods target,
the above command is possible to build with success.


alloy commented Jul 3, 2013

Confirmed with Xcode 4.6.1.

So it appears that implicit dependencies in a xcodeproj that’s not in a xcworkspace only work when building from ‘Xcode.app’, but fails when building with ‘xcodebuild’.

Since opening the project with ‘Xcode.app’ is not a real option for RubyMotion, I think that the target dependencies should indeed be hardcoded in the ‘xcodeproj’ document.

@Watson1978 Is this something you want to create a patch for? We can help you out with any guidance you’d need.

/cc @irrationalfab @jasl8r

If I added the following description manually into Pods target section in Pods.xcodeproj/project.pbxproj,
Pods target has Target Dependencies and xcodebuild -target Pods works fine.

diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj
index 09fb628..0193b52 100644
--- a/Pods/Pods.xcodeproj/project.pbxproj
+++ b/Pods/Pods.xcodeproj/project.pbxproj
@@ -810,6 +810,17 @@
+           <key>dependencies</key>
+           <array>
+               <string>A94914981784633300E9E1D3</string> <!-- PBXTargetDependency -->
+           </array>
+       </dict>
+       <key>A94914981784633300E9E1D3</key> <!-- PBXTargetDependency -->
+       <dict>
+           <key>isa</key>
+           <string>PBXTargetDependency</string>
+           <key>target</key>
+           <string>7D9E2B926CF64A39A298B512</string> <!-- Pods-JSONKit -->

There is a way to change like the above in CocoaPods ?


alloy commented Jul 3, 2013

Probably the code using the target installer, or the target installer itself, should use this to add the dependencies.


alloy commented Jul 3, 2013

I have pinged @irrationalfab to see if he has time to provide a bit more details, otherwise I will do so later today.


jasl8r commented Jul 3, 2013

This makes sense since all the targets are in the same project. On a related note, how are the implicit deps handled for the main libPods.a in the user project for something like a CI build, do you have to use a shared scheme? If so, explicit deps here is certainly much lighter than creating a workspace and shared schemes just to build the Pods lib, so this makes sense to me.

You would want to do this in link_aggregate_target I think.


alloy commented Jul 3, 2013

On a related note, how are the implicit deps handled for the main libPods.a in the user project for something like a CI build, do you have to use a shared scheme?

Yup. The reason we haven’t changed this is because to me this is a (UX) bug. xcodebuild should be able to build the same things as Xcode.app. I’m filing a radar ticket about this right now.


fabiopelosin commented Jul 3, 2013

Xcode appears to set up other information that the current implementation (after editing the project in the UI) and the patch needs some more love (tests).

However as Xcode still builds fine I'm releasing it as it is, given that it doesn't appears to hurt. Please let me know whether the issue is actually fixed.

Thank you for fixing this issue 😄

@jzapater jzapater pushed a commit to jzapater/CocoaPods that referenced this issue Sep 17, 2013

@keith keith Merge pull request #1165 from jparise/AFHTTPClientLogger-0.5.0
Add AFHTTPClientLogger version 0.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment