Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Pod issues #17893

Closed
Plo4ox opened this issue Feb 7, 2018 · 37 comments
Closed

iOS Pod issues #17893

Plo4ox opened this issue Feb 7, 2018 · 37 comments
Labels
Platform: iOS iOS applications. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Plo4ox
Copy link

Plo4ox commented Feb 7, 2018

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 9.4.0
Yarn: Not Found
npm: 4.6.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.0 => 0.53.0

Target Platform: iOS (11.2)

Steps to Reproduce

Follow the tutorial presented here:
https://facebook.github.io/react-native/docs/integration-with-existing-apps.html

Expected Behavior

Succeed to build the app.

Actual Behavior

it doesn't work .

I'm kidding, the build just failed with the following errors:

  • Yoga-internal.h:11:10 : fatal error: 'algorithm' file not found: #include
  • RCTConvert.h:19:9 : fatal error: could not build module 'yoga': #import <yoga/Yoga.h>

Those errors occur while building module 'yoga' imported from React/Base/RCTConvert.h

screen shot 2018-02-07 at 10 28 39

Reproducible Demo

You can get the non working project on the following repo:

% git clone https://github.com/Plo4ox/ReactNativeIssues.git
% cd ReactNativeIssues
% npm install
% cd ios
% pod install
% cd ..
% react-native run-ios

Or just follow the steps:

% create-react-native-app AwesomeProject
% cd AwesomeProject
% mkdir ios

// Modify the package.json file fill it content indicated in the documentation:

{
  "name": "MyReactNativeApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  }
}

% npm install --save react@16.2.0 react-native

// Create a new single view app project into the iOS directory, using Xcode

% cd ios
% pod init

// Fill the Podfile with the content indicated in the documentation, be sure to keep your default target

 use_frameworks!

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

% pod install
% cd ..
% react-native run-ios

Pull Request

A PR related to this issue has already been created here:
#17764

@Titozzz
Copy link
Collaborator

Titozzz commented Feb 7, 2018

Same issue

@Titozzz
Copy link
Collaborator

Titozzz commented Feb 8, 2018

The PR does fix the issue #17764

@xiaoyongchen
Copy link

xiaoyongchen commented Feb 12, 2018

Same issue
'algorithm' file not found
Could not build module 'yoga'

  • "react": "16.0.0-alpha.12"=>"react": "^16.2.0",
  • "react-native": "0.47.1",=>"react-native": "^0.53.0",
    pod 'React', :path => '../zm_parents/node_modules/react-native', :subspecs => [
    'Core',
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    'RCTVibration',
    'RCTLinkingIOS',
    'RCTImage',
    'RCTAnimation',
    #'RCTAdSupport',
    'RCTSettings',
    'BatchedBridge',
    'DevSupport',
    'ART',

Add any other subspecs you want to use in your project

]

RN >= 0.42.0

pod "yoga", :path => "../zm_parents/node_modules/react-native/ReactCommon/yoga"

@xiaoyongchen
Copy link

How to solve this problem

@msand
Copy link
Contributor

msand commented Feb 12, 2018

Archiving an iOS build seems broken with the new Cocoapods 1.4.0 as well. Downgrading it to 1.3.1 seems to help.

@amardeepranu
Copy link

Also getting this

@Plo4ox
Copy link
Author

Plo4ox commented Feb 15, 2018

@makovkastar That's what I did at first, and indeed it works, but it would be cool to be able to use the latest version :)

@ushu
Copy link

ushu commented Feb 16, 2018

@Plo4ox downgrading seems the most reliable option: I tried 0.52, 0.53 and even 0.54-rc with no more success...

@FlyOrDie
Copy link

FlyOrDie commented Feb 16, 2018

Same issue here. Don't think, that downgrading is something, that is supposed to be the best solution :)

UPDATE
Both downgrading of cocoapods version 1.4.0 -> 1.3.1 and React Native 0.5.3 -> 0.5.1 didn't help with the issue :/

@msand
Copy link
Contributor

msand commented Feb 18, 2018

@FlyOrDie I also had to remove the inherited header search paths to get it to build, haven't had time to investigate further.

@FlyOrDie
Copy link

FlyOrDie commented Feb 18, 2018

@msand A strange thing helped me to solve the problem. I don't even know, why I did it. In pods file, I changed the sequence...

from:
'RCTText',
'RCTNetwork',

to:
'RCTNetwork',
'RCTText',

Started working. It is not related to cache in any way, because I was dropping caches of everything, including NPM every time to make experiments clean 🗡

@eapostol
Copy link

+1 encountering this issue as well, if one has to downgrade so be it, but this should not be the solution.

