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.