简体   繁体   中英

Unresolved symbols using C++ .so libraries inside ruby

I've recently inherited the development of a Ruby on Rails project, focused on provinding a user interface to two custom libraries that provide some advanced image analysis features.

When I launch the webrick server, it seems to work, but as soon as I try to upload some image, and the shared objects need to be used, I get:

> MagickppAPI::LoadImagesList
> Magick::readImages
ruby: symbol lookup error: /usr/local/lib/site_ruby/1.8/i486-linux/cargadorlib.so: undefined symbol: CloneImageInfo

I've tried passing --no-undefined when compiling the libs, so it doesn't allow undefined symbols, but it compiles successfully. Also, ldd doesn't show any undefined symbols for that library:

nobill@ubuntu-10:/usr/local/lib/site_ruby/1.8/i686-linux$ ldd cargadorlib.so 
linux-gate.so.1 =>  (0xb77ca000)
libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0xb769a000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7681000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb767c000)
libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb764a000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7555000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb752f000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb73d0000)
/lib/ld-linux.so.2 (0xb77cb000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb73b0000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb73a7000)

I know my question is very specific, so I don't necessarily expect a magic answer; i'll be happy with anyone posting suggestions on where the problem might be.

Finally managed to figure out what was happening. A typo in the no--undefined flag (its actually Wl,--no-undefined) was preventing me from realizing I was missing some libs to link against: -lMagick++ -lMagickWand -lMagickCore

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