pod install実行時のエラー [configure: error: C compiler cannot create executables]

エラー発生状況

  • WSL2上のDockerにdocker-osxコンテナを構築し、OSX MontereyにXCodeを入れてAdaloHQ/mobile-previewerをiOSエミュレータでテストしたい
  • cloneしたリポジトリのiosディレクトリでpod install実行するとエラーが発生
  • エラーメッセージは下記の通り
$ pod install

略

Installing boost-for-react-native (1.63.0)
Installing glog (0.3.5)
[!] /bin/bash -c 
set -e
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

set -e

PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH}"

略

Try `/Users/ttnt/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/ttnt/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13':
configure: error: C compiler cannot create executables
See `config.log' for more details

解決方法

  • $ sudo xcode-select --switch /Applications/Xcode.appを実行した後、再度$ pod installを実行

参考

エラー対応Adalo,XCode,iOS

Posted by ttnt