Subito-it / PodBuilder

A tool to precompile CocoaPods pods
Other
284 stars 28 forks source link

react-native app pods not prebuilding #47

Closed habiiev closed 2 years ago

habiiev commented 2 years ago

After we tried to update our application to use the latest react-native version we got a problem with RCT-Folly pod.

Also, there are some problems in the Podfile that is being generated by pod_builder.

See commits:

  1. https://github.com/habiiev/podbuilder_rn_661/commit/9245d5375db232e2edb1630ca4ee594cc25d457e
  2. https://github.com/habiiev/podbuilder_rn_661/commit/3db035bb1aa5822db1cb4233ba4195dc21c19878

Steps to reproduce:

  1. npx react-native init rnapp
  2. cd rnapp/ios
  3. pod_builder init
  4. Fix the problems I mentioned earlier in the issue
  5. pod_builder build_all

Then this error is being displayed in the Xcode:

/tmp/pod_builder/Pods/Headers/Private/RCT-Folly/folly/portability/Time.h:52:17: Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')

The problem is well known in the react-native community, here is the issue regarding this: https://github.com/facebook/flipper/issues/834

There is the fix for this in the original Podfile:

post_install do |installer|
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
end

Specifically this line:

  __apply_Xcode_12_5_M1_post_install_workaround(installer)

But as far as I understand podbuilder does not run this as a part of post_install hook?

Here is the link with react-native and podbuilder setup: https://github.com/habiiev/podbuilder_rn_661

To see the error just run pod_builder build_all in the ios folder

Xcode - 13.0 (13A233) macOS - 11.6 Trying to build for ios 15

habiiev commented 2 years ago

I tried manually applying the fix and archiving the pod, then setting the RCT-Folly spec source to fetch local version of it (that has the patch) in node_modules/react-native/third-party-podspecs/RCT-Folly.podspec:

  spec.source = { :http => 'file:/Users/user/podbuilder_rn_66/ios/PodBuilder/custom/RCT-Folly.zip', :flatten => true }

After that the podbuilder built successfully, but the after trying to run the app in xcode, it gave the following error:

Screenshot 2021-10-24 at 22 28 01

Without the podbuilder the bare react native app runs successfully.

tcamin commented 2 years ago

Thanks for the report! The react-native support is experimental and is done best effort since the setup tends to change significantly from one version to the other, as you reported in this issue. I will do my best to take a look at this but it may take a while. In the meantime if you find any workaround let me know or even better if you want to contribute with a PR.

tcamin commented 2 years ago

I made some changes and at least on a sample using the latest version of react-native it seems to successfully compile.

Try installing latest version:

$ git clone -b feature/rn_support https://github.com/Subito-it/PodBuilder.git
$ cd PodBuilder
$ sudo rake install

Let me know if this fixes you problem

pepasibble commented 2 years ago

oh thanks! I'll give that a shot

habiiev commented 2 years ago

Sorry for the late reply

I kind of gave up at that time as other more important stuff came up

Now I tried it again, with version 68.1, and it didn't work, although it's now another issue

This is the error I am getting:

Screenshot 2022-04-26 at 17 35 25

It's related to this react-native issue

To reproduce just create an empty react-native project, install any dependency that has native ios code and then configure pod-builder:

Steps to reproduce:

  1. npx react-native init rnapp
  2. cd rnapp
  3. npm install react-native-reanimated --save
  4. cd ios
  5. pod_builder init
  6. pod_builder build_all

Without pod builder, everything works fine right now

I don't really know where to look for the cause of this error, I would be glad to help if you could point me in the correct direction :)

Versions: Xcode 13.3.1 pod_builder 4.4.1 Builds for ios 11 and 14