我来找你寻求帮助。我正在尝试在本地运行一个已经存在的 ruby on rails 应用程序“rssbox”。但是,当我尝试使用 bundle install 命令安装所需的 gem 时遇到了这个问题:
PS C:\Users\Ayoub\Repository\rssbox-master> bundle
Fetching gem metadata from https://rubygems.org/............
Resolving dependencies...
Using rake 13.0.3
Using public_suffix 4.0.6
Using addressable 2.7.0
Using rbtree3 0.6.0
Using airbrake-ruby 5.2.0
Using airbrake 11.0.3
Using bundler 2.1.4
Using rack 2.2.3
Fetching clogger 2.3.1
Installing clogger 2.3.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/clogger-2.3.1/ext/clogger_ext
C:/Ruby27-x64/bin/ruby.exe -I C:/Ruby27-x64/lib/ruby/2.7.0 -r
./siteconf20210705-3216-13abwp2.rb extconf.rb
checking for ruby.h... yes
checking for fcntl.h... yes
checking for F_GETFL in fcntl.h... no
checking for O_NONBLOCK in unistd.h,fcntl.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
checking for clockid_t in time.h... yes
checking for clock_gettime() in time.h... yes
checking for localtime_r() in time.h... yes
checking for gmtime_r() in time.h... yes
checking for struct tm.tm_gmtoff in time.h... no
checking for rb_str_set_len() in ruby.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region() in ruby.h... no
checking for rb_thread_io_blocking_region() in ruby.h... yes
checking for rb_obj_respond_to() in ruby/intern.h... yes
creating Makefile
current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/clogger-2.3.1/ext/clogger_ext
make "DESTDIR=" clean
current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/clogger-2.3.1/ext/clogger_ext
make "DESTDIR="
generating clogger_ext-x64-mingw32.def
compiling clogger.c
In file included from clogger.c:14:
C:/Ruby27-x64/msys64/mingw64/x86_64-w64-mingw32/include/sys/time.h:42:13: error:
conflicting types for 'gettimeofday'
42 | int __cdecl gettimeofday(struct timeval *__restrict__,
| ^~~~~~~~~~~~
In file included from C:/Ruby27-x64/include/ruby-2.7.0/ruby/defines.h:371,
from C:/Ruby27-x64/include/ruby-2.7.0/ruby/ruby.h:29,
from C:/Ruby27-x64/include/ruby-2.7.0/ruby.h:33,
from clogger.c:4:
C:/Ruby27-x64/include/ruby-2.7.0/ruby/win32.h:318:12: note: previous declaration
of 'gettimeofday' was here
318 | extern int gettimeofday(struct timeval *, struct timezone *);
| ^~~~~~~~~~~~
clogger.c: In function 'clogger_each':
clogger.c:849:31: warning: passing argument 3 of 'rb_iterate' from incompatible
pointer type [-Wincompatible-pointer-types]
849 | rb_iterate(rb_each, c->body, body_iter_i, self);
| ^~~~~~~~~~~
| |
| VALUE (*)(VALUE, VALUE) {aka long long
unsigned int (*)(long long unsigned int, long long unsigned int)}
In file included from C:/Ruby27-x64/include/ruby-2.7.0/ruby.h:33,
from clogger.c:4:
C:/Ruby27-x64/include/ruby-2.7.0/ruby/ruby.h:1984:40: note: expected
'rb_block_call_func_t' {aka 'long long unsigned int (*)(long long unsigned int,
long long unsigned int, int, const long long unsigned int *, long long
unsigned int)'} but argument is of type 'VALUE (*)(VALUE, VALUE)' {aka 'long
long unsigned int (*)(long long unsigned int, long long unsigned int)'}
1984 | VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE);
| ^~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:245 : clogger.o] Erreur 1
make failed, exit code 2
Gem files will remain installed in
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/clogger-2.3.1 for inspection.
Results logged to
C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/clogger-2.3.1/gem_make.out
An error occurred while installing clogger (2.3.1), and Bundler cannot continue.
Make sure that `gem install clogger -v '2.3.1' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
clogger
显然是不可安装的 clogger 包的问题。我已经在 gemfile.lock 中验证了我机器上安装的 ruby 和 bundle 的版本与项目作者使用的对应。我在windows 10下
谢谢你的帮助,
阿尤布。