Nakilon / dhash-vips

vips-powered ruby gem to measure images similarity, implementing dHash and IDHash algorithms
MIT License
88 stars 14 forks source link

Issue installing v0.1.1.4 #15

Closed renatolond closed 2 years ago

renatolond commented 2 years ago

Hello :) We started having some issue on our CI after the new version was pushed but I can't track it down the issue, it seems to be happening on ruby 2.7.x and 3.0.x

I tried locally on my machine and I have the same error:

Fetching dhash-vips-0.1.1.4.gem
Building native extensions. This could take a while...
ERROR:  Error installing dhash-vips:
        ERROR: Failed to build gem native extension.

    current directory: /home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/lib/ruby/gems/2.7.0/gems/dhash-vips-0.1.1.4
/home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/bin/ruby -I /home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/lib/ruby/2.7.0 -r ./siteconf20220221-38934-8qm4nf.rb extconf.rb
checking for whether -I/ruby/ is accepted as CPPFLAGS... yes
checking for whether -DRUBY_EXPORT is accepted as CPPFLAGS... yes
creating Makefile

current directory: /home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/lib/ruby/gems/2.7.0/gems/dhash-vips-0.1.1.4
make "DESTDIR=" clean

current directory: /home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/lib/ruby/gems/2.7.0/gems/dhash-vips-0.1.1.4
make "DESTDIR="
compiling idhash.c
idhash.c:1:10: fatal error: bignum.c: No such file or directory
    1 | #include <bignum.c>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:258: idhash.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/lib/ruby/gems/2.7.0/gems/dhash-vips-0.1.1.4 for inspection.
Results logged to /home/renatolond/.rvm/rubies/ruby-2.7.2-jemalloc/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/dhash-vips-0.1.1.4/gem_make.out

I checked the diff and I can't understand what is causing it, since there seems no change was made in that file since 0.1.1.3 :thinking:

For more info: I'm running on Linux (the CI is too)

renatolond commented 2 years ago

Looking a bit more, I think it's related to the changes in extconf.rb https://github.com/Nakilon/dhash-vips/compare/v0.1.1.3...v0.1.1.4#diff-be607ec90d581a01cb382d92cf9b14c2e4618e986651d360518b4a9fb2abb7cd If I remove those lines it seems to compile:

    append_cppflags "-DRUBY_EXPORT" unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.4")
    create_makefile "idhash"
    # Why this hack?
    # 1. Because I want to use Ruby and ./idhash.bundle for tests, not C.
    # 2. Because I don't want to bother users with two gems instead of one.
    File.write "Makefile", <<~HEREDOC + File.read("Makefile")
      .PHONY: test
      test: all
      \t$(RUBY) -r./lib/dhash-vips.rb ./lib/dhash-vips-post-install-test.rb
    HEREDOC

From what I understand, before it did not get there due to the if on L8

Nakilon commented 2 years ago

Crap... yeah only after I've pushed the accepted pull request I've realised there were more commits hanging on HEAD. I don't really understand the urge to just bump the gem versions, c'mon, you have own Gemfiles... The hanging commits were not fully tested because I put the gem development on hold due to the absolute lack of response on why native extension started compiling with errors on Alpine Linux after 2.3

Also I have no idea why Github never sends an email that the ticket in my repo is created.

Nakilon commented 2 years ago

Anyway, I guess I fixed it now. @renatolond can you please check if 0.1.1.5 works for you?

renatolond commented 2 years ago

Seems to build fine, thanks for looking into it so promptly :)