安装 github-markdown gem 时如何解决错误?

问题描述 投票:0回答:1

安装github-markdown 0.6.9 gem时出现如下错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/Moth/.rvm/gems/ruby-2.6.6@searchgov-rails42/gems/github-markdown-0.6.9/ext/markdown
/Users/Moth/.rvm/rubies/ruby-2.6.6/bin/ruby -I /Users/Moth/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0 -r
./siteconf20210820-81082-7n7xnz.rb extconf.rb
creating Makefile

current directory: /Users/Moth/.rvm/gems/ruby-2.6.6@searchgov-rails42/gems/github-markdown-0.6.9/ext/markdown
make "DESTDIR=" clean

current directory: /Users/Moth/.rvm/gems/ruby-2.6.6@searchgov-rails42/gems/github-markdown-0.6.9/ext/markdown
make "DESTDIR="
compiling autolink.c
compiling buffer.c
compiling gh-markdown.c
gh-markdown.c:56:29: error: implicitly declaring library function 'isspace' with type 'int (int)'
[-Werror,-Wimplicit-function-declaration]
                while (i < lang->size && !isspace(lang->data[i]))
                                          ^
gh-markdown.c:56:29: note: include the header <ctype.h> or explicitly provide a declaration for 'isspace'
gh-markdown.c:60:14: warning: assigning to 'const char *' from 'uint8_t *' (aka 'unsigned char *') converts between
pointers to integer types with different sign [-Wpointer-sign]
                        lang_name = lang->data + 1;
                                  ^ ~~~~~~~~~~~~~~
gh-markdown.c:63:14: warning: assigning to 'const char *' from 'uint8_t *const' (aka 'unsigned char *const') converts
between pointers to integer types with different sign [-Wpointer-sign]
                        lang_name = lang->data;
                                  ^ ~~~~~~~~~~
gh-markdown.c:71:5: warning: passing 'uint8_t *const' (aka 'unsigned char *const') to parameter of type 'const char *'
converts between pointers to integer types with different sign [-Wpointer-sign]
                                geefem_str_new(text->data, text->size),
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gh-markdown.c:21:35: note: expanded from macro 'geefem_str_new'
#       define geefem_str_new(str, len) rb_enc_str_new(str, len, rb_utf8_encoding())
                                        ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:158:24: note: expanded from macro 'rb_enc_str_new'
        rb_enc_str_new_static((str), (len), (enc)) : \
                              ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/defines.h:116:53: note: expanded from macro
'RB_GNUC_EXTENSION_BLOCK'
#define RB_GNUC_EXTENSION_BLOCK(x) __extension__ ({ x; })
                                                    ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:2588:40: note: expanded from macro 'rb_yield_values'
        const VALUE rb_yield_values_args[] = {__VA_ARGS__}; \
                                              ^~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:140:40: note: passing argument to parameter here
VALUE rb_enc_str_new_static(const char*, long, rb_encoding*);
                                       ^
gh-markdown.c:71:5: warning: passing 'uint8_t *const' (aka 'unsigned char *const') to parameter of type 'const char *'
converts between pointers to integer types with different sign [-Wpointer-sign]
                                geefem_str_new(text->data, text->size),
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gh-markdown.c:21:35: note: expanded from macro 'geefem_str_new'
#       define geefem_str_new(str, len) rb_enc_str_new(str, len, rb_utf8_encoding())
                                        ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:159:17: note: expanded from macro 'rb_enc_str_new'
        rb_enc_str_new((str), (len), (enc)) \
                       ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/defines.h:116:53: note: expanded from macro
'RB_GNUC_EXTENSION_BLOCK'
#define RB_GNUC_EXTENSION_BLOCK(x) __extension__ ({ x; })
                                                    ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:2588:40: note: expanded from macro 'rb_yield_values'
        const VALUE rb_yield_values_args[] = {__VA_ARGS__}; \
                                              ^~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:138:33: note: passing argument to parameter here
