improve detection of missing dependencies of ruby libraries, fix #3051