Libtool: can't locate file for: -lPods-RCTMapboxGL - ios

There is a problem at the linking stage of my React Native project. The library libRCTMapboxGL.a is causing this problem.
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)
The file libRCTMapboxGL.a is not being created in /Users/user/Developer/RNProject/ios/build/Build/Products/Debug-iphonesimulator/ as consequence of the error with -lPods-RCTMapboxGL. However, the files seem to exist:
/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 is not an object file looks strange in the error message, the content of the files is:
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
The setup was done according this tutorial. Firstly using CocoaPods and then I manually verified if all the settings and files are in place.
Full error log:
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)

The problem was that I used pod init inside the MapboxGL directory, which created the extra files. Removing the generated files solved the problem.

Related

Change Other Swift Flags gives build error

I'm creating multiple targets for development, test, production, QA etc.. When I do that I want to differentiate this targets by changing "other swift flags". As default, It shows as in below screenshot.
I want to change that "-D" to "Prod". I think because I use Cocoapods, I'm getting build error. My Pods xcconfig file is in below;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '#executable_path/Frameworks' '#loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Alamofire"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
I'm getting below error
:0: error: unknown argument: '-PROD'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
When you are adding processor macros you have to define them with the prefix -D so, in your need to add -DPROD, like this

React-native: iOS wont install - libtool error

