Search code examples
c++linkerundefined-symbol

C++ undefined symbol error with ForceFit


Trying to launch software written in C++ (ForceFit, https://aclark.chem.wsu.edu/software/) gives me the following error:

./ForceFit
./ForceFit: symbol lookup error: ./ForceFit: undefined symbol: _ZN5Gnome5Glade3Xml6createERKSsRKN4Glib7ustringES7_

I do not have access to the raw code files, but have searched several Q/A forums giving me some leads. As I understand it, this error is linked to libraries. Here is what I have obtained so far:

ldd -d -r ForceFit
linux-vdso.so.1 (0x00007fff05fdf000)
libgtkmm-2.4.so.1 => /lib64/libgtkmm-2.4.so.1 (0x00007f1081919000)
libgdkmm-2.4.so.1 => /lib64/libgdkmm-2.4.so.1 (0x00007f10816c9000)
libatkmm-1.6.so.1 => /lib64/libatkmm-1.6.so.1 (0x00007f108147b000)
libgtk-x11-2.0.so.0 => /lib64/libgtk-x11-2.0.so.0 (0x00007f1080df0000)
libpangomm-1.4.so.1 => /lib64/libpangomm-1.4.so.1 (0x00007f1080bc1000)
libcairomm-1.0.so.1 => /lib64/libcairomm-1.0.so.1 (0x00007f108099a000)
libglibmm-2.4.so.1 => /lib64/libglibmm-2.4.so.1 (0x00007f108071c000)
libsigc-2.0.so.0 => /lib64/libsigc-2.0.so.0 (0x00007f1080515000)
libgdk-x11-2.0.so.0 => /lib64/libgdk-x11-2.0.so.0 (0x00007f1080251000)
libatk-1.0.so.0 => /lib64/libatk-1.0.so.0 (0x00007f108002b000)
libpangoft2-1.0.so.0 => /lib64/libpangoft2-1.0.so.0 (0x00007f107fe15000)
libgdk_pixbuf-2.0.so.0 => /lib64/libgdk_pixbuf-2.0.so.0 (0x00007f107fbee000)
libpangocairo-1.0.so.0 => /lib64/libpangocairo-1.0.so.0 (0x00007f107f9e1000)
libcairo.so.2 => /lib64/libcairo.so.2 (0x00007f107f6b8000)
libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f107f337000)
libpango-1.0.so.0 => /lib64/libpango-1.0.so.0 (0x00007f107f0ec000)
libfreetype.so.6 => /usr/lib64/freetype-freeworld/libfreetype.so.6 (0x00007f107ee42000)
libz.so.1 => /lib64/libz.so.1 (0x00007f107ec2b000)
libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f107e9e7000)
libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f107e795000)
libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f107e590000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f107e38e000)
librt.so.1 => /lib64/librt.so.1 (0x00007f107e186000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f107de4c000)
libglademm-2.4.so.1 => /lib64/libglademm-2.4.so.1 (0x00007f107dc42000)
libglade-2.0.so.0 => /lib64/libglade-2.0.so.0 (0x00007f107da26000)
libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f107d6bc000)
libm.so.6 => /lib64/libm.so.6 (0x00007f107d3ba000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f107d038000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f107ce20000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f107cc02000)
libc.so.6 => /lib64/libc.so.6 (0x00007f107c841000)
libgiomm-2.4.so.1 => /lib64/libgiomm-2.4.so.1 (0x00007f107c48c000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f107c14c000)
libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f107bf45000)
libpng16.so.16 => /lib64/libpng16.so.16 (0x00007f107bd12000)
libXext.so.6 => /lib64/libXext.so.6 (0x00007f107baff000)
libXrender.so.1 => /lib64/libXrender.so.1 (0x00007f107b8f4000)
libXinerama.so.1 => /lib64/libXinerama.so.1 (0x00007f107b6f0000)
libXi.so.6 => /lib64/libXi.so.6 (0x00007f107b4e0000)
libXrandr.so.2 => /lib64/libXrandr.so.2 (0x00007f107b2d5000)
libXcursor.so.1 => /lib64/libXcursor.so.1 (0x00007f107b0c9000)
libXcomposite.so.1 => /lib64/libXcomposite.so.1 (0x00007f107aec6000)
libXdamage.so.1 => /lib64/libXdamage.so.1 (0x00007f107acc3000)
libthai.so.0 => /lib64/libthai.so.0 (0x00007f107aab9000)
libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x00007f107a857000)
libpixman-1.so.0 => /lib64/libpixman-1.so.0 (0x00007f107a5af000)
libEGL.so.1 => /usr/lib64/nvidia/libEGL.so.1 (0x00007f107a3aa000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f107a1a6000)
libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f1079fa1000)
libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007f1079d97000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f1079b75000)
libGL.so.1 => /usr/lib64/nvidia/libGL.so.1 (0x00007f1079840000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f107961d000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f1079402000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f10791f1000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f1078fc7000)
libffi.so.6 => /lib64/libffi.so.6 (0x00007f1078dbe000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f1078b98000)
/lib64/ld-linux-x86-64.so.2 (0x0000563a7c108000)
libdatrie.so.1 => /lib64/libdatrie.so.1 (0x00007f107898f000)
libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007f1078763000)
libGLdispatch.so.0 => /usr/lib64/nvidia/libGLdispatch.so.0 (0x00007f10784ca000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f10782c6000)
libnvidia-tls.so.358.16 => /usr/lib64/nvidia/tls/libnvidia-tls.so.358.16 (0x00007f10780c2000)
libnvidia-glcore.so.358.16 => /usr/lib64/nvidia/libnvidia-glcore.so.358.16 (0x00007f1076460000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f10761ed000)
undefined symbol: _ZN5Gnome5Glade3Xml6createERKSsRKN4Glib7ustringES7_   (./ForceFit)
undefined symbol: _ZN4Glib7ustringC1ERKSs   (./ForceFit)

which lists me the symbols the executable is unable to find. Further running c++filt on these symbol names yields the following:

c++filt _ZN5Gnome5Glade3Xml6createERKSsRKN4Glib7ustringES7_
Gnome::Glade::Xml::create(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Glib::ustring const&, Glib::ustring const&)

c++filt _ZN4Glib7ustringC1ERKSs
Glib::ustring::ustring(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

Unfortunately, I haven't found which steps are needed to resolve this issue and am not familiar with C++ myself. The website of the executable specifies it relies on the G++/c++ compilers and the libglade and gtkmm libraries, which I have installed. I am running Fedora 23 with Gnome 3 if it's relevant.

Thanks for any help!


Solution

  • The package you linked to appears to be a very badly packaged tarball. The tarball includes not just the source code, but the compiled object modules, and an executable.

    You probably attempted to directly execute the binary that you unpacked from the tarball.

    The binary was, obviously, built on some other ancient, circa-2011 Linux distribution' other than the one you're trying to run this on. And, of course, it's linked to shared libraries that you do not have, and you're seeing the results of this sloppily-packaged code.

    You need to rebuild the entire code from source, assuming that it builds at all.