oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.31k stars 2.12k forks source link

React Native 0.72.3 issue building on v10.0.0 #1534

Closed billnbell closed 8 months ago

billnbell commented 11 months ago

▸ Compiling RNVectorIconsManager.m

❌  /Users/bill_1/theclub/TheClub/ios/build/generated/ios/RNVectorIconsSpec/RNVectorIconsSpec.h:15:2: This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.

#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
 ^

❌  /Users/bill_1/theclub/TheClub/ios/Pods/Headers/Public/RCTRequired/RCTRequired/RCTRequired.h:8:10: 'utility' file not found

#include <utility>
         ^~~~~~~~~

❌  /Users/bill_1/theclub/TheClub/node_modules/react-native/Libraries/TypeSafety/RCTConvertHelpers.h:8:9: 'optional' file not found

#import <optional>
billnbell commented 11 months ago

OK I was able to fix it. 3 things need changing fr RN 0.72.3.

  1. Rename RNVectorIconsManager/RNVectorIconsManager.m to RNVectorIconsManager/RNVectorIconsManager.mm
  2. Fix RNVectorIcons.podspec (for lower version < 0.72 you will need to check for fabric before adding install_modules_dependencies(s))
require 'json'
version = JSON.parse(File.read('package.json'))["version"]

fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|

  s.name           = "RNVectorIcons"
  s.version        = version
  s.summary        = "Customizable Icons for React Native with support for NavBar/TabBar, image source and full styling."
  s.homepage       = "https://github.com/oblador/react-native-vector-icons"
  s.license        = "MIT"
  s.author         = { "Joel Arvidsson" => "joel@oblador.se" }
  s.platforms      = { :ios => "12.4", :tvos => "9.0" }
  s.source         = { :git => "https://github.com/oblador/react-native-vector-icons.git", :tag => "v#{s.version}" }
  s.source_files   = 'RNVectorIconsManager/**/*.{h,m,mm,swift}'
  s.resources      = "Fonts/*.ttf"
  s.preserve_paths = "**/*.js"
  s.pod_target_xcconfig = {
    "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
  }

  if fabric_enabled
    s.dependency "React-utils"
    s.subspec "xxxutils" do |ss|
      ss.dependency "ReactCommon"
      ss.dependency "React-utils"
      ss.source_files         = "react/utils/**/*.{cpp,h}"
      ss.header_dir           = "react/utils"
      ss.pod_target_xcconfig  = { "HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\"" }
    end
  end

  install_modules_dependencies(s)

end
  1. FIx name of turbo module
    -    return std::make_shared<facebook::react::RNVectorIconsSpecJSI>(params);
    +    return std::make_shared<facebook::react::NativeRNVectorIconsSpecJSI>(params);
mbrimmer83 commented 11 months ago

Changing RNVectorIconsManager/RNVectorIconsManager.m to RNVectorIconsManager/RNVectorIconsManager.mm fixed my build

johnf commented 10 months ago

@billnbell Similar to my question in #1538, should #1530 solve this? I've tested with NO_FLIPPER=1 USE_FRAMEWORKS=static RCT_NEW_ARCH_ENABLED=1 pod install and it seems to compile fine with the patch

johnf commented 10 months ago

Although it also seems to compile without in my testing

billnbell commented 10 months ago

Yes!

akerele-doftwerks commented 10 months ago

OK I was able to fix it. 3 things need changing fr RN 0.72.3.

  1. Rename RNVectorIconsManager/RNVectorIconsManager.m to RNVectorIconsManager/RNVectorIconsManager.mm
  2. Fix RNVectorIcons.podspec (for lower version < 0.72 you will need to check for fabric before adding install_modules_dependencies(s))
require 'json'
version = JSON.parse(File.read('package.json'))["version"]

fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|

  s.name           = "RNVectorIcons"
  s.version        = version
  s.summary        = "Customizable Icons for React Native with support for NavBar/TabBar, image source and full styling."
  s.homepage       = "https://github.com/oblador/react-native-vector-icons"
  s.license        = "MIT"
  s.author         = { "Joel Arvidsson" => "joel@oblador.se" }
  s.platforms      = { :ios => "12.4", :tvos => "9.0" }
  s.source         = { :git => "https://github.com/oblador/react-native-vector-icons.git", :tag => "v#{s.version}" }
  s.source_files   = 'RNVectorIconsManager/**/*.{h,m,mm,swift}'
  s.resources      = "Fonts/*.ttf"
  s.preserve_paths = "**/*.js"
  s.pod_target_xcconfig = {
    "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
  }

  if fabric_enabled
    s.dependency "React-utils"
    s.subspec "xxxutils" do |ss|
      ss.dependency "ReactCommon"
      ss.dependency "React-utils"
      ss.source_files         = "react/utils/**/*.{cpp,h}"
      ss.header_dir           = "react/utils"
      ss.pod_target_xcconfig  = { "HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\"" }
    end
  end

  install_modules_dependencies(s)

end
  1. FIx name of turbo module
-    return std::make_shared<facebook::react::RNVectorIconsSpecJSI>(params);
+    return std::make_shared<facebook::react::NativeRNVectorIconsSpecJSI>(params);

where did you get these files from? @billnbell

lucaswitch commented 10 months ago

It's under node_modules/react-native-vector-icons/RNVectorIcons.podspec

lucaswitch commented 10 months ago

This error is happening on 0.72.4, with RCT_NEW_ARCH_ENABLED=1 Screenshot 2023-09-04 at 16 04 12

jorgegvallejo commented 9 months ago

This error is happening on 0.72.4, with RCT_NEW_ARCH_ENABLED=1 Screenshot 2023-09-04 at 16 04 12

Same with 0.72.5

dmg46664 commented 9 months ago

Will this be addressed? Edit: Ah, downgrading to 9.2.0 worked for me 😀

johnf commented 8 months ago

Closing in favour of #1538