segabor / Hunspell

Ruby wrapper for the famous spell checker library hunspell.
GNU Lesser General Public License v3.0
35 stars 11 forks source link

Can't 'gem install hunspell' ruby 2.7.2 #12

Closed RFrancois6 closed 1 year ago

RFrancois6 commented 1 year ago

Hi, I have an error in my hunspell install and I can't fix the problem with documentation or other github issues.

Error log :

Building native extensions. This could take a while...
ERROR:  Error installing hunspell:
    ERROR: Failed to build gem native extension.

    current directory: .rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/hunspell-1.1.0
.rbenv/versions/2.7.2/bin/ruby -I .rbenv/versions/2.7.2/lib/ruby/2.7.0 -r ./siteconf20230823-34145-7c4mps.rb extconf.rb
checking for Hunspell_create() in -lhunspell-1.7... no
checking for Hunspell_create() in -lhunspell-1.6... no
checking for Hunspell_create() in -lhunspell-1.5... no
checking for Hunspell_create() in -lhunspell-1.4... no
checking for Hunspell_create() in -lhunspell-1.3... no
Missing hunspell library
Supported versions: hunspell-1.7 hunspell-1.6 hunspell-1.5 hunspell-1.4 hunspell-1.3
*** 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
    --without-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=.rbenv/versions/2.7.2/bin/$(RUBY_BASE_NAME)
    --with-hunspell-1.7-dir
    --without-hunspell-1.7-dir
    --with-hunspell-1.7-include
    --without-hunspell-1.7-include=${hunspell-1.7-dir}/include
    --with-hunspell-1.7-lib
    --without-hunspell-1.7-lib=${hunspell-1.7-dir}/lib
    --with-hunspell-1.6-dir
    --without-hunspell-1.6-dir
    --with-hunspell-1.6-include
    --without-hunspell-1.6-include=${hunspell-1.6-dir}/include
    --with-hunspell-1.6-lib
    --without-hunspell-1.6-lib=${hunspell-1.6-dir}/lib
    --with-hunspell-1.5-dir
    --without-hunspell-1.5-dir
    --with-hunspell-1.5-include
    --without-hunspell-1.5-include=${hunspell-1.5-dir}/include
    --with-hunspell-1.5-lib
    --without-hunspell-1.5-lib=${hunspell-1.5-dir}/lib
    --with-hunspell-1.4-dir
    --without-hunspell-1.4-dir
    --with-hunspell-1.4-include
    --without-hunspell-1.4-include=${hunspell-1.4-dir}/include
    --with-hunspell-1.4-lib
    --without-hunspell-1.4-lib=${hunspell-1.4-dir}/lib
    --with-hunspell-1.3-dir
    --without-hunspell-1.3-dir
    --with-hunspell-1.3-include
    --without-hunspell-1.3-include=${hunspell-1.3-dir}/include
    --with-hunspell-1.3-lib
    --without-hunspell-1.3-lib=${hunspell-1.3-dir}/lib
    --with-hunspell-1.7lib
    --without-hunspell-1.7lib
    --with-hunspell-1.6lib
    --without-hunspell-1.6lib
    --with-hunspell-1.5lib
    --without-hunspell-1.5lib
    --with-hunspell-1.4lib
    --without-hunspell-1.4lib
    --with-hunspell-1.3lib
    --without-hunspell-1.3lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

I'm currently on OSX Ventura 13, ruby version 2.7.2, hunspell lib 1.7.2 Trying to install gem hunspell 1.1.0

If you have an idea on how to fix it, it will be greatly appreciated.

Found the solution : You need to specify path like sudo gem install hunspell -- --with-opt-dir=/opt/homebrew/opt/hunspell

segabor commented 1 year ago

Hey @RFrancois6 , thanks for reporting this. I'll amend the README with this extra info.