Failing to install Nokogiri on Mac Catalina - ruby

I am trying to set up my local environment and install nokogiri but am getting this error (apologies for the length):
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/bin/ruby -I /Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200716-95822-kw9idg.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
- 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
- 0002-Remove-script-macro-support.patch
- 0003-Update-entities-to-remove-handling-of-ssi.patch
- 0004-libxml2.la-is-in-top_builddir.patch
- 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.10.tar.gz into tmp/x86_64-apple-darwin17.7.0/ports/libxml2/2.9.10... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0002-Remove-script-macro-support.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch... OK
Running 'configure' for libxml2 2.9.10... OK
Running 'compile' for libxml2 2.9.10... OK
Running 'install' for libxml2 2.9.10... OK
Activating libxml2 2.9.10 (from /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ports/x86_64-apple-darwin17.7.0/libxml2/2.9.10)...
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxslt-1.1.34.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
************************************************************************
Extracting libxslt-1.1.34.tar.gz into tmp/x86_64-apple-darwin17.7.0/ports/libxslt/1.1.34... OK
Running 'configure' for libxslt 1.1.34... OK
Running 'compile' for libxslt 1.1.34... OK
Running 'install' for libxslt 1.1.34... OK
Activating libxslt 1.1.34 (from /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ports/x86_64-apple-darwin17.7.0/libxslt/1.1.34)...
checking for -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" clean
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR="
compiling html_document.c
html_document.c:16:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "0*", &rest);
^
1 warning generated.
compiling html_element_description.c
compiling html_entity_lookup.c
compiling html_sax_parser_context.c
compiling html_sax_push_parser.c
compiling nokogiri.c
compiling xml_attr.c
xml_attr.c:61:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &document, &name, &rest);
^
1 warning generated.
compiling xml_attribute_decl.c
compiling xml_cdata.c
xml_cdata.c:23:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &doc, &content, &rest);
^
xml_cdata.c:29:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
content_str_len = RSTRING_LEN(content);
~ ^~~~~~~~~~~~~~~~~~~~
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/include/ruby-2.6.0/ruby/ruby.h:1000:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/include/ruby-2.6.0/ruby/ruby.h:996:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xml_cdata.c:29:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
content_str_len = RSTRING_LEN(content);
~ ^~~~~~~~~~~~~~~~~~~~
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/include/ruby-2.6.0/ruby/ruby.h:1001:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
3 warnings generated.
compiling xml_comment.c
xml_comment.c:21:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &document, &content, &rest);
^
1 warning generated.
compiling xml_document.c
xml_document.c:330:31: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
if(rb_scan_args(argc, argv, "01", &level) == 0)
^
xml_document.c:357:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "0*", &rest);
^
xml_document.c:436:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "14", &name, &type, &external_id, &system_id,
^
xml_document.c:511:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "03", &mode, &incl_ns, &with_comments);
^
4 warnings generated.
compiling xml_document_fragment.c
xml_document_fragment.c:17:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "1*", &document, &rest);
^
1 warning generated.
compiling xml_dtd.c
compiling xml_element_content.c
compiling xml_element_decl.c
compiling xml_encoding_handler.c
compiling xml_entity_decl.c
compiling xml_entity_reference.c
xml_entity_reference.c:18:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &document, &name, &rest);
^
1 warning generated.
compiling xml_io.c
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
xml_node.c:304:15: warning: passing 'const xmlChar *' (aka 'const unsigned char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
xmlFree(reparentee->ns->prefix);
^~~~~~~~~~~~~~~~~~~~~~
xml_node.c:550:37: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
n_args = rb_scan_args(argc, argv, "02", &r_level, &r_new_parent_doc);
^
xml_node.c:1393:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &name, &document, &rest);
^
3 warnings generated.
compiling xml_node_set.c
xml_node_set.c:294:30: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "11", NULL, NULL);
^
1 warning generated.
compiling xml_processing_instruction.c
xml_processing_instruction.c:20:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "3*", &document, &name, &content, &rest);
^
1 warning generated.
compiling xml_reader.c
xml_reader.c:533:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "13", &rb_buffer, &rb_url, &encoding, &rb_options);
^
xml_reader.c:577:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "13", &rb_io, &rb_url, &encoding, &rb_options);
^
2 warnings generated.
compiling xml_relax_ng.c
compiling xml_sax_parser.c
compiling xml_sax_parser_context.c
compiling xml_sax_push_parser.c
compiling xml_schema.c
compiling xml_syntax_error.c
compiling xml_text.c
xml_text.c:18:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &string, &document, &rest);
^
1 warning generated.
compiling xml_xpath_context.c
xml_xpath_context.c:200:31: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
if(rb_scan_args(argc, argv, "11", &search_path, &xpath_handler) == 1)
^
1 warning generated.
compiling xslt_stylesheet.c
xslt_stylesheet.c:141:30: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "11", &xmldoc, &paramobj);
^
xslt_stylesheet.c:112:13: warning: unused function 'swallow_superfluous_xml_errors' [-Wunused-function]
static void swallow_superfluous_xml_errors(void * userdata, xmlErrorPtr error, ...)
^
2 warnings generated.
linking shared-object nokogiri/nokogiri.bundle
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
Cleaning files only used during build.
rm -rf /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-apple-darwin17.7.0/ports
rm -rf /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ports
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" install
make: /usr/local/opt/coreutils/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.-.nokogiri.time] Error 1
make install failed, exit code 2
Gem files will remain installed in /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10 for inspection.
Results logged to /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/extensions/x86_64-darwin-17/2.6.0/nokogiri-1.10.10/gem_make.out
I have tried several of the fixes offered to others having issues installing nokogiri including:
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
and
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/libxml2/
which seem to fix the issue for most users. I have also looked through the docs on https://nokogiri.org/tutorials/installing_nokogiri.html regarding Mac installation to no avail. This issue needs to be resolved before I am able to install the rails gem as well.
Any help would be greatly appreciated. Thoughts?
Using Catalina 10.15.5
Thanks

