react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 Build Failure: ios/Frame Processor/JSINSObjectConversion.mm

Open DeveloperMCD opened this issue 1 year ago • 5 comments

What's happening?

Trying to build app; worked fine before, copied Podfile from supposed working project, but perhaps he didn't have Frame Processors enabled? This is a build failure on a piece of Vision Camera IOS code.

Reproduceable Code

Podfile:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# 
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# 
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
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)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

def shared_pods
  config = use_native_modules!
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

  # 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 => flags[:hermes_enabled],
    :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 => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
end

target 'stackbay' do
  shared_pods
end

React Native Vision Camera: 3.8.2
React Native Worklets Core: 0.3.0
React Native Firebase: 18.8.0

cd ios
pod install
cd ..
npx react-native run-ios

Relevant log output

Details:  createItemModels creation requirements should not create capability item model for a capability item model that already exists.
Function: createItemModels(for:itemModelSource:)
Thread:   <_NSMainThread: 0x600002fa42c0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2024-02-05 17:38:09.490 xcodebuild[14976:5131509] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103
Details:  createItemModels creation requirements should not create capability item model for a capability item model that already exists.
Function: createItemModels(for:itemModelSource:)
Thread:   <_NSMainThread: 0x600002fa42c0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2024-02-05 17:38:09.490 xcodebuild[14976:5131509] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103
Details:  createItemModels creation requirements should not create capability item model for a capability item model that already exists.
Function: createItemModels(for:itemModelSource:)
Thread:   <_NSMainThread: 0x600002fa42c0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **


The following build commands failed:
	CompileC /Users/developer/Library/Developer/Xcode/DerivedData/stackbay-hkdvgolugzmnjnbykqfllfpapwnp/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/VisionCamera.build/Objects-normal/arm64/JSINSObjectConversion.o /Users/developer/Documents/ios/stackbayapp/node_modules/react-native-vision-camera/ios/Frame\ Processor/JSINSObjectConversion.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'VisionCamera' from project 'Pods')
(1 failure)

Camera Device

N/A

Device

iPhone 13

VisionCamera Version

3.8.2

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

DeveloperMCD avatar Feb 05 '24 23:02 DeveloperMCD

If you need any other information, or want me to try anything, please let me know.

DeveloperMCD avatar Feb 05 '24 23:02 DeveloperMCD

Which react native version?

mrousavy avatar Feb 06 '24 10:02 mrousavy

If you can build without Firebase (and wihtout static linkage), I think this issue is not directly related to VisionCamera

mrousavy avatar Feb 06 '24 10:02 mrousavy

I just want to be able to use Firebase and Vision Camera. Firebase might require static linkage, which seems to have caused an error during compiling. The error is in JSINSObjectConversion.mm, according to the output. Isn't that something that can be fixed, theoretically?

DeveloperMCD avatar Feb 06 '24 16:02 DeveloperMCD

The error is in JSINSObjectConversion.mm, according to the output. Isn't that something that can be fixed, theoretically?

Well I don't know, I never tried to link it statically and in the error logs you showed, it doesn't seem like there is any specific error happening, so this would definitely require me to investigate this thoroughly (couple of hours of effort).

Maybe try clearing all your cache instead, as I think you mentioned this not working on your machine while it worked fine on someone else's machine.

rm -rf Pods Podfile.lock build
pod deintegrate
pod install
pod update

mrousavy avatar Feb 06 '24 17:02 mrousavy

+1

iacocesarlopes avatar Mar 18 '24 22:03 iacocesarlopes

  • 1

tonymatheus avatar Mar 21 '24 12:03 tonymatheus

Any update about this issue?

tonymatheus avatar Mar 21 '24 12:03 tonymatheus

In your Podfile, add this line.

installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    ...
    config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited) '
    config.build_settings['HEADER_SEARCH_PATHS'] << '"${PODS_ROOT}/../../node_modules/react-native/ReactCommon" '
  end
end

eduardorfreitas93 avatar Mar 28 '24 22:03 eduardorfreitas93

Or add to the library's dependencies, you can use this line:

VisionCamera.podspec

...
s.dependency "React"
s.dependency "React-Core"
s.dependency "React-callinvoker"
s.dependency "ReactCommon" <- here
...

eduardorfreitas93 avatar Mar 28 '24 22:03 eduardorfreitas93

Hey - I think this issue has been fixed in VisionCamera 4.0.0. 🥳

Please try V4 and let me know if you still experience this issue;

  • if not, please consider 💖 sponsoring me on GitHub 💖 to support the development of VisionCamera and thank me for my time spent on fixing bugs and building new features.
  • if you still see this issue, please comment and we can re-open this. But please update your native logs with the native (Xcode/Android Studio) logs from running VisionCamera V4 so I can investigate this.

mrousavy avatar Apr 22 '24 11:04 mrousavy

I still have the problem in 4.0.1 with react-native-worklets-core in 1.1.1 (exactly the same problem as OP).

CompileC /Users/benv547/Library/Developer/Xcode/DerivedData/poccodeocr-bspdfsfthhwuaycpogdnuoythlxc/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/VisionCamera.build/Objects-normal/arm64/JSINSObjectConversion.o /Users/benv547/Documents/Projects/ReactNative/poccodeocr/node_modules/react-native-vision-camera/ios/FrameProcessors/JSINSObjectConversion.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'VisionCamera' from project 'Pods') (1 failure)

On Xcode, from JSINSObjectConversion.mm file: #import <ReactCommon/RCTBlockGuard.h> 'ReactCommon/RCTBlockGuard.h' file not found

I've tried eduardorfreitas93's resolutions but nothing changes. Available if you need more information!

Benv547 avatar Apr 23 '24 10:04 Benv547

fixed on latest main. didn't do a release yet, am on vacation in italy

mrousavy avatar Apr 23 '24 10:04 mrousavy

Still getting same isuue in version 4.0.1

RutvinBhanderi avatar May 04 '24 06:05 RutvinBhanderi

The lib react-native-vision-camera and firebase (app; analytics; remote-config) are working in my project with this versions:

package.json

...
"@react-native-firebase/analytics": "^18.3.0",
"@react-native-firebase/app": "^18.3.0",
"@react-native-firebase/remote-config": "^18.3.0",
"react": "18.2.0",
"react-native": "0.72.13",
"react-native-vision-camera": "^3.9.2",
...

In my Podfile I set use_frameworks! inside the target.

Podifle

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

BarbieriMatheus-T10 avatar May 06 '24 17:05 BarbieriMatheus-T10

The issue is with the ios/frame processor/JSINSObjectConversion file. I Downloaded the latest code and replaced the frame processor folder which is inside node_modules/react-native-vision-camera/ios/ with the downloaded code. then it is working fine.

RutvinBhanderi avatar May 07 '24 10:05 RutvinBhanderi

I just installed 4.0.3 - I'm not sure exactly what version @mrousavy was talking about while on vacation as I was running 4.0.1 before I just updated - but it totally worked. Thank you for your effort getting this fixed.

dowatugkins avatar May 09 '24 19:05 dowatugkins