GithubHelp home page GithubHelp logo

Error loading library about tantiny HOT 8 CLOSED

dreikanter avatar dreikanter commented on July 2, 2024
Error loading library

from tantiny.

Comments (8)

baygeldin avatar baygeldin commented on July 2, 2024 1

Thanks @dreikanter! I've pushed a new release (3.2) with the fix. Would be great if you could check it too :)

from tantiny.

baygeldin avatar baygeldin commented on July 2, 2024 1

OK, so I had some time to dig in a little and I think I've found a way to fix this issue without sacrificing the ability to install the gem without Rust. I've pushed a new version (0.3.3) with the fix. I'll close the issue for now, but if you have any issues please let me know.

from tantiny.

baygeldin avatar baygeldin commented on July 2, 2024

Hi! Maybe there is an issue with the precompiled binary. Could you delete the tantiny.so file and build it again by running cargo rustc --release --lib -- -C link-args=-L/Users/alex/.asdf/installs/ruby/3.1.0/lib in the root directory of the gem and then cp target/release/libtantiny.so lib/tantiny.so?

from tantiny.

dreikanter avatar dreikanter commented on July 2, 2024

I've just tried, but cargo generated dylib file instead of so. I've copied and rename it, but this didn't help. Same error so far. (Sorry, I have no experience with Rust.)

cd ~/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.1
cargo rustc --release --lib -- -C link-args=-L~/.asdf/installs/ruby/3.1.0/lib

ls -al target/release/ | grep tantiny
-rw-r--r--    1 alex  staff      564 Apr 18 21:59 libtantiny.d
-rwxr-xr-x    1 alex  staff  3706829 Apr 19 12:32 libtantiny.dylib

cp target/release/libtantiny.dylib lib/tantiny.so

from tantiny.

baygeldin avatar baygeldin commented on July 2, 2024

Hmm, interesting 🤔 I'm on Linux, so I can't test it out myself, but could you change the contents of the lib/tantiny.rb file to the following code and see if it works this way?

# frozen_string_literal: true

require "ruby-next/language/setup"
RubyNext::Language.setup_gem_load_path

require "rutie"
require "concurrent"
require "fileutils"

require "tantiny/version"
require "tantiny/errors"
require "tantiny/helpers"
require "tantiny/schema"
require "tantiny/tokenizer"
require "tantiny/query"
require "tantiny/index"

require 'rutie'

module Tantiny
  Rutie.new(:tantiny).init 'Init_tantiny', __dir__
end

from tantiny.

dreikanter avatar dreikanter commented on July 2, 2024

I've just checked, and it works now :)

from tantiny.

dreikanter avatar dreikanter commented on July 2, 2024

@baygeldin Hi! Sorry, but I encountered the same issue after upgrading to 0.3.2:

$ gem install tantiny

Fetching tantiny-0.3.2.gem
Building native extensions. This could take a while...
Successfully installed tantiny-0.3.2
Parsing documentation for tantiny-0.3.2
Installing ri documentation for tantiny-0.3.2
Done installing documentation for tantiny after 0 seconds
1 gem installed

$ ruby -e "require 'tantiny'"

/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/fiddle.rb:61:in `initialize': dlopen(/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.dylib, 0x0009): tried: '/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.dylib' (no such file), '/usr/local/lib/tantiny.dylib' (no such file), '/usr/lib/tantiny.dylib' (no such file) (Fiddle::DLError)
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/fiddle.rb:61:in `new'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/fiddle.rb:61:in `dlopen'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/rutie-0.0.4/lib/rutie.rb:21:in `init'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.rb:19:in `<module:Tantiny>'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.rb:18:in `<top (required)>'
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from -e:1:in `<main>'
<internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- tantiny (LoadError)
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from -e:1:in `<main>'
ruby -e "require 'tantiny'"
/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/fiddle.rb:61:in `initialize': dlopen(/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.dylib, 0x0009): tried: '/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.dylib' (no such file), '/usr/local/lib/tantiny.dylib' (no such file), '/usr/lib/tantiny.dylib' (no such file) (Fiddle::DLError)
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/fiddle.rb:61:in `new'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0/fiddle.rb:61:in `dlopen'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/rutie-0.0.4/lib/rutie.rb:21:in `init'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.rb:19:in `<module:Tantiny>'
	from /Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/tantiny-0.3.2/lib/tantiny.rb:18:in `<top (required)>'
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from -e:1:in `<main>'
<internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- tantiny (LoadError)
	from <internal:/Users/alex/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from -e:1:in `<main>'

Replacing Rutie.new(:tantiny, lib_path: __dir__, lib_prefix: "").init("Init_tantiny", __dir__) with Rutie.new(:tantiny).init 'Init_tantiny', __dir__ in the lib/tantiny.rb fixes the problem.

from tantiny.

baygeldin avatar baygeldin commented on July 2, 2024

I see, thanks. There seems to be an issue with how Thermite (https://github.com/malept/thermite) precompiles binaries for macOS. I think I'll have to disable this feature for Macs for now, at least until I get my hands on one and get a chance to come up with a workaround.

from tantiny.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.