Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visionOS pod with XCFramework fails to install xcframework files #12109

Closed
1 task done
rolandkakonyi opened this issue Oct 25, 2023 · 2 comments · Fixed by CocoaPods/Core#763
Closed
1 task done

visionOS pod with XCFramework fails to install xcframework files #12109

rolandkakonyi opened this issue Oct 25, 2023 · 2 comments · Fixed by CocoaPods/Core#763

Comments

@rolandkakonyi
Copy link

rolandkakonyi commented Oct 25, 2023

Report

What did you do?

Ran pod install with a project targeting visionOS and CocoaPods dependency supporting visionOS.

What did you expect to happen?

Install all dependencies and get "Build Succeeded" after building.

What happened instead?

Build error:

Cannot find module BitmovinPlayerCore.

The copy XCFrameworks script (Pods/Target Support Files/BitmovinPlayerCore/BitmovinPlayerCore-xcframeworks.sh) does not have install_xcframework line like for iOS at the end:
install_xcframework "${PODS_ROOT}/BitmovinPlayerCore/BitmovinPlayerCore.xcframework" "BitmovinPlayerCore" "framework" "ios-arm64" "ios-arm64_x86_64-simulator"

Note:
Adding the following line fixes the issue:
install_xcframework "${PODS_ROOT}/BitmovinPlayerCore/BitmovinPlayerCore.xcframework" "BitmovinPlayerCore" "framework" "xros-arm64" "xros-arm64_x86_64-simulator"

CocoaPods Environment

Stack

   CocoaPods : 1.13.0
        Ruby : ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]
    RubyGems : 3.1.6
        Host : macOS 14.0 (23A344)
       Xcode : 15.0 (15A240d)
         Git : git version 2.41.0
Ruby lib dir : /Users/rolandk/.rbenv/versions/2.7.7/lib
Repositories : bitmovin - git - https://github.com/bitmovin/cocoapod-specs.git @ f7d54b2c3bc0deb319bc28a1b7c55b7b56c8b969

               cocoapods - git - https://github.com/CocoaPods/Specs.git @ 36ec01d8c18710e03fa599425433f43ab5520dcd

               react-native-tvos-react-native-tvos-podspecs - git - https://github.com/react-native-tvos/react-native-tvos-podspecs.git @ b4bd3ab652bb204a63e3b19344c0825ce249a181

               trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/rolandk/.rbenv/versions/2.7.7/bin/pod

Plugins

claide-plugins         : 0.9.2
cocoapods-deintegrate  : 1.0.5
cocoapods-dependencies : 1.3.0
cocoapods-keys         : 2.3.1
cocoapods-plugins      : 1.0.0
cocoapods-search       : 1.0.1
cocoapods-trunk        : 1.6.0
cocoapods-try          : 1.2.0
cocoapods_debug        : 0.1.0
slather                : 2.7.4

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://cdn.cocoapods.org'
source 'https://github.com/bitmovin/cocoapod-specs.git'

target 'BitmovinTest' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  platform :visionos, '1.0'
  pod 'BitmovinPlayerCore', '3.48.0-a.8'
end

Project that demonstrates the issue

BitmovinTest.zip

Additional information

Found that there are no tests against visionOS support here:

it 'installs xcframeworks using the correct platform' do
xcframework = Xcode::XCFramework.new('CoconutLib', fixture('CoconutLib.xcframework'))
generator = CopyXCFrameworksScript.new([xcframework], temporary_sandbox.root, Platform.macos)
generator.send(:script).should.include <<-SH.strip_heredoc
install_xcframework "${PODS_ROOT}/../../spec/fixtures/CoconutLib.xcframework" "CoconutLib" "framework" "macos-x86_64"
SH
generator = CopyXCFrameworksScript.new([xcframework], temporary_sandbox.root, Platform.ios)
generator.send(:script).should.include <<-SH.strip_heredoc
install_xcframework "${PODS_ROOT}/../../spec/fixtures/CoconutLib.xcframework" "CoconutLib" "framework" "ios-armv7_arm64" "ios-i386_x86_64-simulator"
SH
generator = CopyXCFrameworksScript.new([xcframework], temporary_sandbox.root, Platform.watchos)
generator.send(:script).should.include <<-SH.strip_heredoc
install_xcframework "${PODS_ROOT}/../../spec/fixtures/CoconutLib.xcframework" "CoconutLib" "framework" "watchos-armv7k_arm64_32" "watchos-i386-simulator"
SH
generator = CopyXCFrameworksScript.new([xcframework], temporary_sandbox.root, Platform.tvos)
generator.send(:script).should.include <<-SH.strip_heredoc
install_xcframework "${PODS_ROOT}/../../spec/fixtures/CoconutLib.xcframework" "CoconutLib" "framework" "tvos-arm64" "tvos-x86_64-simulator"
SH
end

The missing part would only be the following, except the included CoconutLib.xcframework needs slices for visionOS and visionOS simulator.

      generator = CopyXCFrameworksScript.new([xcframework], temporary_sandbox.root, Platform.visionos)
      generator.send(:script).should.include <<-SH.strip_heredoc
        install_xcframework "${PODS_ROOT}/../../spec/fixtures/CoconutLib.xcframework" "CoconutLib" "framework" "xros-arm64" "xros-arm64_x86_64-simulator"
      SH

I could not find out if there is an easy way to build that xcframework using existing tools in the repo.
I did not open a PR with the failing test due to the missing slices for CoconutLib.xcframework.

Found the culprit but have no idea how to fix it.
In:

slices = xcframework.slices.select { |f| f.platform.symbolic_name == platform.symbolic_name }

the compared values (with an xcframework having visionOS slices) are:
f.platform.symbolic_name: xros
platform.symbolic_name: visionos

@rolandkakonyi rolandkakonyi changed the title VisionOS pod with XCFramework fails to install xcframework files visionOS pod with XCFramework fails to install xcframework files Oct 25, 2023
@rolandkakonyi
Copy link
Author

I would be open to contribute a fix if I get some pointers where the fix should happen!
Additionally I would need some instructions where the CoconutLub.xcframework comes from. I could only find some build.sh scripts for the ones that apply to some specific tests.

@CrazyFanFan
Copy link

One possible solution here is to modify the initialization method of Pod::Platform to replace xros with visionos. This way, the platform information in the XCFramework will match "visionos".

def initialize(input, target = nil)
  if input.is_a? Platform
    @symbolic_name = input.name
    @deployment_target = input.deployment_target
  else
    # Allow `Platform.new('macos')` to be equivalent to `Platform.macos`
    if input == 'macos'
      input = 'osx'
    elsif input == 'xros'
      input = 'visionos'
    end
    @symbolic_name = input.to_sym
    target = target[:deployment_target] if target.is_a?(Hash)
    @deployment_target = Version.create(target)
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants