ruby-on-rails - 安装 rdiscount (2.2.0.1) 时出错,Bundler 无法在 Mac OS 和 Ruby 2.7.1 上继续

标签 ruby-on-rails ruby rubygems rdiscount

问题:

我尝试执行 gem install rdiscount -v '2.2.0.1' 并收到错误。

解决方案:

我已尝试使用以下命令来使其正常工作

gem install rdiscount:2.2.0.1 -- --with-cflags="-Wno-error=implicit-function-declaration"

错误看起来像

Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/kgarigipati/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rdiscount-2.2.0.1/ext
/Users/kgarigipati/.rbenv/versions/2.7.1/bin/ruby -I /Users/kgarigipati/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20201104-70970-w4fetk.rb extconf.rb
checking for random()... yes
checking for srandom()... yes
checking for rand()... yes
checking for srand()... yes
creating Makefile

current directory: /Users/kgarigipati/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rdiscount-2.2.0.1/ext
make "DESTDIR=" clean

current directory: /Users/kgarigipati/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rdiscount-2.2.0.1/ext
make "DESTDIR="
compiling Csio.c
compiling amalloc.c
amalloc.c:23:1: warning: function 'die' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
amalloc.c:39:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    if ( ret = calloc(count + sizeof(struct alist) + sizeof(int), size) ) {
         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
amalloc.c:39:14: note: place parentheses around the assignment to silence this warning
    if ( ret = calloc(count + sizeof(struct alist) + sizeof(int), size) ) {
             ^
         (                                                             )
amalloc.c:39:14: note: use '==' to turn this assignment into an equality comparison
    if ( ret = calloc(count + sizeof(struct alist) + sizeof(int), size) ) {
             ^
             ==
amalloc.c:76:10: warning: passing 'const char [46]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            die("goddam: corrupted memory block %d in free()!\n", p2->index);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
amalloc.c:22:11: note: passing argument to parameter 'msg' here
die(char *msg, int index)
          ^
amalloc.c:95:10: warning: passing 'const char [49]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            die("goddam: corrupted memory block %d in realloc()!\n", p2->index);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
amalloc.c:22:11: note: passing argument to parameter 'msg' here
die(char *msg, int index)
          ^
4 warnings generated.
compiling basename.c
compiling css.c
css.c:81:28: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    written = (size > 0) ? fwrite(res,1,size,f) : 0;
            ~              ^~~~~~~~~~~~~~~~~~~~
1 warning generated.
compiling docheader.c
compiling dumptree.c
dumptree.c:23:29: warning: returning 'const char [11]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case WHITESPACE: return "whitespace";
                            ^~~~~~~~~~~~
dumptree.c:24:29: warning: returning 'const char [5]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case CODE      : return "code";
                            ^~~~~~
dumptree.c:25:29: warning: returning 'const char [6]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case QUOTE     : return "quote";
                            ^~~~~~~
dumptree.c:26:29: warning: returning 'const char [7]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case MARKUP    : return "markup";
                            ^~~~~~~~
dumptree.c:27:29: warning: returning 'const char [5]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case HTML      : return "html";
                            ^~~~~~
dumptree.c:28:29: warning: returning 'const char [3]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case DL        : return "dl";
                            ^~~~
dumptree.c:29:29: warning: returning 'const char [3]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case UL        : return "ul";
                            ^~~~
dumptree.c:30:29: warning: returning 'const char [3]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case OL        : return "ol";
                            ^~~~
dumptree.c:31:29: warning: returning 'const char [5]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case LISTITEM  : return "item";
                            ^~~~~~
dumptree.c:32:29: warning: returning 'const char [7]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case HDR       : return "header";
                            ^~~~~~~~
dumptree.c:33:29: warning: returning 'const char [3]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case HR        : return "hr";
                            ^~~~
dumptree.c:34:29: warning: returning 'const char [6]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case TABLE     : return "table";
                            ^~~~~~~
dumptree.c:35:29: warning: returning 'const char [7]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case SOURCE    : return "source";
                            ^~~~~~~~
dumptree.c:36:29: warning: returning 'const char [6]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    case STYLE     : return "style";
                            ^~~~~~~
dumptree.c:37:29: warning: returning 'const char [14]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    default        : return "mystery node!";
                            ^~~~~~~~~~~~~~~
dumptree.c:104:33: warning: initializing 'char *' with an expression of type 'const char [2]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    static char *Begin[] = { 0, "P", "center" };
                                ^~~
dumptree.c:104:38: warning: initializing 'char *' with an expression of type 'const char [7]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    static char *Begin[] = { 0, "P", "center" };
                                     ^~~~~~~~
17 warnings generated.
compiling emmatch.c
emmatch.c:113:20: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    case 2: if ( e = empair(f,first,last,match=2) )
                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
emmatch.c:113:20: note: place parentheses around the assignment to silence this warning
    case 2: if ( e = empair(f,first,last,match=2) )
                   ^
                 (                               )
emmatch.c:113:20: note: use '==' to turn this assignment into an equality comparison
    case 2: if ( e = empair(f,first,last,match=2) )
                   ^
                   ==
1 warning generated.
compiling flags.c
flags.c:10:27: warning: initializing 'char *' with an expression of type 'const char [7]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    { MKD_NOLINKS,        "!LINKS" },
 
                          
################### Here continues bunch of warnings (log is too big to include) ###############


  ^~~~~~~~~~~~~~~~
rdiscount.c:36:7: warning: initializing 'char *' with an expression of type 'const char [17]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    { "no_strikethrough", MKD_NOSTRIKETHROUGH },
      ^~~~~~~~~~~~~~~~~~
rdiscount.c:53:17: error: implicit declaration of function 'rb_rdiscount__get_flags' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    int flags = rb_rdiscount__get_flags(self);
                ^
rdiscount.c:66:48: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);
                 ~~~~~~~~~~                    ^~~~~~~~~~~~~~~~~
/Users/kgarigipati/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1007:6: note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/kgarigipati/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1003:6: note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rdiscount.c:66:48: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);
                 ~~~~~~~~~~                    ^~~~~~~~~~~~~~~~~
/Users/kgarigipati/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1008:28: note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
rdiscount.c:96:17: error: implicit declaration of function 'rb_rdiscount__get_flags' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    int flags = rb_rdiscount__get_flags(self);
                ^
rdiscount.c:105:48: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);
                 ~~~~~~~~~~                    ^~~~~~~~~~~~~~~~~
