react-native: [iOS] Undefined symbols for architecture x86_64
Is this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
react-native -v
: react-native-cli: 2.0.1 - react-native: 0.46.1node -v
: v7.5.0npm -v
: 4.1.2
Then, specify:
- Target Platform (e.g. iOS, Android): iOS
- Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra 10.12.5
Steps to Reproduce
- Have a new project based on 0.46.1 react native.
- Use “babel-preset-react-native”: “^2.0.0”
- I don’t know if there is a library or what that does this but its really weird
Expected Behavior
I expect the react-native run-ios to build the app properly! Because react-native run-android works fine and lets me build and run the android app!
Actual Behavior
/Users/snorreedwin/Code/entur/entur-clients/native/ios/build/Build/Products/Debug-iphonesimulator/React/React.framework/React
Undefined symbols for architecture x86_64:
"_JSNoBytecodeFileFormatVersion", referenced from:
+[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] in RCTJavaScriptLoader.o
+[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o
"facebook::react::parseTypeFromHeader(facebook::react::BundleHeader const&)", referenced from:
+[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o
"facebook::react::customJSCWrapper()", referenced from:
-[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o
-[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o
_RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o
-[RCTSamplingProfilerPackagerMethod handleRequest:withResponder:] in RCTSamplingProfilerPackagerMethod.o
"facebook::react::systemJSCWrapper()", referenced from:
-[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o
-[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o
_RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o
-[RCTSamplingProfilerPackagerMethod handleRequest:withResponder:] in RCTSamplingProfilerPackagerMethod.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld /Users/snorreedwin/Code/entur/entur-clients/native/ios/build/Build/Products/Debug-iphonesimulator/React/React.framework/React normal x86_64
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/reactnativetidr.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/reactnativetidr.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Reproducible Demo
I’m not sure how to easily reproduce this, other than telling about our setup. We are running CocoaPods and Swift, which makes it a bit different from an init project. This is our dependencies:
"dependencies": {
"@mapbox/polyline": "^0.2.0",
"axios": "^0.15.3",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"better-npm-run": "0.0.14",
"file-butler": "git@bitbucket.org:enturas/file-butler.git",
"moment": "^2.18.1",
"native-base": "^2.2.1",
"react": "16.0.0-alpha.12",
"react-native": "0.46.1",
"react-native-config-swift": "git@bitbucket.org:enturas/react-native-config-swift.git",
"react-native-easy-grid": "^0.1.11",
"react-native-fabric": "^0.4.1",
"react-native-maps": "^0.15.3",
"react-native-vector-icons": "~4.1.1",
"react-navigation": "^1.0.0-beta.11",
"react-redux": "^5.0.3",
"react-router-redux": "^4.0.8",
"redux": "^3.6.0",
"redux-devtools-extension": "^2.13.0",
"redux-logger": "^2.8.2",
"redux-saga": "^0.14.3",
"stacktrace-js": "^2.0.0",
"url-parse": "^1.1.9"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"babel-jest": "18.0.0",
"babel-plugin-module-resolver": "^2.7.0",
"babel-preset-react-native": "^2.0.0",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^7.0.1",
"eslint-watch": "^3.1.0",
"jest": "18.1.0",
"jsx-control-statements": "^3.2.5",
"react-test-renderer": "15.4.2",
"reactotron-react-native": "^1.10.0",
"reactotron-redux": "^1.10.0",
"reactotron-redux-saga": "^1.10.0",
"source-map": "^0.5.6",
"wml": "0.0.82"
},
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 16
- Comments: 26 (6 by maintainers)
Adding
BatchedBridge
as a subspec in yourPodfile
resolves the issue as @javache indicates. The tutorial at https://facebook.github.io/react-native/docs/integration-with-existing-apps.html should be updated to reflect this, as of right there is an error.You need to add a dependency on the RCTBatchedBridge subspec (if using 0.46) or RCTCxxBridge (if newer).
The following should work:
Replace
BatchedBridge
withCxxBridge
and addDoubleConversion
,Folly
, andGLog
. I’m not sure why we need all those libraries, React-Native is becoming more and more moving parts (that unfortunately can cause their own problems).I’m sticking with
BatchedBridge
for now. After waiting 15 minutes for my poor Mac Mini to installboost
(another dependency that popped up) I cancelled it.Adding
CxxBridge
doesn’t save my ass. Even addingDoubleConversion
,Folly
,GLog
, the linking error stands still. My podfile is also for 0.51. What a nightmare!In my case (0.46.3), I added React/BatchedBridge into the dependencies in Podfile and the problem went away.
@MemoryReload Yeah, when in doubt, remove npm/yarn lockfiles, remove
node_modules
and install withyarn
. That works for me 99.9% of times too 😄Duplicate of #14423
@RobertWSaunders Saved my night, thanks 😉
+1
@calcal12 If you sure that you have the correct settings in your project
Podfile
and have installed all the dependences. You may try thisnpm link
in your project main folder. It works for me and I don’t know why. But it works. Good luck, buddy.+1, it only happend when i archive the project, i can successfully run and build it but when it comes to archive there are the following errors
+1