Mac OS에서 CocoaPods 설치 시 에러 해결 방법
반응형

안녕하세요 😉

유유자적한 개발자 유로띠 입니다 😀

 

👏👏👏👏

 

 

 

 

이번 포스팅에서는

✅ Error installing CocoaPods

✅ cocoapods 설치 error 해결 방법

❎ flutter run 실패

✳️ gem을 이용하여 설치 및 flutter run 성공

에 대해서 알아보겠습니다

 

 

CocoaPods 설치 에러


 

 

 

✅  Error installing CocoaPods

 

오랜만에 flutter 공부를 다시 시작하기 위해 flutter run을 실행하니 다음과 같은 에러가 발생되었습니다.

 

$ flutter run
Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Warning: CocoaPods is installed but broken. Skipping pod install.
  You appear to have CocoaPods installed but it is not working.
  This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
  This can usually be fixed by re-installing CocoaPods.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.



CocoaPods not installed or not in valid state.
Error launching application on iPhone SE (3rd generation).

 

에러 메시지를 보면 CocoaPods가 설치가 안돼서 다시 설치하라고 합니다.

분명 전에 할때 설치하고 정상 작동했는데 말이죠...

 

더 정확히 확인하기 위해 flutter doctor를 실행해서 확인해 봅니다.

다행인지 아닌지 일단 CocoaPods 만 문제가 있는 것 같아 설치를 진행해 보았습니다.

mac에서 CocoaPods를 설치 중 다음과 같은 에러가 발생되었습니다.

 

✅ cocoapods 설치 error 해결 방법

 

$ sudo gem install cocoapods                                                                              127 ↵  10261  23:17:07

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/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 ./siteconf20230210-25868-19ctqdz.rb extconf.rb
*** 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:546:in `block in try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
	from extconf.rb:9:in `system_libffi_usable?'
	from extconf.rb:42:in `<main>'

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

  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-22/2.6.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-22/2.6.0/ffi-1.15.5/gem_make.out

 

열심히 구글링한 결과 brew로 설치하라는 내용을 발견하였습니다.

 

한번 해보자!! 🙆‍♂️

$ brew install cocoapods

Mac M1 인 경우 다음과 같이 작성합니다.

$ arch -arm64 brew install cocoapods

 

 

설치가 잘 되는가 했더니 중간에 다음과 같은 에러가 발생되었습니다. (정말 힘드네... 😇) 

 

기존에 있는 cocoapods를 삭제하고 다시 설치해 보겠습니다.

# sudo gem uninstall cocoapods                                                                              1 ↵  10283  00:06:56
Remove executables:
	pod, sandbox-pod

in addition to the gem? [Yn]  Y
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-1.11.3

 

 

다시 설치를 진행해 봅니다.. 이번엔 설치 시 에러 없이 잘 설치되었고

버전을 확인해 보니 일단 정상적으로 다시 설치되었습니다.

$ arch -arm64 brew install cocoapods                                                                        1 ↵  10296  00:18:04
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
==> Fetching cocoapods
==> Downloading https://ghcr.io/v2/homebrew/core/cocoapods/manifests/1.11.3_1-1
Already downloaded: /Users/msyu/Library/Caches/Homebrew/downloads/37d01c4861dfd4fb2ee665333db56c3652606c9c61ab9500929f9b29bfd1f467--cocoapods-1.11.3_1-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/cocoapods/blobs/sha256:0a0e088cab176b333acec5d7b63e942fa95b84189ca503d4719ceaad77ab7d02
Already downloaded: /Users/msyu/Library/Caches/Homebrew/downloads/3a6ec835295692a730e0c900240d3b6c720b759591f2207c3ef4585e5a8469de--cocoapods--1.11.3_1.arm64_ventura.bottle.1.tar.gz
==> Pouring cocoapods--1.11.3_1.arm64_ventura.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/cocoapods/1.11.3_1: 13,476 files, 27.9MB
==> Running `brew cleanup cocoapods`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

$ pod --version                                                                                               ✔  10297  00:18:23
1.11.3

 

 

 

다시 flutter doctor로 확인해 보니 정상으로 확인됩니다!!

 

❎ flutter run 실패

 

flutter run이 정상적으로 동작하는지 실행해 보겠습니다.

시뮬레이터를 실행하고 flutter run하니 이번엔 다른 에러가 발생되었습니다. 😇

 

Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Running pod install...                                             330ms
CocoaPods' output:
↳

    [!] Invalid `Podfile` file: undefined method `exists?' for File:Class.

     #  from /Users/msyu/development/flutter-project/study_package/ios/Podfile:34
     #  -------------------------------------------
     #  
     >    flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
     #  end
     #  -------------------------------------------

    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:335:in `rescue in block in from_ruby'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:329:in `block in from_ruby'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:50:in `initialize'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:327:in `new'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:327:in `from_ruby'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:293:in `from_file'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/config.rb:205:in `podfile'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:46:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/bin/pod:25:in `load'
    /opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/bin/pod:25:in `<main>'

Error running pod install
Error launching application on iPhone SE (3rd generation).

에러를 확인해 보니 지금 글을 작성하는 날(2023.02.11)까지도 cocoapods의 1.11.3에서 문제가 발생되는 듯합니다. (issue

나와있는 방법으로는 삭제 후 CocoaPods를 1.11.2로 설치하면 된다고 합니다. 

 

하지만 brew로는 어떻게 하는지 방법을 찾지 못하였습니다. 🤣

 

Cocoapods 설치 오류는 해결하였지만.. 결국 flutter run 동작에는 실패하였습니다.  

 

 

✳️ + 2023.02.11 추가 글 (성공 🙌)

 

드디어 flutter run에 성공하였습니다. 😄

 

일단 cocoapods 1.11.3에 문제가 있기 때문에 1.11.2로 설치를 해야합니다. (추후 cocoapods가 패치되면 최신을 사용하는 것이 좋습니다.)

하지만 brew install cocoapods로 설치하는 경우 특정 버전 설치가 어려워 결국 gem 명령어를 이용하여 설치를 진행해야 합니다.

 

gem 명령어를 사용하기 위해서는 item2를 Rosetta를 사용하여 진행합니다.

 

기존에 설치된 cocoapods 1.11.3을 삭제합니다.

$ brew uninstall cocoapods
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
Uninstalling /opt/homebrew/Cellar/cocoapods/1.11.3_1... (13,476 files, 27.9MB)

 

📍 첫번째 시도

 

설치를 하려고 하면 또 다음과 같은 에러가 발생됩니다.

 

$ sudo gem install cocoapods -v 1.11.2                                                         1 ↵  10386  14:28:30
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/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 ./siteconf20230211-85354-1iuz3vw.rb extconf.rb
*** 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:546:in `block in try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
	from extconf.rb:9:in `system_libffi_usable?'
	from extconf.rb:42:in `<main>'

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

  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-22/2.6.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-22/2.6.0/ffi-1.15.5/gem_make.out

 

