https://sourceware.org/bugzilla/show_bug.cgi?id=17479
Bug ID: 17479 Summary: Shared object missing symbol explicitly specified in --retain-symbols-file Product: binutils Version: 2.20 Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: predictivestatmech at gmail dot com I'm creating a shared library packaging a monstrous proliferation of small static libraries (compiled from fortran sources using -fPIC ... with objects from each directory bundled to the static libs with ar). Since there is some duplication in symbol names between the .a files, I am specifying the complete list of (77) exports with --retain-symbols-file=sym.list inside the final link line: <ore><code>gfortran -shared -Wl,--retain-symbols-file=sym.list -L$HOME/build/nwchem-6.3/lib/LINUX64 -L$HOME/build/nwchem-6.3/src/tools/install/lib -fPIC -o $HOME/build/nwchem-6.3/lib/LINUX64/libnwchem.so libnwchem.o stubs.o -Wl,--start-group -lnwctask -lccsd -lmcscf -lselci -lmp2 -lmoints -lstepper -ldriver -loptim -lnwdft -lgradients -lcphf -lesp -lddscf -ldangchang -lguess -lhessian -lvib -lnwcutil -lrimp2 -lproperty -lnwints -lprepar -lnwmd -lnwpw -lofpw -lpaw -lpspw -lband -lnwpwlib -lnwxc -lcafe -lspace -lanalyze -lqhop -lpfft -ldplot -ldrdy -lvscf -lqmmm -lqmd -letrans -lpspw -ltce -lbq -lcons -lperfm -ldntmc -lccca -lnwcutil -lga -larmci -lpeigs -lperfm -lcons -lbq -lnwcutil -Wl,--end-group (external dependency libraries)</code></pre> Although linking produces an 80Mb library which loads without errors with python's ctypes (CDLL("libnwchem.so")), when trying to use it, I found that at least two of the functions are missing. File "/usr/lib64/python2.6/ctypes/__init__.py", line 371, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: libnwchem.so: undefined symbol: push_inp_cstring Which I think is a bit odd, since that is specifically listed as the first line at the top of the sym.list file, push_inp_cstring input_parse_ nwchem_init_ nwchem_dtor_ task_input_ task_ ... If I ignore the missing push_inp_cstring, the next missing function out of the list above is "task_". The relevant object is in the static library: nm -s ../lib/LINUX64/libnwcutil.a | grep push_inp push_inp_string_ in nw_inp_from_file.o push_inp_cstring in push_inp_cstring.o 0000000000000430 T push_inp_string_ 0000000000000038 d push_inp_string_$BLK$format_pack.0.4 push_inp_cstring.o: 0000000000000000 T push_inp_cstring U push_inp_string_ but not in the dynamic one (verified with readelf --syms). The same happens for task_ nm -s ../lib/LINUX64/libnwctask.a | grep "task_ *$" U stpr_walk_task_ 0000000000000000 T task_ Is the zero-address a clue here, or the source of a failed link? -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils