infinitered / ignite

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!
MIT License
17.44k stars 1.38k forks source link

Project build fails with Flipper error #1681

Closed alechko closed 3 years ago

alechko commented 3 years ago

Existing ignite project fails to build with a Flipper error:

** BUILD FAILED **

The following build commands failed:
        CompileC /Users/user/Library/Developer/Xcode/DerivedData/MyApp-descajhrleferffvunxcuqolvdjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/DistributedMutex.o /Users/user/dev/docker/friendly/MyApp/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

package.json:

{
  "name": "my-app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "ios": "npx react-native run-ios",
    "start": "react-native start",
    "test:e2e": "detox test -c ios.sim.debug",
    "build:e2e": "detox build -c ios.sim.debug",
    "ci:test:e2e": "detox test -c ios.sim.release -l verbose --cleanup",
    "ci:build:e2e": "detox build -c ios.sim.release",
    "compile": "tsc --noEmit -p . --pretty",
    "format": "npm-run-all format:*",
    "format:js": "prettier --write \"**/*.js\"",
    "format:json": "prettier --write \"**/*.json\"",
    "format:md": "prettier --write \"**/*.md\"",
    "format:ts": "prettier --write \"**/*.ts{,x}\"",
    "lint": "eslint index.js app storybook test --fix --ext .js,.ts,.tsx && yarn format",
    "patch": "patch-package",
    "storybook": "start-storybook -p 9001 -c ./storybook",
    "test": "jest",
    "adb": "adb reverse tcp:9090 tcp:9090 && adb reverse tcp:3000 tcp:3000 && adb reverse tcp:9001 tcp:9001 && adb reverse tcp:8081 tcp:8081",
    "postinstall": "node ./bin/postInstall",
    "build-ios": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios",
    "build-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"
  },
  "dependencies": {
    "@eva-design/eva": "^2.1.0",
    "@react-native-async-storage/async-storage": "^1.14.1",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "^5.11.10",
    "@react-navigation/native": "5.9.3",
    "@react-navigation/stack": "5.12.8",
    "@ui-kitten/components": "^5.1.0",
    "@ui-kitten/eva-icons": "^5.1.0",
    "@unimodules/core": "6.0.0",
    "apisauce": "2.0.0",
    "expo-localization": "9.1.0",
    "i18n-js": "3.8.0",
    "mobx": "6.1.8",
    "mobx-react-lite": "3.2.0",
    "mobx-state-tree": "5.0.1",
    "ramda": "0.27.1",
    "react": "17.0.1",
    "react-native": "0.64.0",
    "react-native-gesture-handler": "1.10.3",
    "react-native-keychain": "6.2.0",
    "react-native-safe-area-context": "3.1.8",
    "react-native-screens": "2.18.1",
    "react-native-splash-screen": "3.2.0",
    "react-native-svg": "^12.1.1",
    "react-native-unimodules": "0.12.0",
    "reactotron-mst": "3.1.3",
    "reactotron-react-native": "5.0.0",
    "validate.js": "0.13.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/plugin-proposal-decorators": "7.12.1",
    "@babel/plugin-proposal-optional-catch-binding": "7.12.1",
    "@babel/runtime": "^7.12.5",
    "@storybook/addon-storyshots": "6.1.10",
    "@storybook/react-native": "5.3.23",
    "@storybook/react-native-server": "5.3.23",
    "@types/i18n-js": "3.0.3",
    "@types/jest": "26.0.19",
    "@types/ramda": "0.27.32",
    "@types/react": "16.14.0",
    "@types/react-native": "0.63.40",
    "@types/react-test-renderer": "16.9.4",
    "@typescript-eslint/eslint-plugin": "4.10.0",
    "@typescript-eslint/parser": "4.10.0",
    "babel-jest": "26.6.3",
    "babel-loader": "8.2.2",
    "bufferutil": "4.0.2",
    "canvas": "2.6.1",
    "detox": "17.14.5",
    "eslint": "7.15.0",
    "eslint-config-prettier": "7.0.0",
    "eslint-config-standard": "16.0.2",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-node": "11.1.0",
    "eslint-plugin-promise": "4.2.1",
    "eslint-plugin-react": "7.21.5",
    "eslint-plugin-react-native": "3.10.0",
    "fbjs-scripts": "3.0.0",
    "jest": "^26.6.3",
    "jest-circus": "25.5.4",
    "jest-expo": "40.0.1",
    "jetifier": "1.6.6",
    "mocha": "8.2.1",
    "npm-run-all": "4.1.5",
    "patch-package": "6.2.2",
    "postinstall-prepare": "1.0.1",
    "prettier": "2.2.1",
    "react-devtools-core": "4.10.1",
    "react-dom": "16.14.0",
    "react-native-web": "0.15.1",
    "react-powerplug": "1.0.0",
    "react-test-renderer": "17.0.1",
    "rimraf": "3.0.2",
    "solidarity": "2.3.1",
    "typescript": "4.2.3",
    "utf-8-validate": "5.0.3"
  },
  "jest": {
    "preset": "jest-expo",
    "setupFiles": [
      "<rootDir>/node_modules/react-native/jest/setup.js",
      "<rootDir>/test/setup.ts"
    ],
    "testPathIgnorePatterns": [
      "/node_modules/",
      "/e2e"
    ],
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|@react-native|@react-navigation|@storybook|@react-native-community|expo-localization|@unimodules)"
    ]
  },
  "prettier": {
    "printWidth": 100,
    "semi": false,
    "singleQuote": false,
    "trailingComma": "all"
  },
  "detox": {
    "test-runner": "jest",
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/FriendlyApp.app",
        "build": "xcodebuild -workspace ios/FriendlyApp.xcworkspace -scheme FriendlyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -destination 'name=iPhone 11'",
        "type": "ios.simulator",
        "name": "iPhone 11"
      },
      "ios.sim.release": {
        "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/FriendlyApp.app",
        "build": "xcodebuild -workspace ios/FriendlyApp.xcworkspace -scheme FriendlyApp -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -destination 'name=iPhone 11'",
        "type": "ios.simulator",
        "name": "iPhone 11"
      }
    }
  },
  "eslintConfig": {
    "root": true,
    "parser": "@typescript-eslint/parser",
    "extends": [
      "plugin:@typescript-eslint/recommended",
      "plugin:react/recommended",
      "plugin:react-native/all",
      "standard",
      "prettier",
      "prettier/@typescript-eslint"
    ],
    "plugins": [
      "@typescript-eslint",
      "react",
      "react-native"
    ],
    "parserOptions": {
      "ecmaFeatures": {
        "jsx": true
      },
      "project": "./tsconfig.json"
    },
    "settings": {
      "react": {
        "pragma": "React",
        "version": "detect"
      }
    },
    "globals": {
      "__DEV__": false,
      "jasmine": false,
      "beforeAll": false,
      "afterAll": false,
      "beforeEach": false,
      "afterEach": false,
      "test": false,
      "expect": false,
      "describe": false,
      "jest": false,
      "it": false
    },
    "rules": {
      "@typescript-eslint/ban-ts-ignore": 0,
      "@typescript-eslint/explicit-function-return-type": 0,
      "@typescript-eslint/explicit-member-accessibility": 0,
      "@typescript-eslint/explicit-module-boundary-types": 0,
      "@typescript-eslint/indent": 0,
      "@typescript-eslint/member-delimiter-style": 0,
      "@typescript-eslint/no-empty-interface": 0,
      "@typescript-eslint/no-explicit-any": 0,
      "@typescript-eslint/no-object-literal-type-assertion": 0,
      "@typescript-eslint/no-var-requires": 0,
      "comma-dangle": 0,
      "multiline-ternary": 0,
      "no-undef": 0,
      "no-unused-vars": 0,
      "no-use-before-define": "off",
      "quotes": 0,
      "react-native/no-raw-text": 0,
      "react/no-unescaped-entities": 0,
      "react/prop-types": "off",
      "space-before-function-paren": 0
    }
  }
}

