0

I'm trying to build the ruby-odbc gem from source to debug an issue. I can successfully compile odbc.so and odbc_utf8.so, but when I include the gem in my Gemfile via :path I get "incompatible library version". If I install the exact same gem via bundler or "gem install", it works perfectly fine.

I've compared the generate Makefile from both sources, and the only difference is that the "sitearchdir" and "sitelibdir" are slightly different:

Compiling myself:

sitearchdir = $(sitelibdir)/$(sitearch) 
sitelibdir = $(sitedir)/$(ruby_version)

Compiled by gem/bundler:

sitearchdir = $(DESTDIR)./.gem.20210204-9736-1i20v5m
sitelibdir = $(DESTDIR)./.gem.20210204-9736-1i20v5m

I'm building with ruby 2.6.5 and rbenv on Windows Linux Subsystem Ubuntu 18.04 via "rake compile", but I've also built it manually per the docs with the same result. I'm kind of guessing the fact that I'm in WLS that I need to somehow manually specify the architecture, which is possibly what bundler/"gem install" is doing?

EDIT: I've tried this same scenario in an Ubuntu 19.04 VM and get the same result, so it's not related to WLS after all.

EDIT: Running gem install ruby-odbc -V gives me more verbose output as to how the gem is being compiled, but I don't specifically see anything different than how I'm compiling it. I've also grabbed the Makefiles created as part of gem install ruby-odbc and copied them into my local version of the gem, and compiling with them gives me the same error, so maybe the slight change in the makefile also isn't the problem.

ioev
  • 78
  • 6
  • if you're in the project, do you have the `extconf.rb` file? does that file produce a good `Makefile` when you run it in `ruby`? Is there any chance you can include the error messages that you are getting during compile? – Jad Mar 16 '21 at 16:10
  • Actually I forgot to come back here and close this issue. Turns out I was compiling with a different version of ruby... so this SHOULD have really easy to solve but the "is not compatible" error message is just too vague. – ioev Mar 24 '21 at 19:53

1 Answers1

0

It turns out I was using a different version of ruby. I use rbenv and had added a .ruby-version file to the project with what I thought was the version being used in the project I was compiling it to, but I guess I must have gotten the version from one of the other projects I had open.

ioev
  • 78
  • 6