ptmt / react-native-macos

[deprecated in favor of https://microsoft.github.io/react-native-windows/] React Native for macOS is an experimental fork for writing desktop apps using Cocoa
MIT License
11.24k stars 429 forks source link

Project init and run results in link error: symbol(s) not found for architecture x86_64 #84

Closed dmendis closed 8 years ago

dmendis commented 8 years ago

Hi,

I've got a few react-native projects on my machine so I'm fairly certain my RN setup is okay. I've followed the 4 steps from the README to init a new project using react-native-desktop-cli.

When I open the project in Xcode (7.3.1) and hit run, I get the following error:

Ld /Users/dineth/Library/Developer/Xcode/DerivedData/MyProject-ctslsbccftcwhmbsbmvaeiaoitha/Build/Products/Debug/MyProject.app/Contents/MacOS/MyProject normal x86_64
    cd /Users/dineth/Projects/MyProject/osx
    export MACOSX_DEPLOYMENT_TARGET=10.11
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot ...
...

Undefined symbols for architecture x86_64:
  "std::terminate()", referenced from:
      ___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
  "operator delete[](void*)", referenced from:
      executeRandomAccessModule(RCTJSCExecutor*, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
  "operator new[](unsigned long)", referenced from:
      executeRandomAccessModule(RCTJSCExecutor*, unsigned int, unsigned long, unsigned long) 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)

I tried switching the project to 32bit build and it doesn't build at all then.

Can someone help me get up and running?

ptmt commented 8 years ago

Sorry, this is related to new architecture. Please, run react-native-desktop init again, I've updated the npm module. Make sure you're using version 0.8.4

dmendis commented 8 years ago

Trying now! Super fast reply.

dmendis commented 8 years ago

Fixed in 0.8.4. Appreciate it.

I'd love to find some doco on how I can integrate this with ios/ and android/ counterparts I already have from a project. Maybe I'll ask on Discord.

Thx again.

ptmt commented 8 years ago

ok, I'm writing a blog post on this. Thanks for patience! On Thu, 26 May 2016 at 10:00, Dineth notifications@github.com wrote:

Fixed in 0.8.4. Appreciate it.

I'd love to find some doco on how I can integrate this with ios/ and android/ counterparts I already have from a project. Maybe I'll ask on Discord.

Thx again.

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/ptmt/react-native-desktop/issues/84#issuecomment-221793005

varuntewari commented 7 years ago

Hi,

I am able to init a new React MacOS project. Works great ! Do we now have a way to integrate MacOS with existing ReactNative iOS and Android code base ?

Thanks, Varun

ptmt commented 7 years ago

It depends on how complex your project is. Basically, you need to place just a rn-cli.config.js file in a root (see example https://gist.github.com/ptmt/b1473dead098cf53d667e355aedf2a7b), and encapsulate some of your dependencies in React components (not importing directly from react-native).