我试图在 FreeBSD 上捆绑,但它找不到 grpc gem。我使用 FreeBSD 软件包安装了 grpc 1.30.2
版本,但找不到系统 gem。
我希望有一个 bundle config
设置来查找和使用已经构建和安装的系统 gem。
我得到的错误是:
An error occurred while installing grpc (1.30.2), and Bundler cannot continue.
Make sure that `gem install grpc -v '1.30.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
grpc
* bundle install
Warning: the running version of Bundler (2.0.2) is older than the version that created the lockfile (2.2.11). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
/usr/local/lib/ruby/site_ruby/2.7/rubygems/package.rb:509: warning: Using the last argument as keyword parameters is deprecated
/usr/local/lib/ruby/site_ruby/2.7/rubygems/package.rb:509: warning: Using the last argument as keyword parameters is deprecated
/usr/local/lib/ruby/site_ruby/2.7/rubygems/package.rb:509: warning: Using the last argument as keyword parameters is deprecated
/usr/local/lib/ruby/site_ruby/2.7/rubygems/package.rb:509: warning: Using the last argument as keyword parameters is deprecated
Some gems seem to be missing from your vendor/cache directory.
Could not find grpc-1.30.2 in any of the sources
* Visruleparser
A extras/visruleparser.pl
Export complete.
* precompile assets
Could not find grpc-1.30.2 in any of the sources
Run `bundle install` to install missing gems.
我的 Gemfile 有这些行
source 'https://rubygems.org'
gem 'grpc', '1.30.2'
gem 'grpc-tools', '1.30.2'
Gemfile.lock 有这些
grpc (= 1.30.2)
grpc-tools (= 1.30.2)
这些 FreeBSD 软件包已安装
>pkg info -x grpc
grpc-1.22.0_4,2
rubygem-grpc-1.30.2
>gem list grpc
*** LOCAL GEMS ***
grpc (1.30.2)
在 FreeBSD 上列出远程 gems 没有任何显示
>gem list --remote -all gprc
*** LOCAL GEMS ***
但在 macOS 上我得到了这些(以及其他)
>gem list --remote --all grpc
grpc (1.37.0 ruby universal-darwin x64-mingw32 x86-linux x86-mingw32 x86_64-linux,
1.36.0 ruby universal-darwin x64-mingw32 x86-linux x86-mingw32 x86_64-linux,
...
1.30.2 ruby universal-darwin x64-mingw32 x86-linux x86-mingw32 x86_64-linux,
...
gem 安装在目录 /usr/local/lib/ruby/gems/2.7/gems/grpc-1.30.2
中,其下有一个 src
子目录和一个 ruby
子目录。
>ls /usr/local/lib/ruby/gems/2.7/gems/grpc-1.30.2/src/ruby
bin ext lib pb spec
FreeBSD 11.4
Ruby 2.7.2p137
RubyGems 3.0.8
Bundler 2.1.4
答案 0 :(得分:1)
看起来这可能是我的错。 gem 包有意从 gem 中删除缓存目录。这最初是在这里添加的:
https://cgit.freebsd.org/ports/commit/Mk/bsd.ruby.mk?id=8d77480356f58d6d8d1c69884d1ba9cc98ed383a
并住在这里:
https://cgit.freebsd.org/ports/tree/Mk/Uses/gem.mk#n111
${RM} -r ${STAGEDIR}${PREFIX}/${CACHE_DIR} 2> /dev/null || ${TRUE}
添加这个是因为很多 gem 包含大量从未在缓存目录中使用过的东西,包括源代码的完整副本、中间构建输出等,它们不应该真正打包。
如果您正在构建自己的包,您可以尝试使用 gem.mk 中删除缓存目录的行。否则,我们可能需要重新审视这个上游。无论如何,您可能应该在上游打开一个错误:
https://bugs.freebsd.org/bugzilla/
但是有一些权衡,我不确定捆绑从系统包安装的 gem 的用例。 (我最近没怎么用 Ruby。)