A wild guess.
RHEL systems are by default configured to prelink shared libraries to a random address, once every 2 weeks.
Perhaps your copy of ruby doesn't work correctly when it is prelinked?
It starts working after a fresh build, then prelink is performed on all shared libraries, and it stops working until next fresh install.
You can find out whether the library is prelinked or not by running:
readelf -l encdb.so | grep LOAD | head -1
Un-prelinked library will have first load segment at 0
. Prelinked library will have it as non-zero.
Update: this link suggest that Ruby indeed may not work with prelinking. Solution from there (copied for posterity):
Add
-b /usr/bin/ruby
to your/etc/prelink.conf
file, this tellsprelink
to not touch theruby
interpreter.