Libtool:无法找到以下文件:-lPods-RCTMapboxGL

时间:2016-07-27 08:28:28

标签: ios react-native mapbox libtool libtool-xcode

我的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:file:-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 Support Files / Pods-RCTMapboxGL / Pods-RCTMapboxGL.debug.xcconfig

     

/ Users / user / Developer / RNProject / node_modules / react-native-mapbox-gl / ios / Pods / Target Support Files / Pods-RCTMapboxGL / Pods-RCTMapboxGL.release.xcconfig

Pods-RCTMapboxGL不是对象文件在错误消息中看起来很奇怪,文件的内容是:

 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

根据此tutorial完成设置。首先使用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)

1 个答案:

答案 0 :(得分:0)

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