@krmao
Copy link

krmao commented Mar 2, 2018

it's still exists !

@hramos hramos added the Platform: iOS iOS applications. label Mar 5, 2018
@simonas88
Copy link

I am also encountering this issue when trying to upgrade from 0.51.0 to 0.52+

@msand
Copy link
Contributor

msand commented Mar 9, 2018

I hadn't noticed this was using the "use_frameworks!" my issues we're probably unrelated. Managed to get use_frameworks building with the patches from here: #17764 (comment) but archiving fails on 0.54 with this: #18205

@Plo4ox
Copy link
Author

Plo4ox commented Mar 10, 2018

@msand I wrote a comment on this issue #18205
The developer used Objc++ to pass object by references, and as Apple says here:
You cannot import C++ code directly into Swift. Instead, create an Objective-C or C wrapper for C++ code.
The fix here is to do something like CGSize * minimumSize instead of CGSize &minimumSize and of course to change the impacted files.
But as I said in my PR, I don't know if we should create a huge PR with all the fixes or keeping small PRs, and I'm still waiting for an answer ^^

@msand
Copy link
Contributor

msand commented Mar 11, 2018

I think at this point it's probably good to made a single PR with all the needed patches to have it working with manual linking, normal cocoapods, and cocoapods with use_frameworks! on.
I managed to get it working with 0.53.3, but building and archiving from XCode breaks, while it works from the CLI, not sure what command XCode runs, or what environment variables are different enough to cause the failure. #14749 (comment)

@msand
Copy link
Contributor

msand commented Mar 13, 2018

Found another workaround for the non use_frameworks case: #15838 (comment) Essentially a duplicate target for debugging with manually linked React Native modules, and using the xcodebuild cli to build release for simulator and archive for TestFlight / AppStore.

@react-native-bot react-native-bot added the Platform: macOS Building on macOS. label Mar 20, 2018
@hramos hramos removed the Platform: macOS Building on macOS. label Mar 29, 2018
@The0racle
Copy link

Having this issue on version 0.55. Did anybody find a solution?

@Plo4ox
Copy link
Author

Plo4ox commented Apr 9, 2018

@The0racle After a quick glance at the version 0.55.2, I had the following issue:
screen shot 2018-04-10 at 00 29 53
Is this the one you are referring to?
If so, it seems that it has been corrected in the current version of Master by the following commit: c787e0e
As @fkgozali said here, the RCTFabricUIManagerWrapper.mm shouldn't have been linked to the existing project since it's experimental.

@NrqhEIcsRi004
Copy link

Change use_frameworks! ==> # use_frameworks! ?

@koenpunt
Copy link
Contributor

koenpunt commented May 8, 2018

To apply patches automatically you can use the cocoapods-fix-react-native CocoaPods plugin. It currently has support for 0.53.3, 0.54.2, 0.54.4, and 0.55.3

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

@varakumar1105
Copy link

@Plo4ox Any progress on this ??

Thanks in advance

@xiaoxiaocainiao
Copy link

@NrqhEIcsRi004 good! version 0.55.4 works~

@sethdeckard
Copy link

sethdeckard commented Jun 5, 2018

@xiaoxiaocainiao I am experiencing this problem in a new project using version 0.55.4. I am also not using use_frameworks!.

@lazyjean
Copy link

react-native @0.55.4 have the same issue
My project need use use_frameworks!,
I fix the issue by change project settings

  1. navigate to target React
  2. Build Settings -> Always Search user Path(Deprecated) YES
  3. fix some easy header import errors

@ggsrivas
Copy link

I am using react-native@0.53.3. I faced all these issues. As suggested by others, I tried below steps,

  1. Build Settings -> Always Search user Path(Deprecated) YES for React Target.
  2. change #import <RCTAnimation/RCTValueAnimatedNode.h> to #import "RCTValueAnimatedNode.h"
  3. change #import <fishhook/fishhook.h> to import "fishhook.h"
    after all this I am getting below error,

Undefined symbols for architecture x86_64:
  "google::LogMessageFatal::LogMessageFatal(char const*, int)", referenced from:
      facebook::react::customJSCWrapper() in JSCWrapper.o
      facebook::react::setCustomJSCWrapper(facebook::react::JSCWrapper const*) in JSCWrapper.o
  "google::LogMessage::stream()", referenced from:
      facebook::react::customJSCWrapper() in JSCWrapper.o
      facebook::react::setCustomJSCWrapper(facebook::react::JSCWrapper const*) in JSCWrapper.o
  "google::LogMessageFatal::~LogMessageFatal()", referenced from:
      facebook::react::customJSCWrapper() in JSCWrapper.o
      facebook::react::setCustomJSCWrapper(facebook::react::JSCWrapper const*) in JSCWrapper.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Anyone else faced similar issue? Any suggestions on fixing it?