current Flipper version (installed with brew): 0.88.0


Steps to reproduce

  1. run yarn ios

ignite doctor results:

npx ignite-cli doctor
System
  platform           darwin                                                    
  arch               x64                                                       
  cpu                8 cores       Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz    
  directory          MyApp   /Users/user/dev/MyApp 

JavaScript (and globally-installed packages)
  node                            15.9.0       /usr/local/bin/node 
  npm                             7.5.3        /usr/local/bin/npm  
    @prettier/plugin-php          0.14.3                           
    @react-native-community/cli   4.14.0                           
    expo-cli                      4.1.6                            
    gulp-cli                      2.3.0                            
    gulp                          4.0.2                            
    ios-deploy                    1.10.0                           
    npm                           7.5.3                            
    prettier-plugin-apex          1.7.0                            
    prettier                      2.1.2                            
    react-native-rename           2.4.1                            
    react-native                  0.63.4                           
    react                         16.13.1                          
    serve                         11.3.2                           
    yarn                          1.22.10                          
  yarn                            1.22.10      /usr/local/bin/yarn 
    expo-cli                      4.1.6                            

Ignite
  ignite-cli         6.10.3       /Users/user/.npm/_npx/e31027f3785124a8/node_modules/.bin/ignite      
  ignite src         build        /Users/user/.npm/_npx/e31027f3785124a8/node_modules/ignite-cli/build 

