Gem 开发环境 (Ubuntu Kylin 16.04 LTS) redcarpet 安装失败

sqsy · 2018年01月11日 · 最后由 sqsy 回复于 2018年01月11日 · 1995 次阅读

开发环境 (Ubuntu Kylin 16.04 LTS) redcarpet 安装失败,找遍 stackoverflow 和 redcarpet git repository issues,尝试了诸多方法后 (不同的 ruby 版本,2.4.0, 2.4.3, 2.5.0 都试了一遍,不同的 redcarpet 版本从 2.2 到 3.4,libgmp-dev, libgmp3-dev, GMP 也都安装了一遍),都无法解决。

(生产环境 Ubuntu Server 14.04 安装顺利,且两年前,Ubuntu Kylin 开发环境安装 redcarpet 3.3.4 也没有任何问题)

根据 repository issues,应该是常见问题,不知道有没有遇到相同问题。

Building native extensions. This could take a while...
ERROR:  Error installing redcarpet:
    ERROR: Failed to build gem native extension.

    current directory: /home/kevin/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0/ext/redcarpet
/home/kevin/.rbenv/versions/2.4.3/bin/ruby -r ./siteconf20180111-24116-8kyrcv.rb extconf.rb
creating Makefile

current directory: /home/kevin/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0/ext/redcarpet
make "DESTDIR=" clean

current directory: /home/kevin/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0/ext/redcarpet
make "DESTDIR="
compiling autolink.c
compiling buffer.c
buffer.c: In function ‘bufcstr’:
buffer.c:111:45: warning: passing argument 1 of ‘bufgrow’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1) == BUF_OK) {
                                             ^
buffer.c:60:1: note: expected ‘struct buf *’ but argument is of type ‘const struct buf *’
 bufgrow(struct buf *buf, size_t neosz)
 ^
buffer.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
compiling houdini_href_e.c
compiling houdini_html_e.c
compiling html.c
compiling html_smartypants.c
html_smartypants.c: In function ‘squote_len’:
html_smartypants.c:104:39: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  static char* single_quote_list[] = { "'", "&#39;", "&#x27;", "&apos;", NULL };
                                       ^
html_smartypants.c:104:44: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  static char* single_quote_list[] = { "'", "&#39;", "&#x27;", "&apos;", NULL };
                                            ^
html_smartypants.c:104:53: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  static char* single_quote_list[] = { "'", "&#39;", "&#x27;", "&apos;", NULL };
                                                     ^
html_smartypants.c:104:63: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  static char* single_quote_list[] = { "'", "&#39;", "&#x27;", "&apos;", NULL };
                                                               ^
html_smartypants.c: In function ‘smartypants_squote’:
html_smartypants.c:149:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    uint8_t next_char = (size > 1+next_squote_len) ? text[1+next_squote_len] : 0;
                              ^
html_smartypants.c: In function ‘smartypants_cb__amp’:
html_smartypants.c:250:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  int len = squote_len(text, size);
  ^
html_smartypants.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
compiling markdown.c
markdown.c: In function ‘char_link’:
markdown.c:1045:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   struct buf id = { 0, 0, 0, 0 };
   ^
markdown.c:1085:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   size_t nb_p = 0;
   ^
markdown.c: In function ‘sd_markdown_render’:
markdown.c:2818:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  int footnotes_enabled  = md->ext_flags & MKDEXT_FOOTNOTES;
  ^
markdown.c:2836:43: warning: passing argument 1 of ‘is_codefence’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   if (codefences_enabled && (is_codefence(document + beg, doc_size - beg, NULL) != 0))
                                           ^
markdown.c:1389:1: note: expected ‘uint8_t * {aka unsigned char *}’ but argument is of type ‘const uint8_t * {aka const unsigned char *}’
 is_codefence(uint8_t *data, size_t size, struct buf *syntax)
 ^
markdown.c: At top level:
markdown.c:94:15: warning: ‘char_underline’ declared ‘static’ but never defined [-Wunused-function]
 static size_t char_underline(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offset, size_t size);
               ^
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
compiling rc_markdown.c
rc_markdown.c: In function ‘rb_redcarpet_md_render’:
rc_markdown.c:138:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  struct rb_redcarpet_rndr *renderer;
  ^
rc_markdown.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
compiling rc_render.c
rc_render.c: In function ‘rndr_link_attributes’:
rc_render.c:287:28: warning: variable ‘rndr’ set but not used [-Wunused-but-set-variable]
  struct rb_redcarpet_rndr *rndr;
                            ^
rc_render.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
compiling stack.c
linking shared-object redcarpet.so
redcarpet.so: 最后的关闭失败: 无效的操作
collect2: error: ld returned 1 exit status
Makefile:257: recipe for target 'redcarpet.so' failed
make: *** [redcarpet.so] Error 1

make failed, exit code 2

Gem files will remain installed in /home/kevin/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0 for inspection.
Results logged to /home/kevin/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/redcarpet-3.4.0/gem_make.out

不知道有没有其他同学遇到和我相同的问题,蛮纠结。

先换标准版 Ubuntu

Already submitted a issue on redcarpet git repository.

Rei 回复

看来只能试试标准版 Ubuntu 16.04 了。 很奇怪的是,Ruby 2.3 的时候,没出现过安装 redcarpet 错误。

sqsy 关闭了讨论。 10月10日 10:02
需要 登录 后方可回复, 如果你还没有账号请 注册新账号