1

i have been going round in circles , im trying to install charlock holmes 0.7.6 on a windows 10 pc , i have ubuntu installed and everything else seams to be fine . i would have to say , i am very new at this :-( i need it to run in the cmd rather than the linux prompt . i have tried varous published fixes with no luck . "gem install Charlock_holmes -v 0.7.6" gives me this result

C:\GSDev\grubstub>gem build charlock_holmes-0.7.6.gem
Invalid gemspec in [charlock_holmes-0.7.6.gem]: undefined local variable or method `metadata' for Gem::Specification:Class
ERROR:  Error loading gemspec. Aborting.
C:\GSDev\grubstub>gem install --local charlock_holmes-0.7.6.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing charlock_holmes-0.7.6.gem:
        ERROR: Failed to build gem native extension.
    current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
C:/Ruby24-x64/bin/ruby.exe -I C:/Ruby24-x64/lib/ruby/site_ruby/2.4.0 -r ./siteconf20220305-6628-1mj0usf.rb extconf.rb
checking for -licui18n... no
which: no brew in (/c/Ruby24-x64/bin:/mingw64/bin:/usr/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/dotnet:/c/Program Files/Git/cmd:/c/Ruby24-x64/bin:/c/Users/GStub/AppData/Local/Microsoft/WindowsApps:/c/Users/GStub/.dotnet/tools)
checking for -licui18n... no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** 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=C:/Ruby24-x64/bin/$(RUBY_BASE_NAME)
        --with-icu-dir
        --without-icu-dir
        --with-icu-include
        --without-icu-include=${icu-dir}/include
        --with-icu-lib
        --without-icu-lib=${icu-dir}/lib
        --with-icui18nlib
        --without-icui18nlib
        --with-icui18nlib
        --without-icui18nlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
  C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/charlock_holmes-0.7.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/charlock_holmes-0.7.6 for inspection.
Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/charlock_holmes-0.7.6/gem_make.out
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
Big Durbs
  • 11
  • 1

1 Answers1

0

First make sure the ICU libraries are installed:

ridk exec pacman -S mingw-w64-x86_64-icu icu-devel icu

Then you can install the gem with this:

gem install --local charlock_holmes-0.7.6.gem -- --with-icui18nlib=icuin --with-icudatalib=icudt

or get the latest version:

gem install charlock_holmes -- --with-icui18nlib=icuin --with-icudatalib=icudt

EDIT: You are using Ruby 2.4 which was released in 2016. That means that the MSYS64 installation bundled with RubyInstaller - which I assume you used - is quite outdated itself. (Some background: What do these RubyInstaller 2.4 components do?)

That's why you get errors regarding outdated certificates and outdated mirror lists.

Unfortunately there is no easy workaround, because in order to get fresh certificates you need to download a package, which doesn't work, because the current certificates are outdated...

You have several options here:

  1. Try to repair the MSYS with the workarounds found on the web (search for MSYS64 SSL certificate problem: certificate has expired error) (Potentially time consuming, Linux knowledge helps)
  2. Use a newer Ruby version from https://rubyinstaller.org/downloads/. Version 2.7 would be a conservative choice coming from Ruby 2.4. Version 3.0 and 3.1 have some breaking changes. (Best choice if you actually can use a newer Ruby)
  3. Re-Install MSYS64 (I previously did this after solution #1 didn't work for me), but don't just use the original Ruby installer. Instead download the current installer from https://www.msys2.org/ and install to the same directory as current. (Perhaps rename the original directory first to get a 100% clean installation)

    Then run ridk install to register the MSYS64 installation with Ruby.
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
  • hi Daniel , thank you for getting back to me , i got all excited to finally get this working , then i got this result :-( – Big Durbs Aug 21 '22 at 12:23
  • >ridk exec pacman -S mingw-w64-x86_64-icu icu-devel icu warning: icu-60.2-1 is up to date -- reinstalling resolving dependencies... looking for conflicting packages... Packages (3) icu-60.2-1 icu-devel-60.2-1 mingw-w64-x86_64-icu-61.1-1 Total Download Size: 25.61 MiB Total Installed Size: 140.94 MiB Net Upgrade Size: 111.35 MiB – Big Durbs Aug 21 '22 at 12:24
  • : The requested URL returned error: 404 error: failed retrieving file 'icu-devel-60.2-1-x86_64.pkg.tar.xz' from www2.futureware.at : The requested URL returned error: 404 error: failed retrieving file 'icu-devel-60.2-1-x86_64.pkg.tar.xz' from mirror.yandex.ru : The requested URL returned error: 404 warning: failed to retrieve some files error: failed to commit transaction (unexpected error) Errors occurred, no packages were upgraded. – Big Durbs Aug 21 '22 at 12:25
  • i have also tried in admin cmd prompt :-( , still no joy – Big Durbs Aug 21 '22 at 12:28
  • :: Proceed with installation? [Y/n] y :: Retrieving packages... error: failed retrieving file 'mingw-w64-x86_64-icu-61.1-1-any.pkg.tar.xz' from repo.msys2.org : SSL certificate problem: certificate has expired error: failed retrieving file 'mingw-w64-x86_64-icu-61.1-1-any.pkg.tar.xz' from sourceforge.net : The requested URL returned error: 404 error: failed retrieving file 'mingw-w64-x86_64-icu-61.1-1-any.pkg.tar.xz' from www2.futureware.at : The requested URL returned error: 404 error: failed retrieving file 'mingw-w64-x86_64-icu-61.1-1-any.pkg.tar.xz' from – Big Durbs Aug 21 '22 at 12:31
  • Yeah, these errors stem from an outdated MSYS64 installation. Added some pointers to the answer. – Daniel Rikowski Aug 22 '22 at 08:01