React-native: Undefined symbols for architecture i386

Created on 19 Jul 2016  Â·  17Comments  Â·  Source: facebook/react-native

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?

Locked

Most helpful comment

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.

All 17 comments

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)

Have you tried clearing DerivedData?

@ide same result after clearing DerivedData :(

add libz.tbd to linking libraries

@nihgwu, already have and same result. unfortunately (

Clearing out my app's directory from DerivedData broke all devices in the iOS simulator for me; had to put it back. How do I add libz.tbd to the linking libraries?

Just discovered this is also preventing me from testing on device (iPad mini 2 running iOS 9.3.2 (13F69))—although the error references "normal arm64" instead of i386.

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

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.

Any updates on this?

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.

@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!

@AndrewHenderson I don't know much about Xcode project schemes either. I just chose my existing project for the target, and gave it the same name as the scheme I had deleted.

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

@dizzyluo This was the only solution that worked for me. Thanks!

You guys just put food for me on my table :), thank you very much, wish i could just contribute at-least via money, if not code; a link to donate would help 🥇

It didn't work for me, any other solutions of that problem?

Was this page helpful?
0 / 5 - 0 ratings