Cocoapods: Compiling Workspace with CONFIGURATION_BUILD_DIR option fails

Created on 28 Aug 2012  Â·  9Comments  Â·  Source: CocoaPods/CocoaPods

I have the following project, which is successfully using Cocoapods:
https://github.com/aerogear/aerogear-ios/

However what bugs me is that I can only change the 'build' directory via Xcode (File->Workspace Settings...)

When I change the location in the 'Build Setting->Build Locations' section from the 'AeroGear-iOS' target, I am getting an error....

I am getting the same error when issuing the following command on the command line:

xcodebuild -scheme AeroGear-iOS -sdk iphonesimulator -workspace AeroGear-iOS.xcworkspace -configuration Release clean build CONFIGURATION_BUILD_DIR='buildy'

The error that I am getting is the following

    Libtool buildy/libAeroGear-iOS.a normal i386
    cd /Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/asf/maven/current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS/buildy -filelist /Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS/BUILD/AeroGear-iOS/Build/Intermediates/AeroGear-iOS.build/Release-iphonesimulator/AeroGear-iOS.build/Objects-normal/i386/AeroGear-iOS.LinkFileList -ObjC -framework Foundation -lPods -o /Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS/buildy/libAeroGear-iOS.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods is not an object file (not allowed in a library)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1


** BUILD FAILED **


The following build commands failed:
    Libtool buildy/libAeroGear-iOS.a normal i386
(1 failure)

However, without the CONFIGURATION_BUILD_DIR the build works fine...

xcodebuild -scheme AeroGear-iOS -sdk iphonesimulator -workspace AeroGear-iOS.xcworkspace -configuration Release clean build

Most helpful comment

Hi guys,

I have run into this issue, building a project with cocoapods CocoaLumberjack and GCDWebServer and using xcodebuid with CONFIGURATION_BUILD_DIR explicitly set.

As it is stated in the documentation - CONFIGURATION_BUILD_DIR specifies the Build Products Path - i.e. the base path where build products will be placed during a build for a given configuration. By default, this is set to $(BUILD_DIR)/$(CONFIGURATION). This way all pods were built in the same place and in my case the GCDWebServer sees the headers of CocoaLumberjack, tries to load some source and fails with the following error:

Undefined symbols for architecture arm64:
 "_OBJC_CLASS_$_DDLog", referenced from:
     objc-class-ref in GCDWebServer.o
     objc-class-ref in GCDWebServerConnection.o
     objc-class-ref in GCDWebServerFileResponse.o
     objc-class-ref in GCDWebServerFunctions.o
     objc-class-ref in GCDWebServerMultiPartFormRequest.o
     objc-class-ref in GCDWebServerRequest.o
ld: symbol(s) not found for architecture arm64

The workaround I found is to build the project setting explicitly the BUILD_DIR instead. It works fine that way on XCode => 8.

Hope this saves some time :slightly_smiling_face:

All 9 comments

Under the ‘File’ menu, there is a ‘Workspace Settings…’ entry, there you can change the build location.

HTH

On Aug 28, 2012, at 3:24 PM, Matthias Wessendorf [email protected] wrote:

I have the following project, which is successfully using Cocoapods.

However what bugs me is that I can only change the 'build' directory via Xcode (File->Workspace Settings...)

When I change the location in the 'Build Setting->Build Locations' section from the 'AeroGear-iOS' target, I am getting an error....

I am getting the same error when issuing the following command on the command line:

xcodebuild -scheme AeroGear-iOS -sdk iphonesimulator -workspace AeroGear-iOS.xcworkspace -configuration Release clean build CONFIGURATION_BUILD_DIR='buildy'
The error that I am getting is the following

Libtool buildy/libAeroGear-iOS.a normal i386
cd /Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/asf/maven/current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS/buildy -filelist /Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS/BUILD/AeroGear-iOS/Build/Intermediates/AeroGear-iOS.build/Release-iphonesimulator/AeroGear-iOS.build/Objects-normal/i386/AeroGear-iOS.LinkFileList -ObjC -framework Foundation -lPods -o /Users/wessi/Work/JBoss/iOS/aerogear-ios/AeroGear-iOS/buildy/libAeroGear-iOS.a

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods is not an object file (not allowed in a library)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1

* BUILD FAILED *

The following build commands failed:
Libtool buildy/libAeroGear-iOS.a normal i386
(1 failure)
However, without the CONFIGURATION_BUILD_DIR the build works fine...