I found a solution using homebrew on a google translated Japanese page:
https://qiita.com/takeru56/items/9dc2b2aec56aaed69740
Download and install homebrew:
https://docs.brew.sh/Installation
Then install coreutils:
$ brew install coreutils
==> Downloading https://homebrew.bintray.com/bottles/coreutils-8.32.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/67a4452d75a1882bd7fb977b384204edfa2758276d66290e595487922368e
######################################################################## 100.0%
==> Pouring coreutils-8.32.catalina.bottle.tar.gz
==> Caveats
Commands also provided by macOS have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
==> Summary
🍺 /usr/local/Cellar/coreutils/8.32: 476 files, 9.2MB
Then I successfully installed nokogiri:
$ gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.10
1 gem installed

Related

How can I resolve errors when installing the github-markdown gem?

When installing the github-markdown 0.6.9 gem, the following errors are raised:
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.
I was able to successfully install the github-markdown gem with the following flags:
gem install github-markdown -v '0.6.9' --source 'https://rubygems.org/' -- --with-cflags="-Wno-error=implicit-function-declaration"

puma gem and ssl errors while doing bundle install

I am running bundle install to gems but it is failing for some gems.
Currently, it's breaking for puma gem (An error occurred while installing puma (3.6.0), and Bundler cannot continue).
these are the logs for the same
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/pusingh/.rvm/gems/ruby-2.3.7#pm/extensions/x86_64-darwin-19/2.3.0/puma-3.6.0/mkmf.log
current directory: /Users/pusingh/.rvm/gems/ruby-2.3.7#pm/gems/puma-3.6.0/ext/puma_http11
make "DESTDIR=" clean
current directory: /Users/pusingh/.rvm/gems/ruby-2.3.7#pm/gems/puma-3.6.0/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
ext/puma_http11/http11_parser.rl:111:17: warning: comparison of integers of different signs: 'long' and 'unsigned long'
[-Wsign-compare]
assert(pe - p == len - off && "pointers aren't same distance");
~~~~~~ ^ ~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
^
ext/puma_http11/http11_parser.c:43:18: warning: unused variable 'puma_parser_en_main' [-Wunused-const-variable]
static const int puma_parser_en_main = 1;
^
2 warnings generated.
compiling io_buffer.c
compiling mini_ssl.c
mini_ssl.c:90:5: error: incomplete definition of type 'struct dh_st'
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
~~^
/usr/local/opt/openssl/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
mini_ssl.c:91:5: error: incomplete definition of type 'struct dh_st'
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
~~^
/usr/local/opt/openssl/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
mini_ssl.c:93:10: error: incomplete definition of type 'struct dh_st'
if ((dh->p == NULL) || (dh->g == NULL)) {
~~^
/usr/local/opt/openssl/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
mini_ssl.c:93:29: error: incomplete definition of type 'struct dh_st'
if ((dh->p == NULL) || (dh->g == NULL)) {
~~^
/usr/local/opt/openssl/include/openssl/ossl_typ.h:104:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
^
mini_ssl.c:197:27: warning: 'DTLSv1_method' is deprecated [-Wdeprecated-declarations]
conn->ctx = SSL_CTX_new(DTLSv1_method());
^
/usr/local/opt/openssl/include/openssl/ssl.h:1895:1: note: 'DTLSv1_method' has been explicitly marked deprecated here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
^
/usr/local/opt/openssl/include/openssl/opensslconf.h:155:34: note: expanded from macro 'DEPRECATEDIN_1_1_0'
# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
^
/usr/local/opt/openssl/include/openssl/opensslconf.h:118:55: note: expanded from macro 'DECLARE_DEPRECATED'
# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
^
mini_ssl.c:233:20: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
int verify_err = SSL_get_verify_result(ssl);
~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
mini_ssl.c:246:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
err = ERR_get_error();
~ ^~~~~~~~~~~~~~~
3 warnings and 4 errors generated.
make: *** [mini_ssl.o] Error 1
make failed, exit code 2
I am using ruby 2.3.7 with catalina mac os 10.15.5 Please help

ZeroMQ gem fails to install on macOS Catalina

I am trying to install and use zeroMQ gem on macOS 10.15.3. But I get a build error, see last code fragment.
I install using bundle like so: bundle install --path vendor/bundle and my Gemfile like this:
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "sinatra"
gem "pg"
gem "zmq"
But the gem install of zeroMQ fails.
What I find weird is that both raw C zeroMQ, cppzmq, and I could install zeroMQ for python using PIP without any problems. zeroMQ is installed using Homebrew.
Any insights is appriciated.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/larsnielsen/git/au/alexandria-storage-node/vendor/bundle/ruby/2.6.0/gems/zmq-2.1.4
/Users/larsnielsen/.rbenv/versions/2.6.5/bin/ruby -I /Users/larsnielsen/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20200305-37449-pikzw8.rb extconf.rb
checking for zmq.h... yes
checking for zmq_init() in -lzmq... yes
Cool, I found your zmq install...
creating Makefile
current directory: /Users/larsnielsen/git/au/alexandria-storage-node/vendor/bundle/ruby/2.6.0/gems/zmq-2.1.4
make "DESTDIR=" clean
current directory: /Users/larsnielsen/git/au/alexandria-storage-node/vendor/bundle/ruby/2.6.0/gems/zmq-2.1.4
make "DESTDIR="
compiling rbzmq.c
rbzmq.c:105:12: warning: 'rb_data_object_alloc' is deprecated: by rb_data_object_wrap [-Wdeprecated-declarations]
return rb_data_object_alloc (class_, NULL, 0, context_free);
^
/Users/larsnielsen/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1437:1: note: 'rb_data_object_alloc' has been explicitly marked deprecated here
DEPRECATED_BY(rb_data_object_wrap, static inline VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
^
/Users/larsnielsen/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-darwin19/ruby/config.h:139:44: note: expanded from macro 'DEPRECATED_BY'
#define DEPRECATED_BY(n,x) __attribute__ ((__deprecated__("by "#n))) x
^
rbzmq.c:324:9: warning: implicit declaration of function 'rb_thread_blocking_region' is invalid in C99 [-Wimplicit-function-declaration]
rb_thread_blocking_region (zmq_poll_blocking, (void*)&poll_args, NULL, NULL);
^
rbzmq.c:968:7: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
case ZMQ_RECOVERY_IVL_MSEC:
^
rbzmq.c:990:10: error: use of undeclared identifier 'ZMQ_HWM'
case ZMQ_HWM:
^
rbzmq.c:991:10: error: use of undeclared identifier 'ZMQ_SWAP'
case ZMQ_SWAP:
^
rbzmq.c:995:10: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
case ZMQ_MCAST_LOOP:
^
rbzmq.c:1292:10: error: use of undeclared identifier 'ZMQ_HWM'
case ZMQ_HWM:
^
rbzmq.c:1293:10: error: use of undeclared identifier 'ZMQ_SWAP'
case ZMQ_SWAP:
^
rbzmq.c:1297:10: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
case ZMQ_MCAST_LOOP:
^
rbzmq.c:1315:10: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
case ZMQ_RECOVERY_IVL_MSEC:
^
rbzmq.c:1443:81: error: too few arguments to function call, expected 4, have 3
send_args->rc = zmq_send(send_args->socket, send_args->msg, send_args->flags);
~~~~~~~~ ^
/usr/local/include/zmq.h:489:1: note: 'zmq_send' declared here
ZMQ_EXPORT int zmq_send (void *s_, const void *buf_, size_t len_, int flags_);
^
/usr/local/include/zmq.h:90:20: note: expanded from macro 'ZMQ_EXPORT'
#define ZMQ_EXPORT __attribute__ ((visibility ("default")))
^
rbzmq.c:1512:9: warning: implicit declaration of function 'rb_thread_blocking_region' is invalid in C99 [-Wimplicit-function-declaration]
rb_thread_blocking_region (zmq_send_blocking, (void*) &send_args, NULL, NULL);
^
rbzmq.c:1517:38: error: too few arguments to function call, expected 4, have 3
rc = zmq_send (s, &msg, flags);
~~~~~~~~ ^
/usr/local/include/zmq.h:489:1: note: 'zmq_send' declared here
ZMQ_EXPORT int zmq_send (void *s_, const void *buf_, size_t len_, int flags_);
^
/usr/local/include/zmq.h:90:20: note: expanded from macro 'ZMQ_EXPORT'
#define ZMQ_EXPORT __attribute__ ((visibility ("default")))
^
rbzmq.c:1541:81: error: too few arguments to function call, expected 4, have 3
recv_args->rc = zmq_recv(recv_args->socket, recv_args->msg, recv_args->flags);
~~~~~~~~ ^
/usr/local/include/zmq.h:492:1: note: 'zmq_recv' declared here
ZMQ_EXPORT int zmq_recv (void *s_, void *buf_, size_t len_, int flags_);
^
/usr/local/include/zmq.h:90:20: note: expanded from macro 'ZMQ_EXPORT'
#define ZMQ_EXPORT __attribute__ ((visibility ("default")))
^
rbzmq.c:1596:9: warning: implicit declaration of function 'rb_thread_blocking_region' is invalid in C99 [-Wimplicit-function-declaration]
rb_thread_blocking_region (zmq_recv_blocking, (void*) &recv_args,
^
rbzmq.c:1602:38: error: too few arguments to function call, expected 4, have 3
rc = zmq_recv (s, &msg, flags);
~~~~~~~~ ^
/usr/local/include/zmq.h:492:1: note: 'zmq_recv' declared here
ZMQ_EXPORT int zmq_recv (void *s_, void *buf_, size_t len_, int flags_);
^
/usr/local/include/zmq.h:90:20: note: expanded from macro 'ZMQ_EXPORT'
#define ZMQ_EXPORT __attribute__ ((visibility ("default")))
^
rbzmq.c:1675:50: error: use of undeclared identifier 'ZMQ_HWM'
rb_define_const (zmq_module, "HWM", INT2NUM (ZMQ_HWM));
^
rbzmq.c:1676:51: error: use of undeclared identifier 'ZMQ_SWAP'
rb_define_const (zmq_module, "SWAP", INT2NUM (ZMQ_SWAP));
^
rbzmq.c:1683:57: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
rb_define_const (zmq_module, "MCAST_LOOP", INT2NUM (ZMQ_MCAST_LOOP));
^
rbzmq.c:1698:64: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
rb_define_const (zmq_module, "RECOVERY_IVL_MSEC", INT2NUM (ZMQ_RECOVERY_IVL_MSEC));
^
4 warnings and 16 errors generated.
make: *** [rbzmq.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/larsnielsen/git/au/alexandria-storage-node/vendor/bundle/ruby/2.6.0/gems/zmq-2.1.4 for inspection.
Results logged to /Users/larsnielsen/git/au/alexandria-storage-node/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-19/2.6.0-static/zmq-2.1.4/gem_make.out
An error occurred while installing zmq (2.1.4), and Bundler cannot continue.
Make sure that `gem install zmq -v '2.1.4' --source 'https://rubygems.org/'` succeeds before bundling.
The zmq gem is very old: https://rubygems.org/gems/zmq - last update was performed in 2010. There are numerous known compatibility problems, see for example: https://github.com/zeromq/rbzmq/issues/32.
I would recommend you use gem rbczmq instead: https://github.com/methodmissing/rbczmq
I had no problem getting ffi-rzmq running.
https://github.com/chuckremes/ffi-rzmq
gem install ffi-rzmq

Swoole make failed ubuntu16.04

I am trying to install SWOOLE on my Ubuntu-16.04
I tried this sudo pecl install swoole
But am getting a long list of errors(Skipped some lines)
In file included from /tmp/pear/temp/swoole/php_swoole.h:156:0,
from /tmp/pear/temp/swoole/swoole.c:16:
/tmp/pear/temp/swoole/php7_wrapper.h: In function 'sw_zend_is_callable':
/tmp/pear/temp/swoole/php7_wrapper.h:238:5: error: unknown type name 'zend_string'
zend_string *key = NULL;
^
/tmp/pear/temp/swoole/php7_wrapper.h:239:5: warning: passing argument 3 of 'zend_is_callable' from incompatible pointer type [enabled by default]
int ret = zend_is_callable(cb, a, &key);
^
In file included from /usr/include/php5/main/php.h:39:0,
from /tmp/pear/temp/swoole/php_swoole.h:25,
from /tmp/pear/temp/swoole/swoole.c:16:
/usr/include/php5/Zend/zend_API.h:301:20: note: expected 'char **' but argument is of type 'int **'
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC);
^
In file included from /usr/include/php5/Zend/zend.h:252:0,
from /usr/include/php5/main/php.h:35,
from /tmp/pear/temp/swoole/php_swoole.h:25,
from /tmp/pear/temp/swoole/swoole.c:16:
/tmp/pear/temp/swoole/php7_wrapper.h:240:29: error: request for member 'val' in something not a structure or union
char *tmp = estrndup(key->val, key->len);
^
/usr/include/php5/Zend/zend_alloc.h:78:44: note: in definition of macro 'estrndup'
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
^
/tmp/pear/temp/swoole/php7_wrapper.h:240:39: error: request for member 'len' in something not a structure or union
char *tmp = estrndup(key->val, key->len);
^
/usr/include/php5/Zend/zend_alloc.h:78:49: note: in definition of macro 'estrndup'
#define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
^
In file included from /tmp/pear/temp/swoole/php_swoole.h:156:0,
from /tmp/pear/temp/swoole/swoole.c:16:
/tmp/pear/temp/swoole/php7_wrapper.h: In function 'sw_zend_is_callable_ex':
/tmp/pear/temp/swoole/php7_wrapper.h:248:5: error: unknown type name 'zend_string'
zend_string *key = NULL;
^
/tmp/pear/temp/swoole/php7_wrapper.h:249:5: warning: passing argument 4 of 'zend_is_callable_ex' from incompatible pointer type [enabled by default]
int ret = zend_is_callable_ex(callable, NULL, check_flags, &key, fcc, error);
make: *** [swoole.lo] Error 1
ERROR: `make' failed
I have also tried this
cd swoole-src
./configure
make
Which is also giving the similar errors.
How to solve this? thanks in advance!
EDIT : Added the first Generated ERRORS too

Multiple errors when compiling wxWidgets with gcc 4.8.1

I've been trying for a while now compile wxWidgets library for Code::Blocks and I am still getting a lot of different errors.
My gcc verions is: gcc (tdm-2) 4.8.1 and I want to build newest wxWidgets: 3.1.0. I've tried 3 different sources and each time I have some error (sometimes this same, sometimes different). I am working on Windows 8.1.
[1]mingw32-make -f makefile.gcc UNICODE=1 MONOLITHIC=1 SHARED=1 BUILD=debug CXXFLAGS="-std=gnu++11"
and the error output:
../../src/common/wxcrt.cpp: In function 'int wxVsprintf(wchar_t*, const wxString
&, va_list)':
../../src/common/wxcrt.cpp:623:47: error: invalid conversion from 'const wchar_t
*' to 'size_t {aka unsigned int}' [-fpermissive]
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:623:56: error: cannot convert 'va_list {aka char*}' t
o 'const wchar_t*' for argument '3' to 'int vswprintf(wchar_t*, size_t, const wc
har_t*, char*)'
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:632:1: warning: control reaches end of non-void funct
ion [-Wreturn-type]
}
^
makefile.gcc:6786: recipe for target 'gcc_mswuddll\monodll_wxcrt.o' failed
mingw32-make: *** [gcc_mswuddll\monodll_wxcrt.o] Error 1
[2]mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=debug and the error output:
../../src/common/wxcrt.cpp: In function 'int wxVsprintf(wchar_t*, const wxString
&, va_list)':
../../src/common/wxcrt.cpp:623:47: error: invalid conversion from 'const wchar_t
*' to 'size_t {aka unsigned int}' [-fpermissive]
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:623:56: error: cannot convert 'va_list {aka char*}' t
o 'const wchar_t*' for argument '3' to 'int vswprintf(wchar_t*, size_t, const wc
har_t*, char*)'
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:632:1: warning: control reaches end of non-void funct
ion [-Wreturn-type]
}
^
makefile.gcc:11860: recipe for target 'gcc_mswuddll\basedll_wxcrt.o' failed
mingw32-make: *** [gcc_mswuddll\basedll_wxcrt.o] Error 1
[3]mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport"1 and the error:
../../src/common/wxcrt.cpp: In function 'int wxVsprintf(wchar_t*, const wxString
&, va_list)':
../../src/common/wxcrt.cpp:623:47: error: invalid conversion from 'const wchar_t
*' to 'size_t {aka unsigned int}' [-fpermissive]
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:623:56: error: cannot convert 'va_list {aka char*}' t
o 'const wchar_t*' for argument '3' to 'int vswprintf(wchar_t*, size_t, const wc
har_t*, char*)'
return wxCRT_VsprintfW(str, format.wc_str(), argptr);
^
../../src/common/wxcrt.cpp:632:1: warning: control reaches end of non-void funct
ion [-Wreturn-type]
}
^
makefile.gcc:6786: recipe for target 'gcc_mswudll\monodll_wxcrt.o' failed
mingw32-make: *** [gcc_mswudll\monodll_wxcrt.o] Error 1
Can someone please advice me what more I can do?
I'm not sure why are you speaking about multiple errors, this is clearly one and the same error and is due to using standard-like vswprintf() instead of the function from MSVC CRT which is normally used by MinGW by default. The former should only be used when __USE_MINGW_ANSI_STDIO is in effect and it's very strange that you still get it without it, I wonder if you have CPPFLAGS or similar set in your environment?
Anyhow, I'd recommend using TDM-GCC 4.9 as 3.1.0 definitely compiles with it (this is what the official binaries have been built with). 4.8 is supposed to work too, of course, so it could be worth checking how is __USE_MINGW_ANSI_STDIO getting defined, but installing 4.9 will probably be simpler for you.

Resources