Android
  java               11.0.6       /usr/bin/java                
  android home       -            /usr/local/share/android-sdk 

iOS
  xcode              12.5       
  cocoapods          1.10.1       /Users/user/.gem/bin/pod 
alechko commented 3 years ago

as a workaround I've removed flipper for now from the Podfile

jamonholmgren commented 3 years ago

Thanks @alechko -- I'll see if we can replicate this issue.

derekgreenberg commented 3 years ago

@alechko The generated package.json file in your existing project does not appear to be up to date with the latest ignite version 6.10.3 shown in your log of npx ignite-cli doctor

I matched your node version of 15.9.0 and removed any global installations of ignite-cli from my system, then tried to reproduce your issue. I was able to ignite a new app and run the iOS emulator without issues. Also, I started up Flipper 0.88.0 and verified that it was logging my session with the new app.

Here are my ignite-cli doctor logs, my terminal session logs when igniting a new app, the scripts portion of the generated package.json in the new app, and the Flipper session:

ignite doctor:

System
  platform           darwin                                                
  arch               x64                                                   
  cpu                6 cores      Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz 
  directory          foo          /Users/derekgreenberg/git/foo            

JavaScript (and globally-installed packages)
  node               15.9.0       /Users/derekgreenberg/.nvm/versions/node/v15.9.0/bin/node 
  npm                7.5.3        /Users/derekgreenberg/.nvm/versions/node/v15.9.0/bin/npm  
    npm              7.5.3                                                                  
  yarn               1.22.5       /Users/derekgreenberg/.yarn/bin/yarn                      
    pod-install      0.1.21                                                                 

Ignite
  ignite-cli         6.11.0       /Users/derekgreenberg/.npm/_npx/e31027f3785124a8/node_modules/.bin/ignite      
  ignite src         build        /Users/derekgreenberg/.npm/_npx/e31027f3785124a8/node_modules/ignite-cli/build 

Android
  java               1.8.0_232    /usr/bin/java                             
  android home       -            /Users/derekgreenberg/Library/Android/sdk 

iOS
  xcode              12.5       
  cocoapods          1.10.1       /usr/local/bin/pod 

Here is my session of igniting a new app:

~/git> npx ignite-cli new foo
Need to install the following packages:
  ignite-cli
Ok to proceed? (y) y
   · · · · · · · · · · · · · · · · · · 🔥 Ignite 🔥 · · · · · · · · · · · · · · · · · ·

    █ Creating foo using Ignite 6.10.3
    █ Powered by Infinite Red - https://infinite.red
    █ Using react-native-cli
    ────────────────────────────────────────────────

    🔥 Igniting app
    🖨  3D-printing a new React Native app
    ☕️ Baking CocoaPods
    🗄  Backing everything up in source control

   Ignite CLI ignited foo in 26.14s

