I am trying to install an older version of nokogiri (1.6.8.1) on a x86 intel mac using sonova 14.4 with a ruby project of mine but i am experiencing a problem with either bundle install or gem install nokogiri
xml_document.c:46:25: error: incompatible function pointer types passing 'int (xmlNodePtr, xmlNodePtr, xmlDocPtr)' (aka 'int (struct _xmlNode *, struct _xmlNode *,
struct _xmlDoc *)') to parameter of type 'st_foreach_callback_func *' (aka 'int (*)(unsigned long, unsigned long, unsigned long)')
[-Wincompatible-function-pointer-types]
st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
^~~~~~~~~~~~~~
/Users/username/.rvm/rubies/ruby-2.7.8/include/ruby-2.7.0/ruby/st.h:141:57: note: passing argument to parameter here
int rb_st_foreach(st_table *, st_foreach_callback_func *, st_data_t);
^
Common fixes like using system libraries (like libxml2-dev and libxslt1-dev), installing and updating xcode command line permissions have been tried and failed. I have also attempted using
gem install nokogiri -v '1.6.8.1' -- --with-cflags="-Wno-incompatible-function-pointer-types"
but to no avail.
This error is also encountered on a m2 macbook (running on sonova too). I believe it is a problem with xcode compiling the c files in the gem.
For more details, the project is running on ruby 2.7.8. With my own trial and error, I could only install nokogiri versions 1.11 and above, but I need to use version1.6 for this project
Any help or pointers that could lead to fixing this issue would be appreciated! 🙂
2
Answers
I just had this issue, and running
brew install llvm@15
solved it for me. Hope that helpsI had the same problem and then succeeded by installing libxslt and libxml2 via bundler and then supplied all of the parameters together: