简体   繁体   中英

ruby LoadError for .so file

I'm working with ruby1.8.7 on an embedded platform, and I'm trying to port the ruby sqlite3 gem onto the platform.

The underlying sqlite3_native.so makes successfully, and is installed on the target. ldd indicates that all dependencies are met. However, when I try to load it, I get a LoadError (File not Found). Other .so libraries in the same directory load successfully.

#ls -l
total 167
lrwxrwxrwx    1 root     root             7 Oct 10 16:24 di.so -> di.so.5
-rw-r--r--    1 root     root         16540 Oct 10 15:29 di.so.5
-rwxrwxrwx    1 root     root         37916 Mar  6  2012 serialport.so
-rwxrwxrwx    1 root     root         51375 Oct 16 17:25 sqlite3_native.so

#[path_to_ruby]/bin/ruby -r ./di -e exit
#
#[path_to_ruby]/bin/ruby -r ./serialport -e exit
#
#[path_to_ruby]/bin/ruby -r ./ssqlite3_native -e exit
./sqlite3_native.so: File not found - ./sqlite3_native.so (LoadError)

Does anyone have any thoughts on possible causes?

Kind regards

Steve

The power of taking a walk to clear one's head....

The issue is in the linking of the library in the make process, not on the target machine.

The mkmf generated makefile links in libruby.so via the line

LIBS = $(LIBRUBYARG_SHARED) -lsqlite3  -lrt -ldl -lcrypt -lm   -lc

removing libruby ( $(LIBRUBYARG_SHARED) ) changes the generated library in some subtle way (it is 20 bytes smaller) which then allows the ruby executable to locate and load the library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM