React-native: 0.26-rc build isue

Created on 14 May 2016  路  27Comments  路  Source: facebook/react-native

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

None of the above, create a bug report

Make sure to add all the information needed to understand the bug so that someone can help. If the info is missing we'll add the 'Needs more information' label and close the issue until there is enough information.

  • [ ] Provide a minimal code snippet / rnplay example that reproduces the bug.
  • [ ] Provide screenshots where appropriate
  • [ ] What's the version of React Native you're using?
  • [ ] Does this occur on iOS, Android or both?
  • [ ] Are you using Mac, Linux or Windows?
Help Wanted Locked

Most helpful comment

you need to add -lc++ in Other Linker Flagsin your xcode project build settings.

All 27 comments

you need to add -lc++ in Other Linker Flagsin your xcode project build settings.

Anyone wants to submit a Pull Request that updates XCode project with react-native upgrade command?

you need to add -lc++ in Other Linker Flags

What changed in 0.26 that we now need the new linker flag?

The change should be similar to 8aa82d3

But e2e tests pass so the new project template is correct?

| But e2e tests pass so the new project template is correct?

E2e failed to link after this change https://github.com/facebook/react-native/commit/033e7c80bf59f3d4af8e255bae57d4995ea4f72f

Here is log: https://travis-ci.org/facebook/react-native/jobs/124793055

|| The change should be similar to 8aa82d3
| But e2e tests pass so the new project template is correct?

The new project template is now correct and e2e pass.
But upgrade for existing projects requires adding lc++ flag to be added.

Do we even have a clean interface for doing that? Currently it looks that we just copy files and merge them with the user ones. That would be super easy with rnpm to just read the project, check for flags and add lc++ when its' missing.

We might not be able to do it right now as RNPM is still pending merge, but we can make a really small plugin for rnpm and just advise users to install them, e.g.:

rnpm install rnpm-plugin-upgrade
rnpm upgrade 0.26

which upgrades your project from X to Y (in this case 0.26) applying all defined upgrades one after another.

We can merge it later to upgrade itself as well.

CC: @mkonicek @bestander

Can we script

npm install rnpm
rnpm install rnpm-plugin-upgrade
rnpm upgrade 0.26

into the update script?

For the one-off thing until rnpm is merged.
This way we don't need to explain this what users need to install

That would work indeed. I'll update this issue in the morning once the upgrade code is there.

@bestander where do you think it's appropriate to add that npm install thing?

@grabbou after thinking about it and looking at https://github.com/facebook/react-native/blob/master/local-cli/upgrade/upgrade.js, we don't put any modifying commands to this script.

I think we should do similar to this: https://github.com/facebook/react-native/blob/master/local-cli/upgrade/upgrade.js#L49:

  • check that xcodeproject is not upgraded
  • provide a chalk.yellow guide how to upgrade it via the commands I pasted above

And @grabbou kudos for doing that!
Whatever assistance you need - just let me know

Sounds good!

https://github.com/rnpm/rnpm-plugin-upgrade

Here's the plugin with the installation steps. I decided to align its versions with the React Native ones, so it's easier for us to handle changes. I already published it to npm and it seems to be working just fine.

We can add detection of the version later, for now I just made it dead simple.

sd

@chirag04 You saved my life!

@chirag04 It is ok after i added -lc++ in Other Linker Flags.

I have added https://github.com/smore-inc/react-native-segment-io-analytics and I am now getting this issue.

  • I have followed the instructions and build from the xcworkspace file.
  • I have a clean 0.29 awesomeProject - so all the linker flags are fine ($(inherited), -ObjC, -lc++)
  • It worked fine before in my 0.27 project (upgraded from the early 0.20s)

Is this a RN issue or an issue of the package?

Undefined symbols for architecture x86_64:
  "std::terminate()", referenced from:
      ___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
  "operator delete[](void*)", referenced from:
      -[RCTJSCExecutor dealloc] in libReact.a(RCTJSCExecutor.o)
      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)
      RandomAccessBundleData::~RandomAccessBundleData() in libReact.a(RCTJSCExecutor.o)
  "operator new[](unsigned long)", 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)
  "___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(RCTJSCWrapper*, OpaqueJSContext const*, OpaqueJSValue const*) in libReact.a(RCTJSCExecutor.o)
      +[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o)
      -[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o)
      -[RCTJSCExecutor initWithUseCustomJSCLibrary:] 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)

solved! Had to add -lc++ to Other linker flags for my TEST target as well

@Thorbenandresen Thanks when u said TEST target , I didn't understand what does it meant and where was it. Finally figure it out and here it was.
screen shot 2559-08-24 at 6 39 41 pm

Ran into this too. Had to also add to Test target.

2017-01-09 3 47 02

Test target doesn't show 'Other Linker Flags' by default.
You should change 'Basic' to 'All' to be able to see

Yep just ran into this issue when I changed my scheme to run in Release configuration (worked during debug). Had to add -lc++ to the test target as pictured by @mazicky

I just had to do this too, thanks @mazicky and everyone else.

For me the only way to fix the issue was to add -lc++ to the other linker flags of the project aswell as the target and tests.

@Thorbenandresen, thanks pro

Was this page helpful?
0 / 5 - 0 ratings