I test my app using react-native run-ios in the simulator, however today I just get a random error and have no clue on how to approach it since I com from web dev and have no clue on how to setup projects in xCode (well I have some idea but I don't want to further break the project)
This is the error I am getting:
libtool /Users/waltermonecke/Code_Projects/reactNative/lisdo/ios/build/Build/Products/Debug-iphonesimulator/libTPSStripe.a normal x86_64
cd /Users/waltermonecke/Code_Projects/reactNative/lisdo/node_modules/tipsi-stripe/ios
export IPHONEOS_DEPLOYMENT_TARGET=10.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:/opt/ImageMagick/bin"
/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/iPhoneSimulator10.3.sdk -L/Users/waltermonecke/Code_Projects/reactNative/lisdo/ios/build/Build/Products/Debug-iphonesimulator -filelist /Users/waltermonecke/Code_Projects/reactNative/lisdo/ios/build/Build/Intermediates/TPSStripe.build/Debug-iphonesimulator/TPSStripe.build/Objects-normal/x86_64/TPSStripe.LinkFileList -lRCTPushNotification -weak_framework Stripe -framework PassKit -o /Users/waltermonecke/Code_Projects/reactNative/lisdo/ios/build/Build/Products/Debug-iphonesimulator/libTPSStripe.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lRCTPushNotification
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lRCTPushNotification is not an object file (not allowed in a library)
** BUILD FAILED **
The following commands produced analyzer issues:
Analyze /Users/waltermonecke/Code_Projects/reactNative/lisdo/node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c
Analyze /Users/waltermonecke/Code_Projects/reactNative/lisdo/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.c
(2 commands with analyzer issues)
The following build commands failed:
Libtool /Users/waltermonecke/Code_Projects/reactNative/lisdo/ios/build/Build/Products/Debug-iphonesimulator/libTPSStripe.a normal x86_64
(1 failure)
I guess this is the relevant part can't locate file for: -lRCTPushNotification, but I dont know how to properly remove the reference to that package.
Any help is welcome!

Static lib with CocoaPods dependencies

I'm following this tutorial in order to create an iOS framework (in order to support older than iOS8).
It all went just fine.
The problem started when I made a step forward and tried to use 'Cocoapods' to get 3rd party libs which my framework is depended on.
When trying to build the aggregate target, I get the following error:
Libtool /Users/me/Library/Developer/Xcode/DerivedData/testFrameworkJverkoey-etqkesvvsfnndbdcydkphdythnve/Build/Products/Debug-iphoneos/libmyFramework.a normal armv7
cd /Users/me/Dev/testFrameworkJverkoey
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Tools:/Users/me/.rvm/gems/ruby-2.1.1/bin:/Users/me/.rvm/gems/ruby-2.1.1#global/bin:/Users/me/.rvm/rubies/ruby-2.1.1/bin:/Users/me/.rvm/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/Library/PostgreSQL/9.2/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/CrossPack-AVR/bin:/usr/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/me/Library/Developer/Xcode/DerivedData/testFrameworkJverkoey-etqkesvvsfnndbdcydkphdythnve/Build/Products/Debug-iphoneos -filelist /Users/me/Library/Developer/Xcode/DerivedData/testFrameworkJverkoey-etqkesvvsfnndbdcydkphdythnve/Build/Intermediates/testFrameworkJverkoey.build/Debug-iphoneos/myFramework.build/Objects-normal/armv7/myFramework.LinkFileList -ObjC -ObjC -lPods-AFNetworking -lPods-RestKit -lPods-SOCKit -lPods-TransitionKit -framework CFNetwork -framework CoreData -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -lPods -o /Users/me/Library/Developer/Xcode/DerivedData/testFrameworkJverkoey-etqkesvvsfnndbdcydkphdythnve/Build/Products/Debug-iphoneos/libmyFramework.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC -ObjC
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-AFNetworking
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-AFNetworking is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-RestKit
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-RestKit is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-SOCKit
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-SOCKit is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-TransitionKit
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-TransitionKit is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods is not an object file (not allowed in a library)
** BUILD FAILED **
The following build commands failed:
Libtool /Users/me/Library/Developer/Xcode/DerivedData/testFrameworkJverkoey-etqkesvvsfnndbdcydkphdythnve/Build/Products/Debug-iphoneos/libmyFramework.a normal armv7
(1 failure)

Mailcore2 "ld: library not found for -licudata" when building

I've got a project which has been building fine using Mailcore2. I opened the project today and received errors along the lines of "SDK not found" during the Mailcore2 shell script. I discovered that I needed to rename .m files which import MailCore.h to .mm. I am now receiving the error "ld: library not found for -licudata" when building. This error is displayed within my target. My target's linker flags are as follows:
//:configuration = Debug
OTHER_LDFLAGS = -lctemplate-ios -letpan-ios -licudata -licui18n -licuuc -lxml2 -lsasl2 -liconv -ltidy -lz -licucore -lc++ -stdlib=libc++ -ObjC
//:configuration = Release
OTHER_LDFLAGS = -lctemplate-ios -letpan-ios -licudata -licui18n -licuuc -lxml2 -lsasl2 -liconv -ltidy -lz -licucore -lc++ -stdlib=libc++ -ObjC
In addition, I received "Lexical or Preprocessor Issue 'unordered_map' file not found" within the static mailcore2 ios target.
Nothing has changed within my build settings or configuration, and I haven't edited anything in the project. I literally just opened it and tried to build.
Switching to the cocoa pods version solved the problem and was much easier to install and use than the older xcodeproj version.

ios - "libtool failed with exit code 1" after a clean

I was working on a project and all were going well until I decide to clean my project.
The following errors appears only when I run my app on simulator (working fine on a real device) :
Libtool /Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Products/Debug-iphonesimulator/libShareKit.a normal i386
cd "/Users/Yaman/Documents/iOS - App à vendre/Homeless/Submodules/ShareKit"
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Products/Debug-iphonesimulator -filelist "/Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Intermediates/ShareKit.build/Debug-iphonesimulator/Static Library.build/Objects-normal/i386/ShareKit.LinkFileList" -ObjC -all_load -lCopy -lDelicious -lDiigo -lEmail "-lEvernote SDK" -lEvernote -lFacebook "-lFlickr SDK" -lFlickr -lFoursquareV2 "-lGoogle Reader" -lInstagram -lInstapaper -lJSONKit -lKippt -lLinkedIn -lLogout -lOAuth "-lOpen in Safari" -lPinboard -lPrint -lReachability "-lRead It Later" "-lSave to Album" -lShareKitCore "-lSina Weibo" -lSSKeyChain "-lText Message" -lTumblr -lTwitter -lVKontakte -o /Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Products/Debug-iphonesimulator/libShareKit.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified, -all_load invalid
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lReachability
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lReachability is not an object file (not allowed in a library)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
I got these errors when running command xcodebuild directly from a terminal :
** BUILD FAILED **
The following build commands failed:
Libtool "build/ShareKit.build/Release-iphoneos/Static Library.build/Objects-normal/armv7/libShareKit.a" normal armv7
Libtool "build/ShareKit.build/Release-iphoneos/Static Library.build/Objects-normal/armv7s/libShareKit.a" normal armv7s
(2 failures)
Someone can figure out what's happened here ?
I just got this error. The project works very well, you add a new lib and BAM, build failed.
I my case, Xcode5 had added some special \" around my header search paths values.
Like that :
\"$(SRCROOT)/myproject/Libraries/lib\"
Quite impossible to find out, but when spending hours to find where is the problem, I finally tried to change to
$(SRCROOT)/myproject/Libraries/lib
And the build success came back... thanks Xcode!
The first error note says that compiling ShareKit failed, because Reachability is missing. I'd propose that you check your compiling environment has latest (or compatible) version of the library.
That's why libShareKit.a mentioned in last error note is missing and compiling your app failed. Try to compiling ShareKit alone and when it's done, try again the whole app.

Resources