libgit2 / rugged

ruby bindings to libgit2
MIT License
2.25k stars 277 forks source link

rugged does not seem to work with TruffleRuby #966

Closed mtortonesi closed 1 year ago

mtortonesi commented 1 year ago

In my quest to get the bake-modernize gem working with TruffleRuby, I found out that rugged does not seem to work with TruffleRuby (version truffleruby+graalvm-23.0.0 installed from rbenv+ruby-build on an M1 MacBookPro):

myprompt > bundle exec ruby -e 'require "rugged"; Rugged::Repository.discover(".")'
/Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/util/hash/sha1dc/sha1.c:383:in `sha1_compression_states': missing LLVM builtin: llvm.fshl.v2i32 (Polyglot::ForeignException)
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/util/hash/sha1dc/sha1.c:1713:in `sha1_process'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/util/hash/sha1dc/sha1.c:1819:in `SHA1DCUpdate'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/util/hash/collisiondetect.c:32:in `git_hash_sha1_update'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/util/hash.c:98:in `git_hash_buf'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/config_file.c:864:in `config_file_read'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/config_file.c:101:in `config_file_open'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/config.c:310:in `git_config_add_backend'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/config.c:100:in `git_config_add_file_ondisk'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/repository.c:1190:in `load_config'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/repository.c:1258:in `git_repository_config__weakptr'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/repository.c:772:in `obtain_config_and_set_oid_type'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/repository.c:1046:in `git_repository_open_ext'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/vendor/libgit2/src/libgit2/repository.c:1126:in `git_repository_open'
    from /Users/mauro/code/test/truffleruby/reinforce/vendor/bundle/truffleruby/3.1.3.23.0.0/gems/rugged-1.6.3/ext/rugged/rugged_repo.c:1623:in `rb_git_repo_discover'
    from /Users/mauro/.rbenv/versions/truffleruby+graalvm-23.0.0/graalvm/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `'
    from /Users/mauro/.rbenv/versions/truffleruby+graalvm-23.0.0/graalvm/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `Rugged::Repository.discover'
    from -e:1:in `
'

Would like to help fixing the issue, but don't know where to start. Any suggestion?

CC @ioquatix and @eregon

eregon commented 1 year ago

Should be fixed with dev build as you found in https://github.com/oracle/truffleruby/issues/3208

mtortonesi commented 1 year ago

I can confirm. The latest version of TruffleRuby works perfectly.