Cocoapods: xcodebuild fails with "error: no such module" for a Swift iOS project.

Created on 2 Jan 2016  路  2Comments  路  Source: CocoaPods/CocoaPods

Per CONTRIBUTING.md: 馃寛.

Forgive the n00b nature of this question. This is the first time I'm using CocoaPods - I've tried looking for the source of this problem and for solutions but haven't found one.

I've got a basic iOS Swift project that builds fine when I do so through Xcode (with Cmd + B).

My Podfile looks like this:

platform :ios, '9.0'
use_frameworks!

target 'PodsTest' do
  pod 'Alamofire', '~> 3.0'
  pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end

However, when I run xcodebuild, I see a log that looks like this:

卤 xcodebuild
=== BUILD TARGET PodsTest OF PROJECT PodsTest WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies

Write auxiliary files
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-all-non-framework-target-headers.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-project-headers.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-73A839C12185694797FB88D2.sh
chmod 0755 /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-73A839C12185694797FB88D2.sh
/bin/mkdir -p /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/PodsTest.LinkFileList
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-all-target-headers.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-own-target-headers.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-generated-files.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/PodsTest-OutputFileMap.json
/bin/mkdir -p /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/armv7
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/armv7/PodsTest.LinkFileList
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/armv7/PodsTest-OutputFileMap.json
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-1720E22CB8685B8A526276A6.sh
chmod 0755 /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-1720E22CB8685B8A526276A6.sh
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/swift-overrides.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest.hmap
write-file /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-B11A661C80F7DD1ABB1E9C68.sh
chmod 0755 /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-B11A661C80F7DD1ABB1E9C68.sh

Create product structure
/bin/mkdir -p /Users/gps/Developer/PodsTest/build/Release-iphoneos/PodsTest.app

PhaseScriptExecution Check\ Pods\ Manifest.lock build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-1720E22CB8685B8A526276A6.sh
    cd /Users/gps/Developer/PodsTest
    /bin/sh -c /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Script-1720E22CB8685B8A526276A6.sh

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
    cd /Users/gps/Developer/PodsTest
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/var/rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/npm/bin:/Users/gps/.rbenv/bin:/usr/local/go/bin:/Users/gps/Developer/sprox/bin:"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name PodsTest -O -D COCOAPODS -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -target arm64-apple-ios9.2 -g -Xfrontend -serialize-debugging-options -embed-bitcode-marker -I /Users/gps/Developer/PodsTest/build/Release-iphoneos -F /Users/gps/Developer/PodsTest/build/Release-iphoneos -c -j8 /Users/gps/Developer/PodsTest/PodsTest/ViewController.swift /Users/gps/Developer/PodsTest/PodsTest/AppDelegate.swift -output-file-map /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/PodsTest-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/PodsTest.swiftmodule -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-generated-files.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-own-target-headers.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-all-target-headers.hmap -Xcc -iquote -Xcc /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-project-headers.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/Release-iphoneos/include -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/DerivedSources/arm64 -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/DerivedSources -Xcc -DCOCOAPODS=1 -emit-objc-header -emit-objc-header-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/PodsTest-Swift.h -Xcc -working-directory/Users/gps/Developer/PodsTest

CompileSwift normal arm64 /Users/gps/Developer/PodsTest/PodsTest/ViewController.swift
    cd /Users/gps/Developer/PodsTest
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/gps/Developer/PodsTest/PodsTest/ViewController.swift /Users/gps/Developer/PodsTest/PodsTest/AppDelegate.swift -target arm64-apple-ios9.2 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -I /Users/gps/Developer/PodsTest/build/Release-iphoneos -F /Users/gps/Developer/PodsTest/build/Release-iphoneos -g -D COCOAPODS -serialize-debugging-options -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-generated-files.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-own-target-headers.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-all-target-headers.hmap -Xcc -iquote -Xcc /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-project-headers.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/Release-iphoneos/include -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/DerivedSources/arm64 -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/DerivedSources -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/gps/Developer/PodsTest -emit-module-doc-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/ViewController~partial.swiftdoc -O -module-name PodsTest -emit-module-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/ViewController.d -emit-reference-dependencies-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/ViewController.swiftdeps -o /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/ViewController.o -embed-bitcode-marker
/Users/gps/Developer/PodsTest/PodsTest/ViewController.swift:11:8: error: no such module 'SwiftyJSON'
import SwiftyJSON
       ^

CompileSwift normal arm64 /Users/gps/Developer/PodsTest/PodsTest/AppDelegate.swift
    cd /Users/gps/Developer/PodsTest
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/gps/Developer/PodsTest/PodsTest/ViewController.swift -primary-file /Users/gps/Developer/PodsTest/PodsTest/AppDelegate.swift -target arm64-apple-ios9.2 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -I /Users/gps/Developer/PodsTest/build/Release-iphoneos -F /Users/gps/Developer/PodsTest/build/Release-iphoneos -g -D COCOAPODS -serialize-debugging-options -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-generated-files.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-own-target-headers.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-all-target-headers.hmap -Xcc -iquote -Xcc /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/PodsTest-project-headers.hmap -Xcc -I/Users/gps/Developer/PodsTest/build/Release-iphoneos/include -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/DerivedSources/arm64 -Xcc -I/Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/DerivedSources -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/gps/Developer/PodsTest -emit-module-doc-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/AppDelegate~partial.swiftdoc -O -module-name PodsTest -emit-module-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/AppDelegate~partial.swiftmodule -serialize-diagnostics-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/AppDelegate.dia -emit-dependencies-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/AppDelegate.d -emit-reference-dependencies-path /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/AppDelegate.swiftdeps -o /Users/gps/Developer/PodsTest/build/PodsTest.build/Release-iphoneos/PodsTest.build/Objects-normal/arm64/AppDelegate.o -embed-bitcode-marker
/Users/gps/Developer/PodsTest/PodsTest/ViewController.swift:11:8: error: no such module 'SwiftyJSON'
import SwiftyJSON
       ^

** BUILD FAILED **


The following build commands failed:
    CompileSwift normal arm64 /Users/gps/Developer/PodsTest/PodsTest/ViewController.swift
    CompileSwift normal arm64 /Users/gps/Developer/PodsTest/PodsTest/AppDelegate.swift
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(3 failures)

Any idea what I'm doing wrong here?

Most helpful comment

Can you make sure you're building the workspace, instead of from just the bare project?

All 2 comments

Can you make sure you're building the workspace, instead of from just the bare project?

Can you make sure you're building the workspace, instead of from just the bare project?

Wow, that was a pretty dumb thing to do on my part. Building with xcodebuild -workspace <> -scheme <> works just fine.

Thanks for the help @segiddins!

Was this page helpful?
0 / 5 - 0 ratings