Scripts portion of the ignited app's package.json:

~/git/foo> cat package.json
{
  "name": "foo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test:e2e": "detox test -c ios.sim.debug",
    "build:e2e": "detox build -c ios.sim.debug",
    "ci:test:e2e": "detox test -c ios.sim.release -l verbose --cleanup",
    "ci:build:e2e": "detox build -c ios.sim.release",
    "compile": "tsc --noEmit -p . --pretty",
    "format": "npm-run-all format:*",
    "format:js": "prettier --write \"**/*.js\"",
    "format:json": "prettier --write \"**/*.json\"",
    "format:md": "prettier --write \"**/*.md\"",
    "format:ts": "prettier --write \"**/*.ts{,x}\"",
    "lint": "eslint index.js app storybook test --fix --ext .js,.ts,.tsx && yarn format",
    "patch": "patch-package",
    "storybook": "start-storybook -p 9001 -c ./storybook",
    "test": "jest",
    "adb": "adb reverse tcp:9090 tcp:9090 && adb reverse tcp:3000 tcp:3000 && adb reverse tcp:9001 tcp:9001 && adb reverse tcp:8081 tcp:8081",
    "postinstall": "node ./bin/postInstall",
    "build-ios": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios",
    "build-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
    "clean": "react-native-clean-project",
    "clean-all": "npx react-native clean-project-auto"
  },

Running the new app in iOS:

~/git/foo> npx react-native run-ios
info Found Xcode workspace "foo.xcworkspace"
info Launching iPhone 12 (iOS 14.5)
info Building (using "xcodebuild -workspace foo.xcworkspace -configuration Debug -scheme foo -destination id=175E0639-34E8-4482-A253-BCC969ED1E28")
success Successfully built the app
info Installing "/Users/derekgreenberg/Library/Developer/Xcode/DerivedData/foo-fezwzfgpoewmemdsmxhgfaridmxo/Build/Products/Debug-iphonesimulator/foo.app"
info Launching "org.reactjs.native.example.foo"
success Successfully launched the app on the simulator

Here is the Flipper logs showing the new app working:


10:04:31.679
36527
foo
Invalidating <RCTCxxBridge: 0x7f8fc1508c00> (parent: <RCTBridge: 0x6000021956c0>, executor: (null))
10:04:32.105
36527
foo
Require cycle: app/navigators/index.ts -> app/navigators/main-navigator.tsx -> app/screens/index.ts -> app/screens/demo/demo-list-screen.tsx -> app/models/index.ts -> app/models/root-store/setup-root-store.ts -> app/models/environment.ts -> app/services/reactotron/index.ts -> app/services/reactotron/reactotron.ts -> app/navigators/index.ts

Require cycles are allowed, but can result in uninitializ
10:04:32.120
36527
foo
Running application foo ({
    initialProps =     {
    };
    rootTag = 11;
})
10:04:32.124
36527
foo
Running "foo" with {"rootTag":11,"initialProps":{}}

Let me know if any of the above is helpful and if there is anything else I can investigate to help you solve the issue with your app. Here is one solution you can try on an existing ignited app:

You may need to ensure your app is running react-native version 0.64.1 rather than 0.64.0 and you MAY have to replace this line in Podfile:

use_flipper!({ 'Flipper' => '0.75.1' })

With this line:

use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')

alechko commented 3 years ago

@derekgreenberg thanks, using use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1') in the Podfile worked!

as for the package.json and ignite, this is actually a two week old project, generated with npx ignite-cli generate in the same manner you've suggested, in Apr 28, two weeks ago, I haven't updated anything since generating the project, so that's very weird to me that it stopped working all of a sudden.

I know for a fact that the only thing I've updated since generating the project is XCode to 12.5, so that might be somehow related.

Anyway, using the suggested setting for the Flipper builds successfully now, thanks again!