googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.21k stars 337 forks source link

[Bug] iOS Resolver Failed to install CocoaPods for the current user but Cocoapods are installed on macOS Monterey M1 Max #589

Closed Kharion closed 1 year ago

Kharion commented 1 year ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

iOS Resolver Failed to install CocoaPods for the current user: Do a fresh install of macOS Monterey or buy new M1 Max Macbook Pro. Install Xcode 14.2 Install Homebrew with Command Line Tools (14.2). Install Cocoapods via Homebrew for M1 architecture. Do fresh install of Unity 2021.3.15f1. Check the pod --version to confirm Cocoapods 1.11.3 are installed and working. Check the ruby version to confirm you have default ruby version installed. Note: It also happens if Ruby is updated to most recent one 3.2 (with chruby ruby-3.2.0 and PATH updated) Open Unity project that contains External Dependency Manager Toggle off Auto Install Cocoapods due to iOS Resolver inability to auto install already installed Cocoapods Run the build. Build finishes but pod install is not executed despite the Cocoapods are installed.

Expected behaviour: Pod install is executed correctly if Cocoapods are installed and the built project contains generated xcworkspace.

Workaround: Toggle off "Use Shell to Execute Cocapod Tool" in the iOS Resolver Settings and run pod install manually from the Xcode project build folder.

Please answer the following, if applicable:

What's the issue repro rate? (eg 100%, 1/5 etc) 100%

What happened? How can we make the problem occur? 'gem install cocoapods --user-install' failed with code (1): Building native extensions. This could take a while...

ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.

current directory: /Users/your_mac_user/.gem/ruby/2.6.0/gems/ffi-1.15.5/ext/ffi_c

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20230101-4257-1fhq1ij.rb extconf.rb checking for ffi.h... extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include=${ffi_c-dir}/include --with-ffi_c-lib --without-ffi_c-lib=${ffi_c-dir}/lib --enable-system-libffi --disable-system-libffi --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:inblock in try_compile' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in with_werror' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:intry_compile' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in block in have_header' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:inblock in checking_for' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:inopen' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:inopen' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:inchecking_for' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in have_header' from extconf.rb:10:insystem_libffi_usable?' from extconf.rb:42:in `

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/your_mac_user/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/your_mac_user/.gem/ruby/2.6.0/gems/ffi-1.15.5 for inspection. Results logged to /Users/your_mac_user/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/gem_make.out

UnityEngine.Debug:LogError (object) Google.Logger:Log (string,Google.LogLevel) Google.IOSResolver:Log (string,bool,Google.LogLevel) Google.IOSResolver/cAnonStorey2:<>m6 (int,Google.IOSResolver/CommandItem[],GooglePlayServices.CommandLine/Result,GooglePlayServices.CommandLineDialog) Google.IOSResolver:RunCommandsAsync (Google.IOSResolver/CommandItem[],Google.IOSResolver/CommandItemCompletionHandler,bool,string) Google.IOSResolver:InstallCocoapods (bool,string,bool) Google.IOSResolver:OnPostProcessEnsurePodsInstallation (UnityEditor.BuildTarget,string) UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

google-oss-bot commented 1 year ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

paulinon commented 1 year ago

Hi @Kharion,

I have previously encountered this issue before using that macOS version, and it appears to be caused by Cocoapods 1.11.x. This can be fixed by either including export LANG=en_US.UTF-8 in your shell's profile or downgrading Cocoapods to 1.10.2. However, I recommend that you update your macOS version so that it can have the latest fixes and updates.

That said, I'll be closing this for now. Let me know if an issue arises.

Kharion commented 1 year ago

Hi @paulinon thanks for the help. I can confirm that with installing Cocoapods 1.10.2 the problem is resolved and xcworkspace is generated. But I must say this is still a workaround and you should not close the issue, but resolve it until the External Dependency Manager works with latest Cocoapods out of the box.

yosun commented 1 year ago

M1 Macs on Monterey have been out for over a year, so I am sort of surprised that the only fix to this issue seems to be in github issues here. Thanks for posting the solution: After about 4 hours of installing uninstall ruby, cocoapods, chruby, unity, etc - who should have known it was simply to downgrade cocoapods!

copyandexecute commented 1 year ago

I have the same issue 👍

rxra commented 1 year ago

none of the solution seems to work with me. I am not using the default ruby version installed but one installed using rbenv (2.7.6). But I think I will also try with the default 2.6.0 embedded with OSX. Here is the error I have. Any idea ? I am trying differents (reinstall, different versions, ....) seems 2 days and I am completly stuck.

Screenshot 2023-01-16 at 14 45 03
joksa commented 1 year ago

Grrr everything worked before I updated Ruby required by another project. Now, I am stuck with the same issue

Kharion commented 1 year ago

Unfortunately you can see that this issue was closed and no response from developer. Maybe to create a new issue? I don't know why and I know that I confirmed that fix worked, but suddenly I don't know why the iOS resolver started trying to install Cocoapods again with failing result. This issue should not be closed and the proposed solution stops working. Maybe because I have installed other Cocoapods versions but surprise surprise if you are iOS native developer you have to have more Cocoapods versions. I mean I don't want to sound like a jerk but this issue still remains and should not be closed.

Bonus bug: the iOS Resolver settings keep getting reset by I don't know what and even if I disable the Use Shell to Execute Cocoapod Tool and Auto Install Cocoapod Tools in Editor for several times this checks get reset and the dependency manager is trying to install the Cocoapods. It's becoming really annoying.

turacept commented 1 year ago

This has been a persistent issue with my project for the past, week or so. Urgently needs fixing not solely a workaround.

Workaround inherently creates more errors due to out of date dependencies and such.