LoginSignup
14
11

More than 3 years have passed since last update.

iOSのビルドエラーで困ったこと(linker command failed with exit code 1 (use -v to see invocation))

Last updated at Posted at 2018-05-06

環境

Xcode Version 9.3
Mac OS High Sierra ver 10.13.4
CocoaPods : 1.5.0

背景

firebaseのリアルタイムDBにある既存のデータをSwiftクライアントで表示させることにトライしている。

firebaseのドキュメントに記載のある、
cocoa podsのインストール
pod install,firebaseのプロジェクト設定、
import Firebase
FirebaseApp.configure()

までは完了してうまくいく。

現象

ビルドした際に

linker command failed with exit code 1 (use -v to see invocation)
が表示される。

ビルドエラー.png

検索してみたキーワードとやったこと

.xcodeprojファイルのBuild Setting -> Levelsの
Build Active Archtecture OnlyをすべてNoにチェック

framework not found GoogleToolboxForMac 原因で検索

見た記事

【SOF】framework not found GoogleToolboxForMac

[XCode][Cocoapods]ビルドエラー時の対処法

その他もろもろ。

やったこと

xcodeのビルドログを見る
ひたすら検索
新しい簡単なアプリを作ってビルドしてみる→素のアプリだとビルドできる

なぜ分からないか

・たくさんファイルが出てきて問題の切り分けができない
・podファイルの位置の問題なのか
・コードの記述が足りないのか、
・プロジェクトフォルダに然るべきファイルがないからなのか分からない

・エラーメッセージの中にあるパスの指定が自分のPCに見当たらない。
'-F/Users/*******/Library/Developer/Xcode/DerivedData/aaa-bjvtyekftolsrceuignowaszjioe/Build/Products/Debug-iphonesimulator/leveldb-library'

・そもそもXCodeProjectのファイルが何なのかの理解ができていない

・XCodeProject上でライブラリの参照が足りてないことが原因なのか?
・ライブラリの自動参照設定が必要なのか?

podファイルの中身

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'aaa' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for aaa
pod 'Firebase/Core'
pod 'Firebase/Database'


end

追記

podsディレクトリ、xcworkspaceファイル、Podfile.lockを削除し、pod installし直したら解決しました。
もしかするとpod init した後に.xcworkspaceを開いていなかった可能性がありました。

14
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
11