[thông tin phiên bản]Lỗi khi cài đặt json 1.8.3 với ruby 2,4
ruby 2.4.0p0 (2016/12/24 sửa đổi 57.164) [x86_64-linux] /đá quý 2.0.3/ Windows 10
tôi chạy bundle install
và nó nói với tôi để chạy gem install json -v '1.8.3'
tôi đã làm điều đó và có một Không thể xây dựng đá quý tự nhiên mở rộng lỗi.
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
} else if (klass == rb_cFixnum) {
^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
} else if (klass == rb_cBignum) {
^
generator.c: At top level:
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
make: *** [generator.o] Error 1
Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3 for inspection.
Results logged to /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
Tôi đã kiểm tra một số tài liệu. Tôi đã cài đặt Devkit và json 1.8.5 nhưng dự án của tôi giữ thông báo "cài đặt json 1.8.3" Tôi có thể giải quyết vấn đề này bằng cách nào?
/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3
chứa:
../
./
data/
diagrams/
ext/
java/
lib/
tests/
tools/
install.rb*
.gitignore
.travis.yml
CHANGES
COPYING
COPYING-json-jruby
GPL
Gemfile
README-json-jruby.markdown
README.rdoc
Rakefile
/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
chứa:
user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
/home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
} else if (klass == rb_cFixnum) {
^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
} else if (klass == rb_cBignum) {
^
generator.c: At top level:
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
make: *** [generator.o] Error 1
Câu hỏi đầu tiên là tại sao bạn cần đá quý JSON? Ruby có hỗ trợ JSON tích hợp sẵn. Thứ hai, tại sao sử dụng một phiên bản cũ hơn? Ruby 2.4.0 đã thay đổi một số nội bộ có thể cần sử dụng phiên bản mới nhất của viên đá quý đó. Nếu bạn đang mắc kẹt với một sự phụ thuộc khó khăn trên phiên bản cụ thể này, bạn có thể cần phải sử dụng Ruby 2.3.x hoặc một cái gì đó mà nó có thể biên dịch chống lại cho đến khi bạn có thể nhận được hạn chế đó loại bỏ. – tadman
@tadman Tôi cần phiên bản JSON 1.8.3 vì putty yêu cầu tôi. Nếu tôi chạy 'bundle install', putty ra lệnh cho tôi thiết lập JSON 1.8.3. Tôi đã cài đặt các phiên bản khác (2.0.3 và 2.0.2) nhưng nó vẫn nói rằng "cài đặt JSON 1.8.3" .. Thực ra tôi là người mới bắt đầu và chỉ làm theo hướng dẫn mà tôi có, vì vậy tôi không linh hoạt trong việc giải quyết các vấn đề. –