VALUE rb_enc_str_new(const char*, long, rb_encoding*);
                                ^
gh-markdown.c:82:3: error: implicit declaration of function 'houdini_escape_html0' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
                houdini_escape_html0(ob, lang_name, lang_size, 0);
                ^
gh-markdown.c:89:2: error: implicit declaration of function 'houdini_escape_html0' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
        houdini_escape_html0(ob, text->data, text->size, 0);
        ^
gh-markdown.c:122:33: warning: passing 'char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *')
converts between pointers to integer types with different sign [-Wpointer-sign]
        sd_markdown_render(output_buf, RSTRING_PTR(rb_text), RSTRING_LEN(rb_text), md);
                                       ^~~~~~~~~~~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/ruby.h:1003:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./markdown.h:124:51: note: passing argument to parameter 'document' here
sd_markdown_render(struct buf *ob, const uint8_t *document, size_t doc_size, struct sd_markdown *md);
                                                  ^
gh-markdown.c:125:12: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts
between pointers to integer types with different sign [-Wpointer-sign]
        rb_text = geefem_str_new(output_buf->data, output_buf->size);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gh-markdown.c:21:35: note: expanded from macro 'geefem_str_new'
#       define geefem_str_new(str, len) rb_enc_str_new(str, len, rb_utf8_encoding())
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:158:24: note: expanded from macro 'rb_enc_str_new'
        rb_enc_str_new_static((str), (len), (enc)) : \
        ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/defines.h:116:53: note: expanded from macro
'RB_GNUC_EXTENSION_BLOCK'
#define RB_GNUC_EXTENSION_BLOCK(x) __extension__ ({ x; })
                                                    ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:140:40: note: passing argument to parameter here
VALUE rb_enc_str_new_static(const char*, long, rb_encoding*);
                                       ^
gh-markdown.c:125:12: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts
between pointers to integer types with different sign [-Wpointer-sign]
        rb_text = geefem_str_new(output_buf->data, output_buf->size);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gh-markdown.c:21:35: note: expanded from macro 'geefem_str_new'
#       define geefem_str_new(str, len) rb_enc_str_new(str, len, rb_utf8_encoding())
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:159:17: note: expanded from macro 'rb_enc_str_new'
        rb_enc_str_new((str), (len), (enc)) \
        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/defines.h:116:53: note: expanded from macro
'RB_GNUC_EXTENSION_BLOCK'
#define RB_GNUC_EXTENSION_BLOCK(x) __extension__ ({ x; })
                                                    ^
/Users/Moth/.rvm/rubies/ruby-2.6.6/include/ruby-2.6.0/ruby/encoding.h:138:33: note: passing argument to parameter here
VALUE rb_enc_str_new(const char*, long, rb_encoding*);
                                ^
7 warnings and 3 errors generated.
make: *** [gh-markdown.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/Moth/.rvm/gems/ruby-2.6.6@searchgov-rails42/gems/github-markdown-0.6.9 for
inspection.
Results logged to
/Users/Moth/.rvm/gems/ruby-2.6.6@searchgov-rails42/extensions/x86_64-darwin-19/2.6.0/github-markdown-0.6.9/gem_make.out

An error occurred while installing github-markdown (0.6.9), and Bundler cannot continue.
Make sure that `gem install github-markdown -v '0.6.9' --source 'https://rubygems.org/'` succeeds before bundling.
ruby rubygems
1个回答
6
投票

2023 更新: 下面仍然有效,但我建议检查 redcarpet gem 作为长期废弃的 github-markdown gem 的替代品。我们刚刚在我们的生产环境中用最小的努力用 redcarpet 替换了 github-markdown。

我能够使用以下标志成功安装 github-markdown gem:

gem install github-markdown -v '0.6.9' --source 'https://rubygems.org/' -- --with-cflags="-Wno-error=implicit-function-declaration"
© www.soinside.com 2019 - 2024. All rights reserved.