/Users/kgarigipati/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1007:6: note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/kgarigipati/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1003:6: note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rdiscount.c:105:48: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    MMIOT *doc = mkd_string(RSTRING_PTR(text), RSTRING_LEN(text), flags);
                 ~~~~~~~~~~                    ^~~~~~~~~~~~~~~~~
/Users/kgarigipati/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1008:28: note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
16 warnings and 2 errors generated.
make: *** [rdiscount.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/kgarigipati/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rdiscount-2.2.0.1 for inspection.
Results logged to /Users/kgarigipati/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/rdiscount-2.2.0.1/gem_make.out

An error occurred while installing rdiscount (2.2.0.1), and Bundler cannot continue.
Make sure that `gem install rdiscount -v '2.2.0.1'` succeeds before bundling.

In Gemfile:
  rdiscount

最佳答案

如果您在 macOS Big Sur 上进行构建,则需要升级到 RDiscount 2.2.0.2。

关于ruby-on-rails - 安装 rdiscount (2.2.0.1) 时出错,Bundler 无法在 Mac OS 和 Ruby 2.7.1 上继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64706036/

相关文章:

ruby - 在 GC Patched ruby​​ 中安装 gems 的正确方法是什么?

ruby-on-rails - 您如何测试依赖于另一个模型的模型?

ruby-on-rails - 在 Ruby on Rails 中处理无 ID 错误的最佳方法是什么?

ruby-on-rails - 如何使用 Capistrano gem 为生产数据库播种?

ruby-on-rails - [尝试部署] : You must use Bundler 2 or greater with this lockfile

ruby - 安装成功后无法运行sass

ruby-on-rails - Grunt task Compass 失败——找不到 RubyGem compass (>= 0)

ruby - 为什么有人会扔出一个非符号呢?

ruby-on-rails - 在 ruby​​ 代码中将参数作为 param={} 传递

Windows 上的 Ruby gems 主页