flyskywhy / react-native-gcanvas

react native canvas based on gpu opengl glsl GCanvas -- A lightweight cross-platform graphics rendering engine. (超轻量的跨平台图形引擎)
Apache License 2.0
217 stars 21 forks source link

Build Error - Log.h not found #72

Closed RayyanLaunchVisory closed 11 months ago

RayyanLaunchVisory commented 11 months ago

Problem

I had this library integrated and working on iOS perfectly, until I decided to add Firebase library. I followed these instructions.

Steps Taken

  1. Installed npm install --save @react-native-firebase/app
  2. Added GoogleService-Info.plist file to my project like this.
  3. Added Firebase init code like this
  4. Added Pod entries at the top like this
    • use_frameworks! :linkage => :static
    • $RNFirebaseAsStaticFramework = true
  5. Ran pod install

But when I run a build from Xcode, I get the following error in GShader.h:

CleanShot 2023-12-23 at 12 05 06@2x

Relevant Versions

flyskywhy commented 11 months ago

Actually, it's a react-native bug: on iOS, use_frameworks! is not compatible with Flipper, New Architecture and Hermes.

Never mind, because it's deprecated.

RN 0.72 let use_frameworks! be compatible with New Architecture, ref to https://blixtdev.com/react-native-0-72-whats-new/

Downgrade @react-native-firebase/app to v14.11.1 can work, ref to https://github.com/facebook/react-native/issues/34381#issuecomment-1233396599

For @flyskywhy/react-native-gcanvas, maybe modular_headers => true ref to https://stackoverflow.com/questions/73416469/after-installing-react-native-firebase-app-its-build-will-failed-in-react-nativ can work, but a react-native-firebase maintainer reply in this ref that it's unsupportable.

So I try just

npm install @react-native-firebase/app@14.11.1
cd ios
pod install

and no

use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true

ref to https://github.com/invertase/react-native-firebase/blob/v14.11.1/docs/index.md

found can pass build and my APP runs well.

Please try your APP and tell me if the firebase itself which comes from @react-native-firebase/app@14.11.1 works well.

RayyanLaunchVisory commented 11 months ago

Thank you for your valuable input on this @flyskywhy .

I was able to solve the issue by:

  1. Adding use_modular_headers! to the PodfFile globally.
  2. Adding pod "RNFBApp", :path => "../node_modules/@react-native-firebase/app" to PodFile.

The idea came to me when I was looking for integration help.

Hence, closing this issue now. Thank you again for your support! 👍

flyskywhy commented 11 months ago

@RayyanLaunchVisory , can you paste here of your Podfile which solved the issue?

RayyanLaunchVisory commented 11 months ago

@flyskywhy Here's the PodFile I have that works:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

use_modular_headers!

target 'myapp' do
  config = use_native_modules!

  # Permissions (react-native-permissions)
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"

  # SwiftyStoreKit
  pod 'SwiftyStoreKit'

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
#    :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  pod "GCanvas", :path => "../node_modules/@flyskywhy/react-native-gcanvas/GCanvas.podspec"

  target 'myappTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
flyskywhy commented 10 months ago

Thank you for your valuable input on this @flyskywhy .

I was able to solve the issue by:

  1. Adding use_modular_headers! to the PodfFile globally.
  2. Adding pod "RNFBApp", :path => "../node_modules/@react-native-firebase/app" to PodFile.

The idea came to me when I was looking for integration help.

Hence, closing this issue now. Thank you again for your support! 👍

Thanks for your paste of Podfile, but why I can't find "2. Adding pod "RNFBApp", :path => "../node_modules/@react-native-firebase/app" to PodFile." in it?