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

bundle exec rake compile gets `error: incompatible function pointer types #213

Closed
yahonda opened this issue Mar 11, 2024 · 6 comments
Closed

Comments

@yahonda
Copy link

yahonda commented Mar 11, 2024

bundle exec rake compile gets `error: incompatible function pointer types.

Steps to reproduce

git clone https://github.com/xml4r/libxml-ruby
cd libxml-ruby
bundle install
bundle exec rake compile

Expected behavior

It should build libxml-ruby

Actual behavior

It gets ../../../../ext/libxml/ruby_xml_error.c:123:35: error: incompatible function pointer types passing 'void (void *, const xmlError *)' (aka 'void (void *, const struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, struct _xmlError *)') [-Wincompatible-function-pointer-types]

% bundle exec rake compile
mkdir -p tmp/x86_64-darwin23/libxml_ruby/3.3.0
cd tmp/x86_64-darwin23/libxml_ruby/3.3.0
/Users/yahonda/.rbenv/versions/3.3.0/bin/ruby -I. ../../../../ext/libxml/extconf.rb --with-xml2-include=/usr/include/libxml2
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/opt/homebrew/opt/libxml2/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2,/usr/local/include,/usr/local/opt/libxml2/include/libxml2... yes
checking for xmlParseDoc() in -lxml2... yes
creating extconf.h
creating Makefile
cd -
cd tmp/x86_64-darwin23/libxml_ruby/3.3.0
/usr/bin/make
compiling ../../../../ext/libxml/libxml.c
compiling ../../../../ext/libxml/ruby_xml.c
compiling ../../../../ext/libxml/ruby_xml_attr.c
compiling ../../../../ext/libxml/ruby_xml_attr_decl.c
compiling ../../../../ext/libxml/ruby_xml_attributes.c
compiling ../../../../ext/libxml/ruby_xml_cbg.c
compiling ../../../../ext/libxml/ruby_xml_document.c
compiling ../../../../ext/libxml/ruby_xml_dtd.c
compiling ../../../../ext/libxml/ruby_xml_encoding.c
compiling ../../../../ext/libxml/ruby_xml_error.c
../../../../ext/libxml/ruby_xml_error.c:123:35: error: incompatible function pointer types passing 'void (void *, const xmlError *)' (aka 'void (void *, const struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, struct _xmlError *)') [-Wincompatible-function-pointer-types]
  xmlSetStructuredErrorFunc(NULL, structuredErrorFunc);
                                  ^~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml/xmlerror.h:870:29: note: passing argument to parameter 'handler' here
                                 xmlStructuredErrorFunc handler);
                                                        ^
1 error generated.
make: *** [ruby_xml_error.o] Error 1
rake aborted!
Command failed with status (2): [/usr/bin/make]
/Users/yahonda/.rbenv/versions/3.3.0/bin/bundle:25:in `load'
/Users/yahonda/.rbenv/versions/3.3.0/bin/bundle:25:in `<main>'
Tasks: TOP => compile => compile:x86_64-darwin23 => compile:libxml_ruby:x86_64-darwin23 => copy:libxml_ruby:x86_64-darwin23:3.3.0 => tmp/x86_64-darwin23/libxml_ruby/3.3.0/libxml_ruby.bundle
(See full trace by running task with --trace)
%

Environment

% ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]

% sw_vers
ProductName:        macOS
ProductVersion:     14.4
BuildVersion:       23E214
% xcodebuild -version
Xcode 15.3
Build version 15E204a
% brew info libxml2                                                                                                                                                                                                   master
==> libxml2: stable 2.12.5 (bottled), HEAD [keg-only]
GNOME XML library
http://xmlsoft.org/
/usr/local/Cellar/libxml2/2.12.5_1 (204 files, 6.2MB)
  Poured from bottle using the formulae.brew.sh API on 2024-02-26 at 21:04:08
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/lib/libxml2.rb
License: MIT
==> Dependencies
Build: python-setuptools ✔, [email protected] ✔, [email protected] ✘
Required: icu4c ✔, readline ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libxml2 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc

For compilers to find libxml2 you may need to set:
  export LDFLAGS="-L/usr/local/opt/libxml2/lib"
  export CPPFLAGS="-I/usr/local/opt/libxml2/include"

For pkg-config to find libxml2 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
==> Analytics
install: 55,215 (30 days), 145,337 (90 days), 519,439 (365 days)
install-on-request: 19,307 (30 days), 48,113 (90 days), 177,149 (365 days)
build-error: 2 (30 days)
%
@yahonda yahonda changed the title bundle exec rake compile gets error: incompatible function pointer types passing 'void (void *, const xmlError *)' (aka 'void (void *, const struct _xmlError *)') to parameter of type 'xmlStructuredErrorFunc' (aka 'void (*)(void *, struct _xmlError *)') [-Wincompatible-function-pointer-types] bundle exec rake compile gets `error: incompatible function pointer types Mar 11, 2024
@yahonda
Copy link
Author

yahonda commented Mar 11, 2024

I've found https://bugs.freebsd.org/bugzilla/attachment.cgi?id=248824&action=diff addresses this issue for macOS also.

@cfis
Copy link
Member

cfis commented Mar 11, 2024

Hmm, did libxml change this definition?

https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlerror.html#xmlStructuredErrorFunc

void xmlStructuredErrorFunc(void * userData,  const xmlError * error)

@yahonda
Copy link
Author

yahonda commented Mar 11, 2024

@cfis
Copy link
Member

cfis commented Mar 11, 2024

I see. Do you have time to create a PR?

@yahonda
Copy link
Author

yahonda commented Mar 11, 2024

Sure.

@yahonda
Copy link
Author

yahonda commented Mar 12, 2024

Opened #214

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

Successfully merging a pull request may close this issue.

2 participants