2

我的 React Native 项目的链接阶段出现问题。图书馆libRCTMapboxGL.a导致了这个问题。

错误:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:找不到文件:-lPods-RCTMapboxGL

错误:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:文件:-lPods-RCTMapboxGL 不是目标文件(库中不允许)

由于. libRCTMapboxGL.a_ /Users/user/Developer/RNProject/ios/build/Build/Products/Debug-iphonesimulator/_ -lPods-RCTMapboxGL但是,这些文件似乎存在:

/Users/user/Developer/RNProject/node_modules/react-native-mapbox-gl/ios/Pods/Target 支持文件/Pods-RCTMapboxGL/Pods-RCTMapboxGL.debug.xcconfig

/Users/user/Developer/RNProject/node_modules/react-native-mapbox-gl/ios/Pods/Target 支持文件/Pods-RCTMapboxGL/Pods-RCTMapboxGL.release.xcconfig

Pods-RCTMapboxGL is not an object file在错误信息中看起来很奇怪,文件的内容是:

 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = $(inherited) -ObjC
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}/Pods

设置是根据本教程完成的。首先使用 CocoaPods,然后我手动验证所有设置和文件是否到位。

完整的错误日志:

Libtool /Users/user/Developer/RNProject/ios/build/Build/Products/Debug-iphonesimulator/libRCTMapboxGL.a normal x86_64
    cd /Users/user/Developer/RNProject/node_modules/react-native-mapbox-gl/ios
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -L/Users/user/Developer/RNProject/ios/build/Build/Products/Debug-iphonesimulator -L/Users/bobby/Downloads/mapbox-gl-ios-0.2.17 -L/Users/user/Developer/RNProject/node_modules/react-native-mapbox-gl/ios/RCTMapboxGL -filelist /Users/user/Developer/RNProject/ios/build/Build/Intermediates/RCTMapboxGL.build/Debug-iphonesimulator/RCTMapboxGL.build/Objects-normal/x86_64/RCTMapboxGL.LinkFileList -lPods-RCTMapboxGL -o /Users/user/Developer/RNProject/ios/build/Build/Products/Debug-iphonesimulator/libRCTMapboxGL.a

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-RCTMapboxGL
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-RCTMapboxGL is not an object file (not allowed in a library)
4

1 回答 1

0

问题是我pod init在 MapboxGL 目录中使用,它创建了额外的文件。删除生成的文件解决了这个问题。

于 2016-07-28T12:26:03.723 回答