react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
256 stars 2 forks source link

Building iOS generic build error #35

Open trglairnarra opened 4 years ago

trglairnarra commented 4 years ago

Environment

System: OS: macOS Mojave 10.14.6 CPU: (4) x64 Intel(R) Core(TM) i5-4570R CPU @ 2.70GHz Memory: 645.54 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.22.0 - /usr/local/bin/yarn npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 Android SDK: API Levels: 22, 23, 24, 26, 27, 28, 29 Build Tools: 23.0.1, 26.0.3, 27.0.0, 27.0.1, 27.0.3, 28.0.0, 28.0.3, 29.0.0 System Images: android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 3.4 AI-183.5429.30.34.5452501 Xcode: 11.1/11A1027 - /usr/bin/xcodebuild Languages: Python: 2.7.16 - /usr/local/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.0 => 0.62.0 npmGlobalPackages: react-native: Not Found

Upgrading version

The project was originally made in v59.9 then i upgraded it to v0.62.0

Description

I used this one in upgrading the project. So far everything works great. I was even able to build the iOS on debug. also followed the migration guide found on this repo

Reproducible demo

Building the iOS on generic iOS device results in an error about Flipper and Folly i think. Screen Shot 2020-04-03 at 3 46 05 PM

martinezguillaume commented 4 years ago

Thanks God, exactly the same problem here with project upgraded from 0.61.5 to 0.62... Build if for Device or Simulator, but fail if generic iOS device...

lucasbento commented 4 years ago

@passy any leads on how to solve this?

Seems to be the same issue as facebook/react-native#28419.

passy commented 4 years ago

Thanks for pinging. I hadn't seen that yet. cc @priteshrnandgaonkar

martinezguillaume commented 4 years ago

Here is my configuration :

Target Debug :

                                 ...
                ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
                CLANG_ENABLE_MODULES = YES;
                DEAD_CODE_STRIPPING = YES;
                ENABLE_BITCODE = NO;
                GCC_PREPROCESSOR_DEFINITIONS = (
                    "$(inherited)",
                    "COCOAPODS=1",
                    "FB_SONARKIT_ENABLED=1",
                );
                SWIFT_OBJC_BRIDGING_HEADER = "Milinus-Bridging-Header.h";
                SWIFT_OPTIMIZATION_LEVEL = "-Onone";
                SWIFT_VERSION = 5.0;
                VERSIONING_SYSTEM = "apple-generic";

Project Debug

                                 ...
                LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
                LIBRARY_SEARCH_PATHS = (
                    "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
                    "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
                    "\"$(inherited)\"",
                );

My flipper config in Podfile :

def add_flipper_pods!
  version = '~> 0.33.1'
  pod 'FlipperKit', version, :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug'
  pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug'
end
# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

I follow this guide to upgrade and this project. I think that everything is correct

priteshrnandgaonkar commented 4 years ago

@martinezguillaume, My initial guess was that FB_SONARKIT_ENABLED=1 is not defined, but it seems to me that you have added it. Can you try adding -DFB_SONARKIT_ENABLED=1 in the compiler flag as well, and see if that solves the problem. Also in Podfile, do you call add_flipper_pods! after defining it ?

@martinezguillaume, I will try reproducing the above errors in the project which you shared.

@trglairnarra Seems like this patch doesn't have all the changes, can you make sure you have the changes which @martinezguillaume has shared in the above comments. Let me know if that works for you.

priteshrnandgaonkar commented 4 years ago

@martinezguillaume, I forked your project, and it worked for me without doing any changes.

Screen Shot 2020-04-07 at 11 34 02 AM

martinezguillaume commented 4 years ago

@priteshrnandgaonkar I'm not sure where to add the flag in xcode, can you enlighten me ? Yes I call like in the guide :

  add_flipper_pods!
  post_install do |installer|
    flipper_post_install(installer)
  end

And are you sure you successfully build for generic iOS device and not for simulator ? Thanks again for your help !

priteshrnandgaonkar commented 4 years ago

@martinezguillaume, why are you trying to build against Generic iOS Device, it won't install in any simulator, right ? To test it out you need to select the simulator and then install it ?

Last time I had built against a simulator, I was able to repro the error when I built for generic iOS Device. But still I would like to know what is the usecase for building it against Generic iOS Device.

