How 'bout we just... 

...don't ever write things in .

I mean, whenever I try to install something written in Ruby, I run into problems I don't get with any other language.

The problem doesn't seem to be so much with the language itself as with the packaging system(s) that apparently everyone uses -- but the error messages are really unhelpful and leave me with no idea where to start.

The problem this time is some kind of undeclared function -- but searching the web for the function (so I could figure out what I need to install) just leads to other people trying to solve the same problem and never really getting to an understanding of what was causing it.

It also kind of feels like the people who do understand these things are almost proud of how tricky such problems are to fix and/or how little understanding they have of what the basic concepts are that one needs to understand in order to properly deal with such problems in the future.

Follow

To be fair, the last commenter in that thread did explain at least some of the problem.

In my case, it seems to be that I have ruby-mysql2 version 0.5.2 and for some reason it wants version 0.5.3. I don't know if that's what is causing the missing identifier, or if something is just barfing because it can't find the exact version it wants, or if I could just ignore that problem and move on now...

The Gemfile seems to think anything 0.5.x should be fine.

Just....why.

· · Web · 1 · 0 · 2

I got past one error by editing one of the system libraries, which is probably a Bad Solution, but... geez, guys, ever hear of graceful fallback?

I changed

path.split(...)

to

path&.split(...)

in /usr/lib/ruby/2.7.0/mkmf.rb, for the record.

On to gewgling the next syntax error...

Show thread

I seem to have gotten it to install by making the same change in about 4 places in 2 different files.

So now, whenever something automatically upgrades those libraries, everything will break again... and I'm not quite sure what installed them...

Can I submit a pull request? (Redmine uses subversion, but what does Ruby use?)

Show thread

Also, the install documentation is out of date:

$ bundle install --without development test rmagick
[DEPRECATED] The --without flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use bundle config set --local without 'development test rmagick', and stop using this flag

(...followed by the usual reminder not to run bundler as root even though it will probably need root privs at some point.)

Show thread

@woozle Sometimes I wonder if prior to ever release, we should take away the developers' machines and make them start over with fresh ones.

Just how many previously-unnoticed environmental assumptions would come to light?

@woozle bugs.ruby-lang.org/projects/ru looks like they prefer you to open a redmine ticket, which will forward it to the mailing list.

@FiXato It looks like submitting a pull-request would be appropriate for these very small fixes -- but I feel like I should actually get my instance working first, just to establish that they're not breaking something further down in the process.

So far so good with the testing process...

@woozle where did you change this btw? in the find_executable0 method, or the find_library one?

A safer way might be to override the method in the installer, and either fail early or ensure the path is a valid value.

justinweiss.com/articles/3-way

@FiXato

I ended up editing two different files:

  • /usr/lib/ruby/2.7.0/mkmf.rb
  • /usr/lib/x86_64-linux-gnu/ruby/2.7.0/rbconfig.rb

[insert and then delete a lot of rambling about trying to figure out where I made the changes]

Kate edit-history to the rescue!

  • mkmf.rb
    • 535 end % x&.quote
    • 1050 paths = paths.collect {|path| path&.split(File::PATH_SEPARATOR)}.flatten
  • rbconfig.rb
    • 288 newval = val&.gsub(/\$\$|\$(([]+))|\${([{}]+)}/) {

The monkey-patching advice seems good, but I have no idea how to do it just from his instructions.

(
As far as submitting patches:

I found mkmf.rb, but still no idea where rbconfig.rb is.

If I could find both of them, I could clone the repo, make the change in my clone, and do a diff to get which lines were changed (and possibly do a PR for the changes).
)

@woozle with the paths.collect one I am guessing that one of the paths is nil somehow, in which case it might also be worth removing it from the array with .compact, so paths.compact.collect, though I'm curious what would cause the path to be nil.

As far as rbconfig.rb goes, I believe that's created by mkconfig.rb:

# This script, which is run when ruby is built, generates rbconfig.rb by
4 # parsing information from config.status. rbconfig.rb contains build
5 # information for ruby (compiler flags, paths, etc.) and is used e.g. by
6 # mkmf to build compatible native extensions.

@FiXato So where would one patch mkconfig.rb so that the code it generates has that patch in it?

As yet, I have zero experience coding in Ruby, so this looks way above my spoons-level.

@woozle I would guess svn.ruby-lang.org/cgi-bin/view, though I also see svn.ruby-lang.org/cgi-bin/view

Though I have to admit that this is a bit beyond my comfort zone too :) I have no experience with native extensions in Ruby apart from making use of them. ;)

Sign in to participate in the conversation
Toot.Cat

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!