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

pod 失败,需要修改podfile #18

Closed
zuohuachen opened this issue Dec 1, 2023 · 4 comments
Closed

pod 失败,需要修改podfile #18

zuohuachen opened this issue Dec 1, 2023 · 4 comments

Comments

@zuohuachen
Copy link

zuohuachen commented Dec 1, 2023

use_frameworks!

platform :osx, '10.11'

target 'FFmpegTutorial-macOS' do
  pod 'FFmpegTutorial',:path => '../../'
end

pre_install do |installer|
  puts `../../download-vendor.sh macos 0.10.1-230831144049-ijk`
end

如上,PodFile文件只有一个打印puts,没执行 sh文件。把它改成下面这样,就可以执行pod install了。

pre_install do |installer|
  podfile_path = File.dirname(File.realpath(__FILE__))
  script_relative_path = "../../download-vendor.sh"
  script_full_path = File.expand_path(script_relative_path, podfile_path)
  system("sh #{script_full_path} ios 0.10.1-230831144049-ijk")
end
@zuohuachen zuohuachen changed the title pod 失败,podfile写错了。 pod 失败,需要修改podfile Dec 1, 2023
@debugly
Copy link
Owner

debugly commented Dec 2, 2023

不是啊,这里使用了最简单的反引号方式调用了 shell ,然后通过 puts 把执行日志打印出来。
你可以看下这个:https://stackoverflow.com/questions/2232/how-to-call-shell-commands-from-ruby
麻烦改回去再试试,看下具体原因。

@zuohuachen
Copy link
Author

zuohuachen commented Dec 4, 2023

环境:
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
pod --version 1.13.0

报错原因:(但如果改成正常引号,可以正常执行)

➜ FFmpegTutorial git:(master) ✗ pod install --project-directory=Example/MacOS
Analyzing dependencies
Downloading dependencies
[!] An error occurred while processing the pre-install hook of the Podfile.

No such file or directory - ../../download-vendor.sh

/Users/xxxxx/Documents/GitHub/FFmpegTutorial/Example/MacOS/Podfile:10:in ``'
/Users/xxxxx/Documents/GitHub/FFmpegTutorial/Example/MacOS/Podfile:10:in block (2 levels) in from_ruby' /opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/podfile.rb:162:in pre_install!'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:958:in `run_podfile_pre_install_hook'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:946:in `block in run_podfile_pre_install_hooks'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:149:in `message'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:945:in `run_podfile_pre_install_hooks'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:259:in `block in download_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:257:in `download_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:163:in `install!'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `

'

@debugly
Copy link
Owner

debugly commented Dec 4, 2023

我知道了,是执行脚本时的目录不对,使用下面的步骤安装即可。

git clone https://github.com/debugly/FFmpegTutorial.git
cd FFmpegTutorial/Example/macOS
pod install
open FFmpegTutorial-macOS.xcworkspace

@debugly debugly closed this as completed Dec 4, 2023
@debugly
Copy link
Owner

debugly commented Dec 15, 2023

优化了脚本,现在可以 pod install --project-directory=Example/MacOS 了。

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

No branches or pull requests

2 participants