facebook / react-native

A framework for building native applications using React

Home Page:https://reactnative.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xcode: Undefined symbols for architecture x86_64: "_JSObjectGetPrototype"

tapz opened this issue · comments

Environment

React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
Memory: 476.27 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
Build Tools: 21.1.1, 21.1.2, 22.0.0, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.0, 26.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3
API Levels: 22, 24, 26, 27, 28
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5014246
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.7.0 => 16.7.0
react-native: 0.58.1 => 0.58.1
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

MacOS 10.14.2 (18C54)
Xcode 10.1 (10B61)

Description

After upgrading from 0.57.8 to 0.58.1 started to get this error in Xcode when compiling to a simulator:

Undefined symbols for architecture x86_64:
"_JSObjectGetPrototype", referenced from:
facebook::jsc::JSCRuntime::createFunctionFromHostFunction(facebook::jsi::PropNameID const&, unsigned int, std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>)::HostFunctionMetadata::initialize(OpaqueJSContext const*, OpaqueJSValue*) in libjsi.a(JSCRuntime.o)
"_JSObjectSetPrototype", referenced from:
facebook::jsc::JSCRuntime::createFunctionFromHostFunction(facebook::jsi::PropNameID const&, unsigned int, std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>)::HostFunctionMetadata::initialize(OpaqueJSContext const*, OpaqueJSValue*) in libjsi.a(JSCRuntime.o)
"_JSPropertyNameAccumulatorAddName", referenced from:

Reproducible Demo

Just try to compile the project to a simulator.

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

Adding JavaScriptCore.framework to the linked libraries solved the issue. This probably should be added to the release notes.

Great, did it also for me. But now I’m getting the build error (on iOS):
error: {project_path}/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h: No such file or directory

Any idea?

Great, did it also for me. But now I’m getting the build error (on iOS):
error: {project_path}/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h: No such file or directory

Any idea?

Try to clean build folder and rebuild

Thank you, that did the trick for me!

@tapz

Can you tell how add JavaScriptCore.framework to the linked libraries ?!


Update:

👋 folks - thanks for reporting!

Yes it seems that we should add this to the changelog 👍 Maybe right below the highlights section? https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#0580

@retyui highly recommend visiting this project which exposes the exact changes between react-native versions in the form of easy-to-read diffs that you could even (likely) automatically apply if you wanted: https://github.com/pvinis/rn-diff-purge

Adding JavaScriptCore.framework to the linked libraries solved the issue. This probably should be added to the release notes.

I was getting same error after updating ReactNative version, adding JavaScriptCore.framework did the trick.

@kelset yes please, close to the highlights to not miss it

Thanks for looking into this. I'll close it given a solution has been found (projects need to add JavaScriptCore.framework during the upgrade).

Guess what. This is not resolved. I added javascriptCore.framework and it still fails with the same error.
react-native: 0.58.3

@IndeDude I also struggled with this problem for a while and had to clean the build folder using Xcode specifically. See my note here: #23166 (comment)

Good luck!

thank you very much, that also resolve my question;

The answer form @tapz works, but if you wanna use the Release Scheme, don't forget to also add the JavaScriptCore.framework in you Tests Target too.

this answer from @tapz works, thanks a lot

@tapz solution worked except I had to also repeat it for my test project.

The answer form @tapz works, but if you wanna use the Release Scheme, don't forget to also add the JavaScriptCore.framework in you Tests Target too.

This is absoluetly actual solve (y)

image

Adding this did the trick!

The answer form @tapz works, but if you wanna use the Release Scheme, don't forget to also add the JavaScriptCore.framework in you Tests Target too.

Awesome this worked!

thanks @tapz, adding JavaScriptCore.framework to the linked libraries solved the issue for me

The JavaScriptCore.framework is added to my linked libraries but I'am still having the issue.
I'am using React Native 0.59.10

Still having the issue after adding JavaScriptCore.framework to linked libraries.
I'm using React Native 0.60.3