xcodebuild -scheme AeroGear-iOS -sdk iphonesimulator -workspace AeroGear-iOS.xcworkspace -configuration Release clean build
—
Reply to this email directly or view it on GitHub.

@alloy thx for the reply, but as I said I am doing that, and there it works
(from my original issue 'However what bugs me is that I can only change the 'build' directory via Xcode (File->Workspace Settings...)')

However, this setting is _global_ to the Xcode IDE, stored in user specific metadata (.xcworkspace/xcuserdata/wessi.xcuserdatad/WorkspaceSettings.xcsettings)

I don't want to use the 'File->Workspace Settings...' option, kinda odd, that the CONFIGURATION_BUILD_DIR arg does not work...

Oh sorry, I completely missed that line.

Alas, I’m not familiar with any other available option… I think the only other thing to do is to file a radar ticket and see what Apple’s response is. (I’d love to hear their feedback too, if you do this.)

On Aug 28, 2012, at 3:54 PM, Matthias Wessendorf [email protected] wrote:

@alloy thx for the reply, but as I said I am doing that, and there it works
(from my original issue 'However what bugs me is that I can only change the 'build' directory via Xcode (File->Workspace Settings...)')

However, this setting is global to the Xcode IDE, stored in user specific metadata (.xcworkspace/xcuserdata/wessi.xcuserdatad/WorkspaceSettings.xcsettings)

I don't want to use the 'File->Workspace Settings...' option, kinda odd, that the CONFIGURATION_BUILD_DIR arg does not work...

—
Reply to this email directly or view it on GitHub.

Can we close this?

I guess yes

@matzew Did you find a solution for this problem? I have a similar issue. I use Cocoapods to include CocoaLumberjack in my iOS Project. When I do a command line build without specifying the CONFIGURATION_BUILD_DIR setting, it builds just fine. But when I specify a specific build location the build fails and I get the following error:

duplicate interface definition for class 'DDAbstractLogger'

I'm unsure whether this is directly related to Cocoapods but I didn't have this issue before I switched over to Cocoapods.

I found this was caused by CONFIGURATION_BUILD_DIR requiring the full path to the folder containing the workspace (Relative paths will not work for subprojects.).

xcodebuild -sdk iphonesimulator -workspace MB.xcworkspace -scheme MB-cal ONLY_ACTIVE_ARCH=NO CONFIGURATION_BUILD_DIR="/Users/tris/workspace/MBTrunk/build" OBJROOT=$(PWD)/build SYMROOT=$(PWD)/build DSTROOT=$(PWD)/build clean build

Use CONFIGURATION_BUILD_DIR="$WORKSPACE/build" when running on CI system like jenkins.

Hi guys,

I have run into this issue, building a project with cocoapods CocoaLumberjack and GCDWebServer and using xcodebuid with CONFIGURATION_BUILD_DIR explicitly set.

As it is stated in the documentation - CONFIGURATION_BUILD_DIR specifies the Build Products Path - i.e. the base path where build products will be placed during a build for a given configuration. By default, this is set to $(BUILD_DIR)/$(CONFIGURATION). This way all pods were built in the same place and in my case the GCDWebServer sees the headers of CocoaLumberjack, tries to load some source and fails with the following error:

Undefined symbols for architecture arm64:
 "_OBJC_CLASS_$_DDLog", referenced from:
     objc-class-ref in GCDWebServer.o
     objc-class-ref in GCDWebServerConnection.o
     objc-class-ref in GCDWebServerFileResponse.o
     objc-class-ref in GCDWebServerFunctions.o
     objc-class-ref in GCDWebServerMultiPartFormRequest.o
     objc-class-ref in GCDWebServerRequest.o
ld: symbol(s) not found for architecture arm64

The workaround I found is to build the project setting explicitly the BUILD_DIR instead. It works fine that way on XCode => 8.

Hope this saves some time :slightly_smiling_face:

This is my gist that makes .app for simulator : https://gist.github.com/matteocollina/8d0fe3a569695b2924654975046da2fe

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pallaviMN picture pallaviMN  Â·  3Comments

tlandsmancars picture tlandsmancars  Â·  3Comments

dawnnnnn picture dawnnnnn  Â·  3Comments

Curtis-Halbrook picture Curtis-Halbrook  Â·  3Comments

sonu5 picture sonu5  Â·  3Comments