ruby version이 2.6.0으로 낮아보여 ruby 버전도 올려보겠습니다.

rbenv를 이용하여 ruby version을 설정합니다.

 

설치 가능 목록을 조회하여 2.X.X에서 최신인 2.7.7을 설치하고 사용하도록 하겠습니다.

$ rbenv install -l                                                                                            ✔  10375  13:59:38
2.7.7
3.0.5
3.1.3
3.2.1
jruby-9.4.1.0
mruby-3.1.0
picoruby-3.0.0
truffleruby-22.3.1
truffleruby+graalvm-22.3.1

Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all / -L' to show all local versions.

 

저는 이미 설치를 하였기 때문에 ruby 2.7.7 을 사용하도록 설정하겠습니다.

$ rbenv global 2.7.7
$ ruby --version
ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]

 

📍 두번째 시도

다시 cocoapods version 1.11.2 를 설치합니다 (이번엔!! 🙏)

 

하지만.. 역시 또 실패..

$ sudo gem install cocoapods -v 1.11.2                                                           ✔  10401  14:39:22
Password:
Fetching gh_inspector-1.1.3.gem
Fetching fourflusher-2.3.1.gem
Fetching nap-1.1.0.gem
Fetching ruby-macho-2.5.1.gem
Fetching colored2-3.1.2.gem
Fetching addressable-2.8.1.gem
Fetching escape-0.0.4.gem
Fetching public_suffix-4.0.7.gem
Fetching atomos-0.1.3.gem
Fetching rexml-3.2.5.gem
Fetching CFPropertyList-3.0.6.gem
Fetching claide-1.1.0.gem
Fetching nanaimo-0.3.0.gem
Fetching xcodeproj-1.22.0.gem
Fetching molinillo-0.8.0.gem
Fetching cocoapods-try-1.2.0.gem
Fetching netrc-0.11.0.gem
Fetching ffi-1.15.5.gem
Fetching cocoapods-trunk-1.6.0.gem
Fetching cocoapods-search-1.0.1.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-downloader-1.6.3.gem
Fetching cocoapods-deintegrate-1.0.5.gem
Fetching ethon-0.16.0.gem
Fetching typhoeus-1.4.0.gem
Fetching concurrent-ruby-1.2.0.gem
Fetching httpclient-2.8.3.gem
Fetching algoliasearch-1.27.5.gem
Fetching fuzzy_match-2.0.4.gem
Fetching i18n-1.12.0.gem
Fetching tzinfo-2.0.6.gem
Fetching zeitwerk-2.6.7.gem
Fetching activesupport-6.1.7.2.gem
Fetching cocoapods-core-1.11.2.gem
Fetching cocoapods-1.11.2.gem
Successfully installed public_suffix-4.0.7
Successfully installed addressable-2.8.1
Successfully installed ruby-macho-2.5.1
Successfully installed nap-1.1.0
Successfully installed gh_inspector-1.1.3
Successfully installed fourflusher-2.3.1
Successfully installed escape-0.0.4
Successfully installed colored2-3.1.2
Successfully installed atomos-0.1.3
Successfully installed rexml-3.2.5
Successfully installed CFPropertyList-3.0.6
Successfully installed claide-1.1.0
Successfully installed nanaimo-0.3.0
Successfully installed xcodeproj-1.22.0
Successfully installed molinillo-0.8.0
Successfully installed cocoapods-try-1.2.0
Successfully installed netrc-0.11.0
Successfully installed cocoapods-trunk-1.6.0
Successfully installed cocoapods-search-1.0.1
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-downloader-1.6.3
Successfully installed cocoapods-deintegrate-1.0.5
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/Users/msyu/.rbenv/versions/2.7.7/bin/ruby -I /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/2.7.0 -r ./siteconf20230211-87807-13e02q8.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... no
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR="
Configuring libffi
/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/configure: line 18692: readelf: command not found
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi-arm64-darwin22" && /Applications/Xcode.app/Contents/Developer/usr/bin/make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in include
make[3]: Nothing to be done for `all'.
Making all in testsuite
make[3]: Nothing to be done for `all'.
Making all in man
make[3]: Nothing to be done for `all'.
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src   -Wall -fexceptions -c -o src/prep_cif.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/prep_cif.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -Wall -fexceptions -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/prep_cif.c  -fno-common -DPIC -o src/.libs/prep_cif.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src   -Wall -fexceptions -c -o src/types.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/types.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -Wall -fexceptions -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/types.c  -fno-common -DPIC -o src/.libs/types.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src   -Wall -fexceptions -c -o src/raw_api.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/raw_api.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -Wall -fexceptions -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/raw_api.c  -fno-common -DPIC -o src/.libs/raw_api.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src   -Wall -fexceptions -c -o src/java_raw_api.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/java_raw_api.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -Wall -fexceptions -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/java_raw_api.c  -fno-common -DPIC -o src/.libs/java_raw_api.o
/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/java_raw_api.c:328:46: warning: 'ffi_java_raw_size' is deprecated [-Wdeprecated-declarations]
  ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
                                             ^
include/ffi.h:299:56: note: 'ffi_java_raw_size' has been explicitly marked deprecated here
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
                                                       ^
/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/java_raw_api.c:331:3: warning: 'ffi_java_ptrarray_to_raw' is deprecated [-Wdeprecated-declarations]
  ffi_java_ptrarray_to_raw (cif, avalue, raw);
  ^
include/ffi.h:295:93: note: 'ffi_java_ptrarray_to_raw' has been explicitly marked deprecated here
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
                                                                                            ^
2 warnings generated.
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src   -Wall -fexceptions -c -o src/closures.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/closures.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -Wall -fexceptions -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/closures.c  -fno-common -DPIC -o src/.libs/closures.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src   -Wall -fexceptions -c -o src/aarch64/ffi.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/aarch64/ffi.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -Wall -fexceptions -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/aarch64/ffi.c  -fno-common -DPIC -o src/aarch64/.libs/ffi.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src  -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src  -c -o src/aarch64/sysv.lo /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/aarch64/sysv.S
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -I. -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/include -Iinclude -I/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src -c /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/src/aarch64/sysv.S  -fno-common -DPIC -o src/aarch64/.libs/sysv.o
/bin/sh ./libtool  --tag=CC   --mode=link clang  -Wall -fexceptions   -o libffi_convenience.la  src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo   src/aarch64/ffi.lo src/aarch64/sysv.lo
libtool: link: ar cru .libs/libffi_convenience.a src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/aarch64/.libs/ffi.o src/aarch64/.libs/sysv.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libffi_convenience.a(ffi.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libffi_convenience.a(sysv.o) has no symbols
libtool: link: ranlib .libs/libffi_convenience.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libffi_convenience.a(ffi.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libffi_convenience.a(sysv.o) has no symbols
libtool: link: ( cd ".libs" && rm -f "libffi_convenience.la" && ln -s "../libffi_convenience.la" "libffi_convenience.la" )
/bin/sh ./libtool  --tag=CC   --mode=link clang  -Wall -fexceptions -no-undefined -version-info `grep -v '^#' /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/libtool-version`     -o libffi.la -rpath /usr/local/lib src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo  src/aarch64/ffi.lo src/aarch64/sysv.lo
libtool: link: clang -dynamiclib  -o .libs/libffi.8.dylib  src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/aarch64/.libs/ffi.o src/aarch64/.libs/sysv.o      -install_name  /usr/local/lib/libffi.8.dylib -compatibility_version 10 -current_version 10.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
  "_ffi_call", referenced from:
      _ffi_raw_call in raw_api.o
      _ffi_java_raw_call in java_raw_api.o
  "_ffi_closure_trampoline_table_page", referenced from:
      _ffi_trampoline_table_alloc in closures.o
  "_ffi_prep_cif_machdep", referenced from:
      _ffi_prep_cif_core in prep_cif.o
  "_ffi_prep_cif_machdep_var", referenced from:
      _ffi_prep_cif_core in prep_cif.o
  "_ffi_prep_closure_loc", referenced from:
      _ffi_prep_closure in prep_cif.o
      _ffi_prep_raw_closure_loc in raw_api.o
      _ffi_prep_java_raw_closure_loc in java_raw_api.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libffi.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** ["/Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi-arm64-darwin22"/.libs/libffi_convenience.a] Error 2

make failed, exit code 2

Gem files will remain installed in /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to /Users/msyu/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/extensions/arm64-darwin-22/2.7.0/ffi-1.15.5/gem_make.out

 

에러메시지에 계속 나오는 ffi가 문제가 있어보입니다. ffi도 설치를 해줍니다 (M1의 경우 arm기반이라 arch -arm64로 진행했습니다.)

$ sudo arch -arm64 gem install ffi                                                             1 ↵  10404  14:42:54
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Installing ri documentation for ffi-1.15.5
Done installing documentation for ffi after 11 seconds
1 gem installed

 

📍 세번째 시도

다시 cocoapods version 1.11.2 를 설치합니다 

$ sudo gem install cocoapods -v 1.11.2                                                           ✔  10405  14:44:33
Successfully installed ethon-0.16.0
Successfully installed typhoeus-1.4.0
Successfully installed concurrent-ruby-1.2.0
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Successfully installed fuzzy_match-2.0.4
Successfully installed i18n-1.12.0
Successfully installed tzinfo-2.0.6
Successfully installed zeitwerk-2.6.7
Successfully installed activesupport-6.1.7.2
Successfully installed cocoapods-core-1.11.2
Successfully installed cocoapods-1.11.2
Parsing documentation for ethon-0.16.0
Installing ri documentation for ethon-0.16.0
Parsing documentation for typhoeus-1.4.0
Installing ri documentation for typhoeus-1.4.0
Parsing documentation for concurrent-ruby-1.2.0
Installing ri documentation for concurrent-ruby-1.2.0
Parsing documentation for httpclient-2.8.3
Installing ri documentation for httpclient-2.8.3
Parsing documentation for algoliasearch-1.27.5
Installing ri documentation for algoliasearch-1.27.5
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for i18n-1.12.0
Installing ri documentation for i18n-1.12.0
Parsing documentation for tzinfo-2.0.6
Installing ri documentation for tzinfo-2.0.6
Parsing documentation for zeitwerk-2.6.7
Installing ri documentation for zeitwerk-2.6.7
Parsing documentation for activesupport-6.1.7.2
Installing ri documentation for activesupport-6.1.7.2
Parsing documentation for cocoapods-core-1.11.2
Installing ri documentation for cocoapods-core-1.11.2
Parsing documentation for cocoapods-1.11.2
Installing ri documentation for cocoapods-1.11.2
Done installing documentation for ethon, typhoeus, concurrent-ruby, httpclient, algoliasearch, fuzzy_match, i18n, tzinfo, zeitwerk, activesupport, cocoapods-core, cocoapods after 27 seconds
12 gems installed

$ pod --version                                                                                  ✔  10406  14:45:13
1.11.2

 

 

드디어 설치에 성공하였습니다.!! 🙆‍♂️

 

시뮬레이터를 실행하고 flutter run을 해봅니다.

 

flutter 정상 동작 확인!! 🙌

반응형