Ios C编译器无法创建可执行文件(安装CoCoapod)

Ios C编译器无法创建可执行文件(安装CoCoapod),ios,gcc,cocoapods,podfile,glog,Ios,Gcc,Cocoapods,Podfile,Glog,在安装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/Po

在安装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
$pod安装
分析依赖关系
正在从`../node\u modules/react native/third party podspecs/Folly.podspec获取'Folly'的podspec`
正在从“../node\u modules/react native permissions/ios/Camera.podspec”获取“Permission Camera”的podspec`
正在从“../node\u modules/react native permissions/ios/LocationAlways.podspec”获取“Permission LocationAlways”的podspec`
正在从“../node\u modules/react native permissions/ios/locationwhenninuse.podspec”获取“Permission locationwhenninuse”的podspec`
正在从“../node\u modules/react native permissions”获取“RNPermissions”的podspec`
正在从“../node\u modules/React native”获取“React”的podspec/`
正在从“../node\u modules/react native/react common/yoga”获取“yoga”的podspec`
下载依赖项
安装双重转换(1.1.5)
安装Folly(2018.10.22.00)
使用RNP权限(2.0.3)
使用React(0.59.10)
为react native(1.63.0)安装增压器
安装glog(0.3.4)
[!]/bin/bash-c
set-e
#!/bin/bash
set-e
平台名称=“${PLATFORM\u NAME:-iphoneos}”
CURRENT_ARCH=“${CURRENT_ARCH:-armv7}”
export CC=“$(xcrun-find-sdk$PLATFORM\u NAME CC)-arch$CURRENT\u arch-isysroot$(xcrun-sdk$PLATFORM\u NAME--show sdk path)”
导出CXX=“$CC”
#删除automake符号链接(如果存在)
如果[-h“测试驾驶员”];然后
rm测试驱动程序
fi
./configure——主机arm
#修复tvOS的构建
cat>src/config.h
/*加上这样我们就有了苹果的目标条件*/
#苹果__
#包括
#包括
#恩迪夫
/*AppleTVOS的特殊配置*/
#如果目标是电视
#未定义有系统调用
#undef拥有\u SYS\u SYSCALL\u H
#undef OS_MACOSX
#恩迪夫
/*ucontext的特殊配置*/
#undef有\u UCONTEXT\u H
#从上下文取消定义PC_
#如果已定义(\uuuux86\u64\uuuuuuu)
#从上下文uc\U mcontext->ss.定义PC
#定义的elif(uuuuu386_uuuuuuu)
#从UCONTEXT uc mcontext->从eip定义PC
#恩迪夫
EOF
正在检查BSD兼容的安装/usr/bin/install-c
正在检查生成环境是否正常。。。对
正在检查扶手带。。。不
正在检查带。。。带
正在检查线程安全的mkdir-p/安装sh-c-d
正在检查是否有呆滞。。。不
正在检查mawk。。。不
正在检查nawk。。。不
正在检查awk。。。awk
正在检查make是否设置$(make)。。。对
正在检查make是否支持嵌套变量。。。对
正在检查是否存在arm/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc-arch-undefined\u arch-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
正在检查C编译器是否工作。。。不
/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing:Unknown`--is lightweight'选项
有关详细信息,请尝试“/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing--help”
配置:警告:“缺少”脚本太旧或缺少
配置:错误:在“/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b”中:
配置:错误:C编译器无法创建可执行文件
有关详细信息,请参阅“config.log”

更新了GCC,问题消失了

brew update
brew upgrade
brew info gcc
brew install gcc
brew cleanup

对于我来说,运行
sudoxcode选择--reset
修复了它


在此之前,我还使用
brew upgrade gcc
安装/更新了
gcc
,不确定这是否是一个先决条件。

也有相同的问题,输出略有不同。通过接受Xcode许可证解决
sudo Xcode构建-许可证接受

打开Xcode
  • 选择Xcode转到首选项…
  • 选择位置并设置命令行工具

  • 通过XCODE首选项设置XCODE CLI,然后再次运行pod安装


    Xcode->Preferences->Locations->命令行工具

    我认为GCC与此无关。xcode重置应该可以解决这个问题。xcode默认使用GCC还是单独的编译器?嗨,Peter G,你有什么解决方案来解决这个问题?