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

iOS build fails on XCode 16 when using use_frameworks! :linkage => :static #125

Open
16thomas opened this issue Oct 2, 2024 · 14 comments
Open
Assignees
Labels
Platform: ios Status: work in progress Currently working on this issue Target: stario10 Issues related to the API and other StarIO10 library.

Comments

@16thomas
Copy link

16thomas commented Oct 2, 2024

Description

iOS build fails on XCode 16 when using use_frameworks! :linkage => :static

Your device where the bug occurs

  • Device:
    iPhone 13

  • OS:
    iOS 18.0

  • Version
    1.7.0

Your development environment

ProductName: macOS
ProductVersion: 15.0
BuildVersion: 24A335

Also, the result of executing the command npx react-native info.
System:
OS: macOS 15.0
CPU: (8) x64 Apple M2
Memory: 40.99 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.17.0
path: ~/.nvm/versions/node/v20.17.0/bin/node
Yarn:
version: 3.6.4
path: ~/.nvm/versions/node/v20.17.0/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v20.17.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.14.3
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.19072.14.2412.12360217
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.16.1
path: /usr/bin/javac
Ruby:
version: 3.3.5
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

To Reproduce

Steps to reproduce the behavior:

  1. Go to Podfile in example app -> example/ios/Podfile
  2. Add use_frameworks! :linkage => :static inside target 'example' do block in starting.
  3. Run pod install
  4. Build in xcode.

Expected behavior

Should build successfully.

Screenshots

Screenshot 2024-10-02 at 13 47 58

Additional context

Working fine if not using use_frameworks! :linkage => :static

@bandit-ibayashi bandit-ibayashi assigned can-miki and unassigned can-miki Oct 3, 2024
@bandit-ibayashi bandit-ibayashi added the Status: question Further information is requested label Oct 7, 2024
@bandit-ibayashi
Copy link
Member

@16thomas Thank you for posting your issue.
Could you please confirm and let us know your StarXpand SDK or react-native-star-io10 version?

We have added support for use_frameworks in 1.6.0, so it would be very helpful if you could first tell us what version of the sample you are using.

Thank you in advance.

@bandit-ibayashi bandit-ibayashi self-assigned this Oct 7, 2024
@bandit-ibayashi bandit-ibayashi added Platform: ios Target: stario10 Issues related to the API and other StarIO10 library. labels Oct 7, 2024
@16thomas
Copy link
Author

16thomas commented Oct 7, 2024

@bandit-ibayashi Thanks for looking into the issue.

react-native-star-io10 version is 1.7.0,
I know you guys have added the support for use_frameworks in 1.6.0, and that was working fine till XCode 15, but it stopped working in XCode 16.

It still builds fine with XCode 15. But not building on XCode 16.

@bandit-ibayashi
Copy link
Member

@16thomas Thank you for letting us know the version of react-native-star-io10. We will investigate in more detail.
Thank you for your patience.

@bandit-ibayashi bandit-ibayashi added Status: work in progress Currently working on this issue and removed Status: question Further information is requested labels Oct 8, 2024
@lukhol
Copy link

lukhol commented Oct 13, 2024

+1. I have the same errors on 1.7.0 version of the library when building with xcode 16. Do you have an estimated timeframe for when the issue will be resolved?

@can-miki
Copy link
Contributor

