C 编译器无法创建可执行文件(安装 Cocoapods)
C compiler cannot create executables (installing Cocoapods)
在安装 RNPermissions 及其依赖项时,我 运行 出错了。似乎是我的编译器或正在安装的包有问题。
错误:
checking whether the C compiler works... no
/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details
完整输出:
$ pod install
Analyzing dependencies
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `Permission-Camera` from `../node_modules/react-native-permissions/ios/Camera.podspec`
Fetching podspec for `Permission-LocationAlways` from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`
Fetching podspec for `Permission-LocationWhenInUse` from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`
Fetching podspec for `RNPermissions` from `../node_modules/react-native-permissions`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Installing DoubleConversion (1.1.5)
Installing Folly (2018.10.22.00)
Using RNPermissions (2.0.3)
Using React (0.59.10)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.4)
[!] /bin/bash -c
set -e
#!/bin/bash
set -e
PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH:-armv7}"
export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"
# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
rm test-driver
fi
./configure --host arm-apple-darwin
# Fix build for tvOS
cat << EOF >> src/config.h
/* Add in so we have Apple Target Conditionals */
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <Availability.h>
#endif
/* Special configuration for AppleTVOS */
#if TARGET_OS_TV
#undef HAVE_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
#undef OS_MACOSX
#endif
/* Special configuration for ucontext */
#undef HAVE_UCONTEXT_H
#undef PC_FROM_UCONTEXT
#if defined(__x86_64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#elif defined(__i386__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
#endif
EOF
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch undefined_arch -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
checking whether the C compiler works... no
/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details
更新了 GCC,问题消失了。
brew update
brew upgrade
brew info gcc
brew install gcc
brew cleanup
对我来说 运行 sudo xcode-select --reset
修复了它。
之前我也 installed/updated gcc
和 brew upgrade gcc
,不确定这是否是先决条件。
有同样的问题,输出略有不同。通过接受 Xcode 许可解决
sudo xcodebuild -license accept
打开Xcode
- Select Xcode 转到 首选项...
- Select Loctions 并设置 Command Line Tools
通过 XCode 首选项设置您的 XCODE CLI,然后再次 运行 pod 安装。
Xcode -> 首选项 -> 位置 -> 命令行工具
确保 Xcode 在您的 Applications 文件夹中。
我不得不安装一个旧版本的 Xcode 并且只是 运行 它来自 ~/Downloads。一旦我将 Xcode.app 文件移动(cut/paste)到应用程序,这个错误就消失了。
来源:https://www.ryadel.com/en/xcode-sdk-iphoneos-cannot-be-located-mac-osx-error-fix/
在安装 RNPermissions 及其依赖项时,我 运行 出错了。似乎是我的编译器或正在安装的包有问题。
错误:
checking whether the C compiler works... no
/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details
完整输出:
$ pod install
Analyzing dependencies
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `Permission-Camera` from `../node_modules/react-native-permissions/ios/Camera.podspec`
Fetching podspec for `Permission-LocationAlways` from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`
Fetching podspec for `Permission-LocationWhenInUse` from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`
Fetching podspec for `RNPermissions` from `../node_modules/react-native-permissions`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Installing DoubleConversion (1.1.5)
Installing Folly (2018.10.22.00)
Using RNPermissions (2.0.3)
Using React (0.59.10)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.4)
[!] /bin/bash -c
set -e
#!/bin/bash
set -e
PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH:-armv7}"
export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"
# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
rm test-driver
fi
./configure --host arm-apple-darwin
# Fix build for tvOS
cat << EOF >> src/config.h
/* Add in so we have Apple Target Conditionals */
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <Availability.h>
#endif
/* Special configuration for AppleTVOS */
#if TARGET_OS_TV
#undef HAVE_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
#undef OS_MACOSX
#endif
/* Special configuration for ucontext */
#undef HAVE_UCONTEXT_H
#undef PC_FROM_UCONTEXT
#if defined(__x86_64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#elif defined(__i386__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
#endif
EOF
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch undefined_arch -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
checking whether the C compiler works... no
/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details
更新了 GCC,问题消失了。
brew update
brew upgrade
brew info gcc
brew install gcc
brew cleanup
对我来说 运行 sudo xcode-select --reset
修复了它。
之前我也 installed/updated gcc
和 brew upgrade gcc
,不确定这是否是先决条件。
有同样的问题,输出略有不同。通过接受 Xcode 许可解决
sudo xcodebuild -license accept
打开Xcode
- Select Xcode 转到 首选项...
- Select Loctions 并设置 Command Line Tools
通过 XCode 首选项设置您的 XCODE CLI,然后再次 运行 pod 安装。
Xcode -> 首选项 -> 位置 -> 命令行工具
确保 Xcode 在您的 Applications 文件夹中。
我不得不安装一个旧版本的 Xcode 并且只是 运行 它来自 ~/Downloads。一旦我将 Xcode.app 文件移动(cut/paste)到应用程序,这个错误就消失了。
来源:https://www.ryadel.com/en/xcode-sdk-iphoneos-cannot-be-located-mac-osx-error-fix/