react-native: Undefined symbols for architecture i386

I’m building an app on Mac OS X El Capitan (10.11.5), running Xcode 7.3.1 (7D1014), with React 15.2.1 and React Native 0.29.1. My app runs fine in the iOS Simulator for all but the iPad 2, iPhone 4s, and iPhone 5. On these devices, I get the following errors:

ld: warning: ignoring file /Users/scott/Library/Developer/Xcode/DerivedData/MyApp-gnysvlrqxawwzdagzfxrnkbhnbzh/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp, file was built for x86_64 which is not the architecture being linked (i386): /Users/scott/Library/Developer/Xcode/DerivedData/MyApp-gnysvlrqxawwzdagzfxrnkbhnbzh/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
Undefined symbols for architecture i386:
  "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 i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas what might be going wrong?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 17 (3 by maintainers)

Most upvoted comments

I just fixed this by deleting and creating my scheme in Xcode (credit goes to this SO post). Here’s what I did in Xcode 7.3.1:

  1. Open your project in Xcode.
  2. Click Product > Scheme > Manage Schemes.
  3. Select the scheme for your project, then click the minus (—) near the bottom left to delete it.
  4. Now click the plus (+) to create a new scheme for your project.

Click your project on the left side, select your Target, under Dead Code Stripping > Release, select “No”

Any updates on this?

Yes -lc++ is added to Other linker flags. Also, I added libz.tbd to Link Binary With Libraries but it didn’t make a difference.

@stenrap I don’t know much about Xcode project schemes. If I delete the Scheme, I wouldn’t know what you create in step 4. Can you inform? Thanks!

see if -lc++ is added to Other linker flags for your test target.

Have you tried clearing DerivedData?

I have the same issue with MyProjectTests, but with all IOS simulators , https://github.com/facebook/react-native/issues/8890

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)