Problem:
I have tried to do a gem install rdiscount -v '2.2.0.1'
and get an error.
Solution:
I have tried below command to get this to work
gem install rdiscount:2.2.0.1 -- --with-cflags="-Wno-error=implicit-function-declaration"
Error looks like
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。
in big Sur, I encountered a similar problem when installing rb-appscript
: sudo gem install rb-appscript
This could take a while...
ERROR: Error installing rb-appscript:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.7.0/gems/rb-appscript-0.6.1
/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0 -r ./siteconf20201125-30706-1azyih7.rb extconf.rb --with-cflags\=-Wno-error\=implicit-function-declaration
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.7.2/bin/$(RUBY_BASE_NAME)
extconf.rb:44:in `<main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
CONFIG
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/rb-appscript-0.6.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/rb-appscript-0.6.1/gem_make.out
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.