priteshrnandgaonkar commented 4 years ago

Having said that, it should still build successfully for Generic iOS Device. Let me see what can be done.

martinezguillaume commented 4 years ago

@priteshrnandgaonkar Thanks !! 😀 I'm building it with Generic iOS Device for production. I'm using a tool to deploy my apps (bitrise) and I got this error. But, to archive a project, it builds with iOS generic device, right ?

priteshrnandgaonkar commented 4 years ago

Yes, to archive, it has to be built with generic iOS device. Bytw, I think I got the reason why this is happening, the Flipper and Flipper-Folly pod are built for 64-bit architecture, but as soon as I change it for generic architecture Flipper-Folly pod fails to build and I get the following error.

Screen Shot 2020-04-07 at 12 13 29 PM

If we make the Flipper-Folly pod build for generic architecture then that would solve the problem, as Flipper pod would be able to then build for all architectures and that should solve the problem.

@martinezguillaume, if you are enabling it in production, then do note that right now the initialisation code is behind a DEBUG flag. Do consider making the relevant changes before pushing it to prod.

priteshrnandgaonkar commented 4 years ago

I was able to solve this problem by doing the following steps. Click on the Flipper-Folly and Flipper target, change it's Architecture to be the standard one. Look at the following screenshots

Screen Shot 2020-04-07 at 12 44 00 PM Screen Shot 2020-04-07 at 12 43 43 PM

Then for Flipper-Folly target, go in the build phases and remove Rcu.h and Rcu.cpp from the compile sources.

Screen Shot 2020-04-07 at 12 44 27 PM

Then try to build it with generic iOS Device, it should build. @martinezguillaume, let me know if that works.

martinezguillaume commented 4 years ago

Oh my.. It works great with generic and simulator builds 🥳! Thanks again ! But there is no side effect with removing Rcu.cpp from Flipper ?

And everyone in 0.62 should have this problem no ?

priteshrnandgaonkar commented 4 years ago

Apparently, No, its not required to build Flipper, if it was then the build would have failed. I will update the Flipper-Folly and Flipper pod accordingly, so that this manual change is not needed.

martinezguillaume commented 4 years ago

You rock ! So we'll have to update the fipper version inside our Podfile ?

priteshrnandgaonkar commented 4 years ago

yupp, and thats it, but I am working on the fixes on the podspec side. Will update here, once that is done.

trglairnarra commented 4 years ago

@martinezguillaume, My initial guess was that FB_SONARKIT_ENABLED=1 is not defined, but it seems to me that you have added it. Can you try adding -DFB_SONARKIT_ENABLED=1 in the compiler flag as well, and see if that solves the problem. Also in Podfile, do you call add_flipper_pods! after defining it ?

@martinezguillaume, I will try reproducing the above errors in the project which you shared.

@trglairnarra Seems like this patch doesn't have all the changes, can you make sure you have the changes which @martinezguillaume has shared in the above comments. Let me know if that works for you.

Yep, i already had the changes same with @martinezguillaume, some changes aren't on the upgrade-helper (sadly), though i was able to find the bridging here and the sonarkit enabled here, so basically roaming around this repo fixes the issues i encounter and i'm happy with that one. (will keep it posted here so that if someone stumble on this errors)

And changing the architecture to standard one and also removing Rcu.h and Rcu.cpp actually works (kudos).

Though i'm a little confused.. I also thought that you cannot archive unless you successfully build in generic ios device.. but I tried archiving before without building in generic ios device and it actually achives pretty neat..

Anyway, thank you so much @priteshrnandgaonkar for the time and specially for the fix and will just check again after you made the podfile adjustment. :)

priteshrnandgaonkar commented 4 years ago

Flipper and FlipperKit 0.37.0 should solve it. Let me know if it doesn't work.

martinezguillaume commented 4 years ago

It’s working very nice ! Thanks for your work ! However I’ve got another issue with Release scheme, but I created another issue so you can close that one ! 😀

DracotMolver commented 4 years ago

@priteshrnandgaonkar you saved my life!!!. Thanks. I'm working on a 32-bit mac I just realized about it, I thought all this time it was a 64 bit machine. I feel dumb and cheated lol