Cocoapods: Compile the workspace with xcodebuild

Created on 25 May 2012  路  13Comments  路  Source: CocoaPods/CocoaPods

Hi,
I would like to know if there is a way to compile to workspace in command line ?

Actually, this command line works :
xcodebuild -workspace 'Project.xcworkspace' -scheme 'Project'

The problem is that it saves the build into the DeriveData folder with a weird name.
So I tried this command line :
xcodebuild -workspace 'New Relic.xcworkspace' -scheme 'New Relic' CONFIGURATION_BUILD_DIR='build'

The problem with this one is that I always have this error :
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
* BUILD FAILED *

Do you have an idea ?

Thanks !
Jeremy.

Most helpful comment

I've had success running:

xcodebuild ... OBJROOT=$(PWD)/build SYMROOT=$(PWD)/build

Mentioned in the same link: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html

All 13 comments

We also had this issue when building from the command line. We resolved it opening and closing xcode - a bit of a hack but it worked for us.

Thank you for your help.
Actually, I installed jenkins, Xcode plugin, and it works !

Hmm, maybe because the Pods.xcodeproj is configured to install into
$(BUILT_PRODUCTS_DIR) ?

https://github.com/CocoaPods/CocoaPods/blob/0.5.1/lib/cocoapods/xcodeproj_pods.rb#L66

You could experiment with changing that value directly in
Pods.xcodeproj until you get it right and then see if setting that ENV
variable from the command-line will make it work too.

Alternatively, you could probably use some shell script to get the
later build dir in DerivedData.

HTH

On Fri, May 25, 2012 at 1:53 PM, Jeremy Templier
[email protected]
wrote:

Hi,
I would like to know if there is a way to compile to workspace in command line ?

Actually, this command line works :
xcodebuild -workspace 'Project.xcworkspace' -scheme 'Project'

The problem is that it saves the build into the DeriveData folder with a weird name.
So I tried this command line :
聽xcodebuild -workspace 'New Relic.xcworkspace' -scheme 'New Relic' CONFIGURATION_BUILD_DIR='build'

The problem with this one is that I always have this error :
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
* BUILD FAILED *

Do you have an idea ?

Thanks !
Jeremy.


Reply to this email directly or view it on GitHub:
https://github.com/CocoaPods/CocoaPods/issues/270

Oh btw, I thought you had send this to the mailing-list, but I now see
it鈥檚 a github message. It鈥檚 better if you send it to the ML, maybe
others know the solution already:

http://groups.google.com/group/cocoapods

On Fri, May 25, 2012 at 2:49 PM, Eloy Duran eloy.de.[email protected] wrote:

Hmm, maybe because the Pods.xcodeproj is configured to install into
$(BUILT_PRODUCTS_DIR) ?

https://github.com/CocoaPods/CocoaPods/blob/0.5.1/lib/cocoapods/xcodeproj_pods.rb#L66

You could experiment with changing that value directly in
Pods.xcodeproj until you get it right and then see if setting that ENV
variable from the command-line will make it work too.

Alternatively, you could probably use some shell script to get the
later build dir in DerivedData.

HTH

On Fri, May 25, 2012 at 1:53 PM, Jeremy Templier
[email protected]
wrote:

Hi,
I would like to know if there is a way to compile to workspace in command line ?

Actually, this command line works :
xcodebuild -workspace 'Project.xcworkspace' -scheme 'Project'

The problem is that it saves the build into the DeriveData folder with a weird name.
So I tried this command line :
聽xcodebuild -workspace 'New Relic.xcworkspace' -scheme 'New Relic' CONFIGURATION_BUILD_DIR='build'

The problem with this one is that I always have this error :
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
* BUILD FAILED *

Do you have an idea ?

Thanks !
Jeremy.


Reply to this email directly or view it on GitHub:
https://github.com/CocoaPods/CocoaPods/issues/270

I've had success running:

xcodebuild ... OBJROOT=$(PWD)/build SYMROOT=$(PWD)/build

Mentioned in the same link: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html

@jayztemplier u said that u achieved to configure Jenkins with Xcode Plugin but my project still shows
ld: library not found for -lPods. Could u show me your xcode plugin configs??

Thnxs!

Thanks @smistry-toushay - your solution worked for me!

@smistry-toushay This solution works for me as well!

@smistry-toushay I needed to also set DSTROOT

@smistry-toushay This solution works for me as well!

I am using Jenkins and the Xcode plugin. As suggested by @smistry-toushay, I set the SYMROOT and OBJROOT variables. I now do not get any error related to "ld: library not found for -lPods". However, Jenkins bailed out with the following message-
Check dependencies
error: Unable to create directory: /build (Permission denied)
error: Unable to create directory: /build (Permission denied)

Apparently, when I set SYMROOT to $(PWD)/build, it becomes /build (do not know why) and the build process wants to create the following folder structure, for which obviously I have no permission.

/bin/mkdir -p /build/< target_name >.build/Release-iphoneos/< target_name >.build

Any idea as to what I might be doing wrong here? Why does SYMROOT point to /build? I believe it should have pointed to the build folder in the project workspace? What's the significance of using $PWD/build in SYMROOT?

My bad- I was supposed to invoke xcodebuild -workspace, but I was invoking xcodebuild with the target. Everything now works out-of-the-box when I am using the Xcode plugin with Jenkins.

${WORKSPACE}/build

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marzapower picture marzapower  路  3Comments

dawnnnnn picture dawnnnnn  路  3Comments

Mingmingmew picture Mingmingmew  路  3Comments

Curtis-Halbrook picture Curtis-Halbrook  路  3Comments

hmistry picture hmistry  路  3Comments