Creating a NAMD Shared Library -> Undefined Symbols in Charm libs

From: Michael S. Sellers (Cont, ARL/WMRD) (michael.s.sellers.ctr_at_us.army.mil)
Date: Mon Nov 29 2010 - 15:22:40 CST

All,

I am trying to build NAMD as a shared library, but having some linking
trouble. I realize it can't "work" as is without an interface, but this
is a first step.

I first compiled Charm++ as a shared libary, as well as FFTW and TCL.
Then I edited the NAMD Makefile and added -fPIC in the compiler options,
and an additional linkage section to create "libnamd.so" with
"-charm-shared" and "-rdynamic" options. It seems to compile and link
okay via the edited Makefile. "namd2" from the compile runs fine.

I'm testing the libnamd.so library using a simple program that sets
"dlopen("path-to-library", RTLD_LAZY);" equal to a dummy pointer.
However, with this I am getting an error.

****loadNAMD.C******
   ....

   cout << "Opening libnamd.so...\n";
   void* handle = dlopen("software/lib/NAMD/libnamd.so", RTLD_LAZY);
   if (handle == NULL){
       printf("%s\n", dlerror());
       return 0;
   }

***********************

[]$ g++ loadNAMD.C -o loadNAMD -rdynamic -ldl
[]$ ./loadNAMD

The output of dlerror() is:

Opening libnamd.so...
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libconv-core.so:
undefined symbol: Cpv_CthData_

I'm wondering if this is being caused by a lack of Charm++ (via charmrun
or charmc), or the fact that dlopen invokes any _init() methods existing
in the code (I read that somewhere...) ? I would appreciate any
suggestions from those who are familiar with this type of thing. I have
included the output of "ldd -d libnamd.so" at the bottom of this message.

Thanks,

Michael Sellers

[]$ ldd -d ~/software/lib/NAMD/libnamd.so
       libmoduleNeighborLB.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libmoduleNeighborLB.so
(0x00002b7fe9318000)
       libmoduleHybridLB.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libmoduleHybridLB.so
(0x00002b7fe9524000)
       libmoduleRefineLB.so =>
/software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libmoduleRefineLB.so
(0x00002b7fe9730000)
       libmoduleGreedyLB.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libmoduleGreedyLB.so
(0x00002b7fe993b000)
       libck.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so
(0x00002b7fe9b48000)
       libconv-cplus-y.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libconv-cplus-y.so
(0x00002b7fe9f23000)
       libconv-core.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libconv-core.so
(0x00002b7fea138000)
       libconv-util.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libconv-util.so
(0x00002b7fea3d4000)
       libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b7fea61a000)
       libckqt.so =>
software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libckqt.so
(0x00002b7fea835000)
       libdl.so.2 => /lib64/libdl.so.2 (0x00002b7feaa39000)
       libtcl8.5.so => software/lib/libtcl8.5.so (0x00002b7feac3d000)
       libsrfftw.so.2 => software/lib/libsrfftw.so.2 (0x00002b7feaf58000)
       libsfftw.so.2 => software/lib/libsfftw.so.2 (0x00002b7feb188000)
       libm.so.6 => /lib64/libm.so.6 (0x00002b7feb3be000)
       libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6
(0x00002b7feb641000)
       libgcc_s.so.1 => /usr/local/lib64/libgcc_s.so.1 (0x00002b7feb947000)
       libc.so.6 => /lib64/libc.so.6 (0x00002b7febb5c000)
       /lib64/ld-linux-x86-64.so.2 (0x0000003f25000000)
undefined symbol: Cpv_CthData_
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libconv-core.so)

undefined symbol: cpd_memory_pup
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: memory_stack_top
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: Cpv_CthData_
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: cpd_memory_length
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: cpd_memory_getLength
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: cpdInSystem
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: cpd_memory_get
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

undefined symbol: memory_status_info
(software/src/NAMD_CVS_Source/Linux-x86_64-g++/.rootdir/charm-6.2.2/multicore-linux64/lib_so/libck.so)

[]$


This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:54:49 CST