@16thomas @lukhol
Thank you for your cooperation.
Based on our research, the build error can be avoided by upgrading the react-native library and manually resolving the build error.

  • Procedure to reproduce the error
  1. Add use_frameworks! :linkage => :static to target 'example' do in the Podfile.
  2. Comment out line 37 according to the comment.
    ⇒The build was successful in Xcode 15.4, but failed in Xcode 16.0.
    image
  • Workaround
    Use React-native version 0.75.4 (latest).
    Manually fix the build error in the ReactNative header file (assert.h) shown below that occurs when you set use_frameworks! :linkage => :static .
    Specifically, comment out line 13 in assert.h, and also comment out the } that corresponds to {
    image
    Test environment: StarIO10 (V1.7.0) + Xcode16.0 + ReactNative (Ver0.75.4)

@16thomas
Copy link
Author

@can-miki I'm not able to find this assert.h file. Can you please help me with the path or full screenshot?

@bandit-ibayashi
Copy link
Member

@16thomas Thank you for your confirmation. I found there are some environments where this error does not occur.

So could you first try the version of React Native used, 0.75.4, and see if build errors occur?
If the same error occurs, you can probably refer to the relevant file from the error.

In my confirmation, I used our example SDK version 1.7.0.
I have added use_frameworks! :linkage => :static to line 30 of the Podfile.
In line with the addition of this setting, lines 20 and 38 regarding Flipper have been commented out.

# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
# :flipper_configuration => flipper_config,

Then change ‘react-native’ in dependencies in package.json to ‘0.75.4’, and also make other libraries up-to-date. See the following image for details.

20241021T064551Z

After following the Usage instructions and executing the necessary commands, the project in the iOS folder was run and built in Xcode 16.
No errors occurred during this procedure.

Thank you in advance.

@bandit-ibayashi bandit-ibayashi added Status: question Further information is requested and removed Status: work in progress Currently working on this issue labels Oct 21, 2024
@16thomas
Copy link
Author

@bandit-ibayashi The build is still failing for me on react-native 0.75.4 and react-native-star-io10 1.7.0. And the build only fails react-native-star-io10.

Screenshot 2024-10-21 at 21 32 17

@bandit-ibayashi
Copy link
Member

Thank you for letting us know your situation.

These errors did not occur in our environment, so I assume there is some difference.

The results of the npx react-native info command execution show that there are differences between the macOS version and the CPU.
It is not yet clear whether this is relevant to the present results, but we would like to start our investigation from this point.

% npx react-native info   
System:
  OS: macOS 14.6.1
  CPU: (8) arm64 Apple M2
  Memory: 93.52 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.7.3
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.9.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.07.01.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 22.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.4
    wanted: 0.75.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

@16thomas
Copy link
Author

Thanks @bandit-ibayashi, waiting for some resolution.

@Axenu
Copy link

Axenu commented Dec 7, 2024

Is there any update on this? I was just upgrading our app to RN 0.75.4 and encountered the same problem.

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, '15.6'
prepare_react_native_project!

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

target 'targetName' do
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"

  config = use_native_modules!

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

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )


  post_install do |installer| 
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
    )
  end

end

@lukhol
Copy link

lukhol commented Dec 16, 2024

Any updates on this? Unfortunately, this issue prevents us from updating the app, which is crucial.

System:
  OS: macOS 14.6.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 99.02 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman:
    version: 2024.11.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /Users/lukaszprivate/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true
# 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, 16.0
prepare_react_native_project!

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

def pods()
  # Needs to be above use_native_modules!
  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path

  config = use_native_modules!
  use_frameworks! :linkage => :static

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

abstract_target 'Common' do
  pods

  target 'Target1'
  target 'Target2'
end


"react-native": "0.76.5",
"react-native-star-io10": "1.8.0",

@lukhol
Copy link

lukhol commented Dec 18, 2024

@bandit-ibayashi

Minimal reproduction steps:

  1. Run npx react-native init StarIssue to create a new React Native project.
  2. In the Podfile, add use_frameworks! :linkage => :static below config = use_native_modules!.
  3. Install the react-native-star-io10 package by running yarn add react-native-star-io10.
  4. Open the project in Xcode, attempt to build, and observe the errors.

Screenshot 2024-12-18 at 22 49 50

Once again npx react-native info in the project directory

System:
  OS: macOS 14.6.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 120.22 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman:
    version: 2024.11.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /Users/lukaszprivate/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

This issue is becoming increasingly urgent.

@lukhol
Copy link

lukhol commented Dec 18, 2024

Below patch-package sovles the issue for me

diff --git a/node_modules/react-native-star-io10/react-native-star-io10.podspec b/node_modules/react-native-star-io10/react-native-star-io10.podspec
index 3c5142d..7a9d795 100755
--- a/node_modules/react-native-star-io10/react-native-star-io10.podspec
+++ b/node_modules/react-native-star-io10/react-native-star-io10.podspec
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
     ]
 
     s.pod_target_xcconfig  = {
-      "HEADER_SEARCH_PATHS" => header_search_path.join(" "),
+      # "HEADER_SEARCH_PATHS" => header_search_path.join(" "),
       "EXCLUDED_SOURCE_FILE_NAMES" => exclude_source_file_name.join(" ")
     }
   end

@bandit-ibayashi bandit-ibayashi added Status: work in progress Currently working on this issue and removed Status: question Further information is requested labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: ios Status: work in progress Currently working on this issue Target: stario10 Issues related to the API and other StarIO10 library.
Projects
None yet
Development

No branches or pull requests

5 participants