Build for iOS fails when Podfile specifies platform 11 or later
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- build-system, cli, mobile-dev
調査の方向性
ドキュメントに記載された tns create、nativescript-imagepicker、Podfile platform 11.0、tns build ios の各コマンドで失敗を再現します。CLI の xcodebuild 呼び出しと、プラグインの Podfile および App_Resources/iOS/build.xcconfig とともに生成されたプロジェクトを調査します。Podfile platform が 11 以上で、workaround を必要とせずに iOS ビルドが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 5.1.1
- Cross-platform modules: Not applicable
- Android Runtime: Not applicable
- iOS Runtime: Not applicable
- Plugin(s): Any plugin with Podfile will do the job. For this report I've used
nativescript-imagepicker.
Describe the bug
When the platform in Podfile is 11 or later, build for iOS fails with error:
ld: warning: directory not found for option '-F<path to project>/platforms/ios/build/Debug-iphonesimulator/QBImagePickerController'
ld: framework not found QBImagePickerController
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build systemnote: Planning buildnote: Constructing build description
To Reproduce
- Create new project:
$ tns create myApp --js - Navigate to project:
$ cd myApp - Add
nativescript-imagepickerplugin:npm i --save --save-exact nativescript-imagepicker - Open the Podfile in
nativescript-imagepicker:code node_modules/nativescript-imagepicker/platforms/ios/Podfileand add the following line at the top:
platform :ios, '11.0'
- Now build for iOS:
tns build iosortns build ios --forDevice
The build will fail.
Expected behavior
The build should succeed.
Additional context
It looks like the problem is in the Pods - the specified platform is used only for building the framework, but not for the actual Pod target and the application. When building for iOS 11 or later, Xcode automatically builds for 64bits only, i.e. for arm64 (for device) or x86_64 (for simulator).
When CLI tries to build the project, it spawns xcodebuild with ONLY_ACTIVE_ARCH=NO, i.e. Xcode will build the project for all architectures based on the deployment target. As the default deployment target is 9, Xcode will build for both armv7 and arm64 (for device) or i386 and x86_64 (for simulator). As the Pods project has platform "11.0", the static framework will be build only for the 64bits arch, so the actual build of the project will not be able to find the framework for armv7/i386 and it fails.
Workarounds
- Delete the platform: ios, '11.0' line from all plugins that add it.
or - Specify
IPHONEOS_DEPLOYMENT_TARGET = 11.0in your<path to project's App_Resources>/iOS/build.xcconfig- this way when Xcode builds your project, it will build only for 64bits architecture and the build will succeed. NOTE: This way your app will not work on lower iOS targets.
- 主要言語
- JavaScript
- スター
- 1.1k
- フォーク
- 204
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 8
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/nativescript-cli のほかの issue
-
in-progress
NativeScript/nativescript-cli#6140 · コメント 2 件 · 担当者 1 名 ·
-
NativeScript/nativescript-cli#6090 · 担当者 1 名 ·
-
in progress
NativeScript/nativescript-cli#6015 · リアクション 1 件 · 担当者 1 名 ·
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
NativeScript/nativescript-cli#5992 · コメント 5 件 ·
-
feature-pending-triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
NativeScript/nativescript-cli#5975 ·
NativeScript/nativescript-cli の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bevyengine/bevy-website#2595 ·