@ggsrivas
Copy link

I copied snipped from below location in my podfile and it seems to work fine,
https://gist.github.com/Jpunt/3fe75effd54a702034b75ff697e47578

It would have been awesome if react team could have fixed all these in a patch to 0.53 version and corresponding dependencies.

@hramos
Copy link
Contributor

hramos commented Jun 27, 2018

Please verify using the 0.56 release candidate.

@willswinson
Copy link

willswinson commented Jul 25, 2018

Getting this no matter what I do. I've updated the header search paths to search the React folder (recursive as well) in the node module folder and I've linked all libs.

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTConvert", referenced from:
      objc-class-ref in libRNImageCropPicker.a(ImageCropPicker.o)
  "_OBJC_CLASS_$_RCTRootView", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTViewManager", referenced from:
      _OBJC_CLASS_$_BlurViewManager in libreact-native-blur.a(BlurViewManager.o)
      _OBJC_CLASS_$_VibrancyViewManager in libreact-native-blur.a(VibrancyViewManager.o)
  "_OBJC_METACLASS_$_RCTViewManager", referenced from:
      _OBJC_METACLASS_$_BlurViewManager in libreact-native-blur.a(BlurViewManager.o)
      _OBJC_METACLASS_$_VibrancyViewManager in libreact-native-blur.a(VibrancyViewManager.o)
  "_RCTRegisterModule", referenced from:
      +[ImageCropPicker load] in libRNImageCropPicker.a(ImageCropPicker.o)
      +[BlurViewManager load] in libreact-native-blur.a(BlurViewManager.o)
      +[VibrancyViewManager load] in libreact-native-blur.a(VibrancyViewManager.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 **

However Xcode does not show a React folder in the Pods project's Pods folder, despite it being there in Finder (but this seems to be normal according to other guides I've found). And these undefined symbols' headers I can locate in Pods/Headers/React/React, which is strangely 2 React folders deep, is that correct?

I've tried so many different things and it cannot find these symbols.

Also get these warnings which probably has something to do with it:

ld: warning: ld: warning: ignoring file /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libRNKeychain.a, file was built for archive which is not the architecture being linked (x86_64): /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libRNKeychain.aignoring file /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libRNVectorIcons.a, file was built for archive which is not the architecture being linked (x86_64): /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libRNVectorIcons.a

ld: warning: ignoring file /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libReact.a, file was built for archive which is not the architecture being linked (x86_64): /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libReact.a
ld: warning: ignoring file /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libyoga.a, file was built for archive which is not the architecture being linked (x86_64): /Users/me/Documents/Development/Project/ios/build/Build/Products/Debug-iphonesimulator/libyoga.a

Which I've also tried to fix by changing the Pods project to Build Active Architectures = No

No luck.

@hramos
Copy link
Contributor

hramos commented Jul 25, 2018

@willswinson can you confirm this is happening in 0.56?

@hramos hramos added the Resolution: PR Submitted A pull request with a fix has been provided. label Jul 25, 2018
@iDay
Copy link

iDay commented Jul 31, 2018

create a empty swift file and bridgeing-header file can fix this

@ricsam
Copy link

ricsam commented Jul 31, 2018

Are you guys removing all *.xcodeproj from the Libraries section to prevent libraries from being compiled and linked twice?

@iDay
Copy link

iDay commented Jul 31, 2018

@ricsam yes, but you need to add a new start package script in your project build phrase
2018-07-31 9 48 01

@viktorlarsson
Copy link

viktorlarsson commented Aug 7, 2018

@willswinson @hramos Experiencing the same issue with 0.56, or something similar at least.

Undefined symbols for architecture x86_64:
  "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
  "facebook::react::systemJSCWrapper()", referenced from:
      -[RCTDevSettings isJSCSamplingProfilerAvailable] in RCTDevSettings.o
      -[RCTDevSettings toggleJSCSamplingProfiler] in RCTDevSettings.o
      _RCTNSErrorFromJSErrorRef in RCTJSCErrorHandling.o
  "_JSNoBytecodeFileFormatVersion", referenced from:
      +[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] in RCTJavaScriptLoader.o
      +[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in RCTJavaScriptLoader.o
  "_OBJC_CLASS_$_RCTCxxBridge", referenced from:
      objc-class-ref in RCTBridge.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@stale
Copy link

stale bot commented Nov 5, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 5, 2018
@Plo4ox Plo4ox closed this as completed Nov 6, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Nov 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests