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

When upgrading to 0.64-rc3, error: Cycle in dependencies between targets 'FBReactNativeSpec' #31034

Closed
esilverberg opened this issue Feb 23, 2021 · 25 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot. Type: Upgrade Issue Issues reported from upgrade issue form

Comments

@esilverberg
Copy link

Description

When upgrading to 0.64-rc3, I was stuck for many hours today on this compliation error:

Cycle in dependencies between targets 'BVLinearGradient' and 'FBReactNativeSpec'.

The initial target is irrelevant; if I removed BVLinearGradient it would still happen for many different native libraries and FBReactNativeSpec.

React Native version:

0.64-rc3 on iOS

Steps To Reproduce

Repro was consistent in my project. Maybe has something to do with the fact that I use use_frameworks!, and in the latest sample Podfile React Native does not include this directive.

Workaround

I was able to workaround this issue (and thus want to document it here for others who may get stuck) by:

Navigating to the FBReactNativeSpec target in the Pods project and deleting [CP-User] Generate Specs step.

I then navigated in the terminal to:

<project>/node_modules/react-native/scripts

And I manually ran from the terminal:

./generate-specs.sh

@paulxuca
Copy link

Make sure to update all your dependencies that rely on React as a dependency in podspec to a version that relies on React-Core. (Just ran into this issue a few hours ago)

@chrisglein chrisglein added the Type: Upgrade Issue Issues reported from upgrade issue form label Feb 23, 2021
@github-actions
Copy link

Do you need help upgrading to a newer React Native version? Visit the Upgrade Support repository or use the upgrade helper to see the changes that need to be made to upgrade your app.

@esilverberg
Copy link
Author

I am pretty confident this is not an upgrade issue. Every single time I run pod install, I see [CP-User] Generate Specs re-added to FBReactNativeSpec and I must delete it each time to ensure the build does not fail with this message.

@schmidan
Copy link

schmidan commented Mar 15, 2021

I seem to be running into the same issue.
The workaround by @esilverberg does work but needs to be done after every pod install.

Showing All Messages
Cycle inside FBReactNativeSpec; building could produce unreliable results. This usually can be resolved by moving the shell script phase '[CP-User] Generate Specs' so that it runs before the build phase that depends on its outputs.
Cycle details:
→ Target 'FBReactNativeSpec' has link command with output '/Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/FBReactNativeSpec'
○ Target 'FBReactNativeSpec' has compile command with input '/Users/schmidi/Projects/git/xx-12/code/ios/Pods/Target Support Files/FBReactNativeSpec/FBReactNativeSpec-dummy.m'
○ That command depends on command in Target 'FBReactNativeSpec': script phase “[CP-User] Generate Specs”
○ Target 'FBReactNativeSpec' has copy command from '/Users/schmidi/Projects/git/xx-12/code/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h' to '/Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/Headers/FBReactNativeSpec.h'
○ That command depends on command in Target 'FBReactNativeSpec': script phase “[CP-User] Generate Specs”


Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/FBReactNativeSpec ->

command: target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed-:Debug:Ld /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/FBReactNativeSpec normal ->

node: /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Objects-normal/arm64/FBReactNativeSpec-dummy.o ->

command: target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed-:Debug:CompileC /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Objects-normal/arm64/FBReactNativeSpec-dummy.o /Users/schmidi/Projects/git/xx-12/code/ios/Pods/Target Support Files/FBReactNativeSpec/FBReactNativeSpec-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler ->

node: <target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed--phase1--cp-user--generate-specs> ->

command: Gate target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed--phase1--cp-user--generate-specs ->

node: /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/DerivedSources/codegen-FBReactNativeSpec.log ->

command: target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed-:Debug:PhaseScriptExecution [CP-User] Generate Specs /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Script-1E8DC3BEC0135B5B2A4A2B289C3C530F.sh ->

node: /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Script-1E8DC3BEC0135B5B2A4A2B289C3C530F.sh ->

command: target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed-:Debug:WriteAuxiliaryFile /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Script-1E8DC3BEC0135B5B2A4A2B289C3C530F.sh ->

node: <target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed--phase0-copy-headers> ->

command: Gate target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed--phase0-copy-headers ->

node: /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/Headers/FBReactNativeSpec.h ->

command: target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed-:Debug:CpHeader /Users/schmidi/Projects/git/xx-12/code/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/Headers/FBReactNativeSpec.h ->

node: /Users/schmidi/Projects/git/xx-12/code/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h/ ->

directoryTreeSignature: � ->

directoryContents: /Users/schmidi/Projects/git/xx-12/code/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h ->

node: /Users/schmidi/Projects/git/xx-12/code/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h ->

command: target-FBReactNativeSpec-596df37657fef3d87ef16631abbc611bd8e73feadee6a8e5c14524fc300acaed-:Debug:PhaseScriptExecution [CP-User] Generate Specs /Users/schmidi/Library/Developer/Xcode/DerivedData/xx-gvguladiqholtqeybzaixjacqpek/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Script-1E8DC3BEC0135B5B2A4A2B289C3C530F.sh

[!] FBReactNativeSpec has added 1 script phase. Please inspect before executing a build. See https://guides.cocoapods.org/syntax/podspec.html#script_phases for more information.

@maestor
Copy link

maestor commented Mar 16, 2021

don't know if related, but I had similar problems and workaround works. but my issue was related to thing that I started ios build with yarn. it's related somehow to the fact that this Generate Specs is npm script and won't execute correctly if you run with yarn. after I tried just npx react-native run-ios from manual -> build success.

@billnbell
Copy link
Contributor

This is not resolved. Still happens on 0.64.x

@marf
Copy link

marf commented Mar 18, 2021

Same problem here.

@paulxuca
Copy link

We've fixed this by moving the build phase that react native adds before the headers phase (It is added after by default)

@billnbell
Copy link
Contributor

Is there a release ?

@JB-CHAUVIN
Copy link

Same problem goes for me, what is the solution ?

We've fixed this by moving the build phase that react native adds before the headers phase (It is added after by default)

How did you do that ?

@paulxuca
Copy link

@JB-CHAUVIN

Click on the Pods project on the left sidebar
Go under Build Phases
Make sure [CP-User] Generate Specs is before Headers

@marf
Copy link

marf commented Mar 25, 2021

Is there a permanent patch for this? Because the fix works the problem is that we have to re-do it every time we run pod install

@esilverberg
Copy link
Author

esilverberg commented Mar 25, 2021

We should probably ask FB to re-open this issue, since it seems clear that it is affecting multiple people and is not resolved in the release version.

@PeteTheHeat @janicduplessis Would you be willing to re-open this issue since this appears to be affecting a number of folks? (apologies in advance if I have at-mentioned the wrong people -- your names came up related to the FBReactNativeSpec podspec file, per this link.)

@tushar-singhal
Copy link

Screenshot 2021-03-25 at 16 23 40

@JB-CHAUVIN when you select pods on left sidebar, select `FBReactNativeSpec ` and then you will see this

@JB-CHAUVIN
Copy link

Great thanks for the replies,

I can confirm that @tushar-singhal @paulxuca solution is working.

And I can confirm that we need a permanent fix for this problem !

@pan-pawel
Copy link

Workaround works but doing it each time we use pod install wasn't a solution.
In our case only getting rid of use_frameworks! helped. Luckily, it turned out that we don't need it anymore

@esilverberg
Copy link
Author

Here is a proposed solution from @gmapnl in the react-native-screens project:

software-mansion/react-native-screens#842 (comment)

post_install do |installer|
  react_native_post_install(installer)
  
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
    
    if (target.name&.eql?('FBReactNativeSpec'))
      target.build_phases.each do |build_phase|
        if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
          target.build_phases.move(build_phase, 0)
        end
      end
    end
  end
end

@nnaren1902
Copy link

@esilverberg recommended fix works perfectly well. No need to for any more manual steps.

But still the underlying issue must be fixed in RN!

@SudoPlz
Copy link
Contributor

SudoPlz commented Apr 16, 2021

The fix is not working for us in github actions... Not sure why.

Does anyone know if that's already fixed in any of the nightly builds?

@edwardlafoy
Copy link

Any updates on this? Just ran into this issue on 0.64.2.

@MoOx
Copy link
Contributor

MoOx commented Jun 22, 2021

If you have the issue with BVLinearGradient, this fix is in react-native-linear-gradient/react-native-linear-gradient#500 but has not been released yet. You should specify react-native-linear-gradient version from git like this

package.json

  "react-native-linear-gradient": "https://github.com/react-native-linear-gradient/react-native-linear-gradient#0e3af58",

It's not a react native issue per se.

If you have a cycle issue that is mentioning another lib, you should update the lib or open an issue for the lib (and/or patch the lib by replacing in dependency React to React-Core like in the PR above (use https://www.npmjs.com/package/patch-package if needed).

If you have the cycle issue without any explicit deps except FBReactNativeSpec, you might need to have a look to #31149 where you will find a workaround.

@ArTM96
Copy link

ArTM96 commented Oct 21, 2021

@JB-CHAUVIN

Click on the Pods project on the left sidebar Go under Build Phases Make sure [CP-User] Generate Specs is before Headers

If anyone finds that this fix doesn't work, deleting the [CP-User] Generate spec completely worked for me. App complies/runs as expected.

@sikloDev
Copy link

@JB-CHAUVIN

Click on the Pods project on the left sidebar Go under Build Phases Make sure [CP-User] Generate Specs is before Headers

Sorry sir but could you be more specific . I am new to IOS everything works fine on Android but when setup to IOS it is not working . I have the script phase error .

@cormacncheese
Copy link

This helped me

sudo arch -x86_64 gem install ffi
arch -x86_64 pod install

@Hannah-Alto
Copy link

Hannah-Alto commented Jan 25, 2022

What worked for me is selecting Dependency order instead of Manual Order

Screen Shot 2022-01-25 at 12 07 31 PM

@facebook facebook locked as resolved and limited conversation to collaborators Feb 23, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot. Type: Upgrade Issue Issues reported from upgrade issue form
Projects
None yet
Development

No branches or pull requests