When reproducing step by step this this original example of RCTMapboxGL (5.1.0) I run into an error with the linker. This happened to me several times (each time with clean project) and I assume this is a bug.

I tried both the:
My solution was fixing all React import statements across the MapboxGL library.
Turning them into global imports in the form #import
e.g. #import RCTView.h to #import
(9 files in total):
RCTMapboxAnnotation.m:
RCTMapboxAnnotation.h:
RCTMapboxAnnotationManager.m:
RCTMapboxAnnotationManager.h:
RCTMapboxGL.h:
RCTMapboxGL.m:
RCTMapboxGLManager.h:
RCTMapboxGLManager.m:
RCTMapboxGLConversions.m:
Thanks! There error that brought me here is:
Duplicate interface definition for class 'RCTView'
Thanks for taking the time to upload your fixes!
@petegerhat I am going to edit your comment so it's a bit more legible because it helped me so much. Cheers.
edit: I guess you cant edit people's comments
Thanks @petegerhat
Thanks for the above changes. I think I fixed that... but now when I clean and build, I'm now getting a Apple Macho-O Linker Error - the error messages aren't helping me much... Any ideas?
Undefined symbols for architecture x86_64:
"std::__1::__call_once(unsigned long volatile&, void, void ()(void))", referenced from:
facebook::react::systemJSCWrapper() in libReact.a(JSCWrapper.o)
"std::__1::__next_prime(unsigned long)", referenced from:
std::__1::__hash_table
"std::__1::mutex::lock()", referenced from:
-[RCTModuleData setUpInstanceAndBridge] in libReact.a(RCTModuleData.o)
"std::__1::mutex::unlock()", referenced from:
-[RCTModuleData setUpInstanceAndBridge] in libReact.a(RCTModuleData.o)
"std::__1::mutex::~mutex()", referenced from:
-[RCTModuleData .cxx_destruct] in libReact.a(RCTModuleData.o)
"std::terminate()", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"operator delete", referenced from:
-[RCTJSCExecutor dealloc] in libReact.a(RCTJSCExecutor.o)
executeRandomAccessModule(RCTJSCExecutor
readRAMBundle(std::__1::unique_ptr<__sFILE, int (*)(__sFILE*)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
RandomAccessBundleData::~RandomAccessBundleData() in libReact.a(RCTJSCExecutor.o)
"operator delete(void)", referenced from:
std::__1::__hash_table
std::__1::__hash_table
____ZL37installBasicSynchronousHooksOnContextP9JSContext_block_invoke_5 in libReact.a(RCTJSCExecutor.o)
std::__1::unique_ptr
std::__1::__hash_table
std::__1::__hash_table
"operator new", referenced from:
executeRandomAccessModule(RCTJSCExecutor, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
readRAMBundle(std::__1::unique_ptr<__sFILE, int (*)(__sFILE*)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
"operator new(unsigned long)", referenced from:
std::__1::unique_ptr
std::__1::__hash_table
"___cxa_begin_catch", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___cxa_demangle", referenced from:
____RCTLogNativeInternal_block_invoke in libReact.a(RCTLog.o)
"___gxx_personality_v0", referenced from:
_RCTDefaultLogFunction_block_invoke in libReact.a(RCTLog.o)
_RCTFormatLog in libReact.a(RCTLog.o)
_RCTAddLogFunction in libReact.a(RCTLog.o)
___RCTAddLogFunction_block_invoke in libReact.a(RCTLog.o)
_RCTPerformBlockWithLogFunction in libReact.a(RCTLog.o)
_RCTPerformBlockWithLogPrefix in libReact.a(RCTLog.o)
RCTGetLocalLogFunction() in libReact.a(RCTLog.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@guestn That is caused by something unrelated to mapbox. I've run into that several times and I usually solve it by restating xcode or adjusting some config that I can't think of at the moment.
you are right! thanks. It is the Build Settings Other Linker Flags which needs to be set '-lc++' to enable these functions...
Can comment on your post on stackoverflow (stupid rules) but yeah, this works perfectly for me, maybe this one need to be a PR? anyway, THANK YOU!
Looks like https://github.com/mapbox/react-native-mapbox-gl/pull/487 fixes this.
I tried this but still not working. Here my steps:
$ npm install -g create-react-native-app
$ create-react-native-app my-app
$ cd my-app
$ npm run eject
Then select options with ExpoKit
Next add pod 'RCTMapboxGL', :path => '../node_modules/react-native-mapbox-gl/ios'
$ cd ios
$ pod install
Open workspace, click Play and got this:
"_OBJC_CLASS_$_RCTMapboxAnnotation", referenced from:
objc-class-ref in libRCTMapboxGL.a(RCTMapboxGL.o)
ld: symbol(s) not found for architecture x86_64
_(if you get some error with RCT/... not found, remove node_modules and $ npm install and $ pod install again )_
Then i tried to edit all files in Pod/Development Pods/RCTMapboxGL/RCTMapboxGL as above reply and i still get this error. Anyone can help me with this? Thanks!!
I have the exact same error as @daominhsangvn. Started after a version update of my app...
Do you have a solution ?
Same issue... Any updates?
@Gp2mv3 @helderdb
Try manual link and doing following:
RCT/... not foundBuild Settings > Header Search Path then clear everything (Ignore the one that point to another xCode project which is not React)Header Search Path: "$(SRCROOT)/../../../ios/Pods/Headers/Public". Make sure you point to the correct path, SRCROOT is the project place, make sure you point it correct the ios/Pods folder at the root:)
@daominhsangvn What if you're not using pods?
After updating the files from #487 i'm getting this error:
`MapView` has no propType for native prop `RCTMapboxGL.onCloseAnnotation` of native type `BOOL`
If you haven't changed this prop yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.
Trying to understand what I need to fix as well 馃
UPD:
I can't figure that out 馃槄
Just replaced all files with ones from master and everything works now.
so please which are ALL the CORRECT STEPS to use it in a new fresh create-react-native app?
thank you very much
Most helpful comment
@daominhsangvn What if you're not using pods?