Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling native extension on Intel Mac #201

Closed
queue-tip opened this issue May 1, 2023 · 2 comments
Closed

Error compiling native extension on Intel Mac #201

queue-tip opened this issue May 1, 2023 · 2 comments

Comments

@queue-tip
Copy link

@cfis after you addressed #200 you asked if I could compile against the master branch from GitHub. It definitely got further along with your most recent fix but is still having issues.

The next one is with ruby_xml_html_parser_context.c. I would be happy to keep checking against master before you release again.

From my Gemfile:
gem "libxml-ruby", :github => 'xml4r/libxml-ruby', :branch => 'master'

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

    current directory: /Users/user1/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/bundler/gems/libxml-ruby-02305a71ecf3/ext/libxml
/Users/user1/.asdf/installs/ruby/3.0.2/bin/ruby -I /Users/user1/.asdf/installs/ruby/3.0.2/lib/ruby/3.0.0 -r ./siteconf20230501-91990-6kqydd.rb
extconf.rb --with-xml2-config\=/usr/local/Cellar/libxml2/2.10.4//bin/xml2-config
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2,/usr/local/include... yes
checking for xmlParseDoc() in -lxml2... yes
creating extconf.h
creating Makefile

current directory: /Users/user1/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/bundler/gems/libxml-ruby-02305a71ecf3/ext/libxml
make DESTDIR\= clean

current directory: /Users/user1/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/bundler/gems/libxml-ruby-02305a71ecf3/ext/libxml
make DESTDIR\=
compiling libxml.c
compiling ruby_xml.c
compiling ruby_xml_attr.c
compiling ruby_xml_attr_decl.c
compiling ruby_xml_attributes.c
compiling ruby_xml_cbg.c
compiling ruby_xml_document.c
compiling ruby_xml_dtd.c
compiling ruby_xml_encoding.c
compiling ruby_xml_error.c
compiling ruby_xml_html_parser.c
compiling ruby_xml_html_parser_context.c
ruby_xml_html_parser_context.c:246:3: warning: 'htmlDefaultSAXHandlerInit' is deprecated [-Wdeprecated-declarations]
  htmlDefaultSAXHandlerInit();
  ^
/usr/local/Cellar/libxml2/2.10.4/include/libxml2/libxml/SAX2.h:162:1: note: 'htmlDefaultSAXHandlerInit' has been explicitly marked deprecated here
XML_DEPRECATED
^
/usr/local/Cellar/libxml2/2.10.4/include/libxml2/libxml/xmlversion.h:464:43: note: expanded from macro 'XML_DEPRECATED'
#    define XML_DEPRECATED __attribute__((deprecated))
                                          ^
1 warning generated.
compiling ruby_xml_html_parser_options.c
compiling ruby_xml_input_cbg.c
ruby_xml_input_cbg.c:185:3: error: incompatible function pointer types passing 'VALUE (void)' (aka 'unsigned long (void)') to parameter of type 'VALUE
(*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_singleton_method(cInputCallbacks, "register",
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/user1/.asdf/installs/ruby/3.0.2/include/ruby-3.0.0/ruby/internal/anyargs.h:307:143: note: expanded from macro 'rb_define_singleton_method'
#define rb_define_singleton_method(obj, mid, func, arity)   RBIMPL_ANYARGS_DISPATCH_rb_define_singleton_method((arity), (func))((obj), (mid), (func), (arity))
                                                                                                                                              ^~~~~~
/Users/user1/.asdf/installs/ruby/3.0.2/include/ruby-3.0.0/ruby/internal/anyargs.h:270:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_singleton_method, VALUE, const char *)
^
/Users/user1/.asdf/installs/ruby/3.0.2/include/ruby-3.0.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
                                                                       ^
1 error generated.
make: *** [ruby_xml_input_cbg.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/user1/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/bundler/gems/libxml-ruby-02305a71ecf3 for inspection.
Results logged to
/Users/user1/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/bundler/gems/extensions/x86_64-darwin-22/3.0.0/libxml-ruby-02305a71ecf3/gem_make.out

An error occurred while installing libxml-ruby (4.1.0), and Bundler cannot continue.

In Gemfile:
  libxml-ruby
@cfis cfis closed this as completed in 8c0f424 May 2, 2023
@cfis
Copy link
Member

cfis commented May 2, 2023

Yup - thanks. All warnings are now fixed except:

ruby_xml_html_parser_context.c:246:3: warning: ‘htmlDefaultSAXHandlerInit’ is deprecated [-Wdeprecated-declarations]
  246 |   htmlDefaultSAXHandlerInit();

@queue-tip
Copy link
Author

I verified the gem installs now. Thank you for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants