I got the error when i run react-native run-ios after upgraded RN to 0.26.0-rc. The old version is 0.20
Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___cxa_begin_catch", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___gxx_personality_v0", referenced from:
-[RCTJavaScriptContext initWithJSContext:onThread:] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext init] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext invalidate] in libReact.a(RCTJSCExecutor.o)
_RCTNSErrorFromJSError in libReact.a(RCTJSCExecutor.o)
+[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor context] in libReact.a(RCTJSCExecutor.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can i fix it?
Did you do react-native upgrade ?
http://facebook.github.io/react-native/docs/upgrading.html#content
@charpeni Yes, I run the command and denied overwrite all the files.
@deju If you denied overwriting files, it's the cause why it doesn't work.
0.26.0-rc contains a lot of changes compared to 0.20 and you need to do react-native upgrade on each upgrade. You can use the d option to compare your files versus 0.26.0-rc template and apply it manually if you had edited something in it.
http://facebook.github.io/react-native/docs/upgrading.html#content
@facebook-github-bot answered
Closing this issue as @charpeni says the question asked has been answered. Please help us by asking questions on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.
Since 0.26.0-rc, you must add -lc++ to the Other flags in the xcode project. 8aa82d3
@charpeni I added -lc++, and it is ok now. But occurs more problems. The third plugin i used don't support the 0.26.0-rc, maybe i should give up to upgrading to the latest version.
@charpeni: thanks for posting that. I wasn't otherwise aware of that change.
I ran in to this issue as well, and the solution @charpeni proposed solved the issue. To be clear for others, if you are upgrading to 0.26+ then you need to make the following changes.
In ios/YourProject.xcodeproj/project.pbxproj, look for the two lines like OTHER_LDFLAGS = "-ObjC";. Replace them with the following:
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
);
This is, presumably, because the "c++" library is a new dependency of React Native, and needs to be linked when compiling.
For what it's worth, react-native upgrade is a pretty painful tool to use to discover things like this. On any non-trivial app you can't say "yes" to any of the proposed changes. Instead, you are stuck deciphering diffs and trying to figure out what changes you actually need to make. It would be crazy useful to have changes like this called out in the changelog for new releases. Of course, I know you guys are working hard and busy kicking ass...
Don't you think the document() should be updated to include this issue, and also https://github.com/facebook/react-native/issues/8472? It's a common issue on Xcode8 for a new user.
Most helpful comment
I ran in to this issue as well, and the solution @charpeni proposed solved the issue. To be clear for others, if you are upgrading to 0.26+ then you need to make the following changes.
In
ios/YourProject.xcodeproj/project.pbxproj, look for the two lines likeOTHER_LDFLAGS = "-ObjC";. Replace them with the following:This is, presumably, because the "c++" library is a new dependency of React Native, and needs to be linked when compiling.
For what it's worth,
react-native upgradeis a pretty painful tool to use to discover things like this. On any non-trivial app you can't say "yes" to any of the proposed changes. Instead, you are stuck deciphering diffs and trying to figure out what changes you actually need to make. It would be crazy useful to have changes like this called out in the changelog for new releases. Of course, I know you guys are working hard and busy kicking ass...