networkx / networkx-metis

NetworkX Addon to allow graph partitioning with METIS
Other
79 stars 21 forks source link

Import issue #9

Closed OrkoHunter closed 9 years ago

OrkoHunter commented 9 years ago
>>> import metis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "metis.py", line 18, in <module>
    from _types import MetisError, MetisOptions
  File "_types.py", line 4, in <module>
    from _metis import set_default_options
ImportError: ./_metis.so: undefined symbol: libmetis__rpqSeeTopVal

This ImportError is generated from libmetis/gklib_rename.h at the line

#define rpqSeeTopVal libmetis__rpqSeeTopVal

I did a grep -r "rpqSeeTopVal in the directory and got this

src/libmetis/sfm.c:      u[0] = rpqSeeTopVal(queues[0]);  
src/libmetis/sfm.c:      u[1] = rpqSeeTopVal(queues[1]);
src/libmetis/parmetis.c:      u[0] = rpqSeeTopVal(queues[0]);  
src/libmetis/parmetis.c:      u[1] = rpqSeeTopVal(queues[1]);
src/libmetis/gklib_rename.h:#define rpqSeeTopVal libmetis__rpqSeeTopVal

What surprises me is that it can't even be found where this symbol got defined, It's just being used in sfm.c and parmetis.c.

I tried removing all the possible existence of this symbol, but still, it is present in the binary file _metis.so

$ grep -r "rpqSeeTopVal"
Binary file _metis.so matches
Binary file build/lib.linux-x86_64-2.7/_metis.so matches
Binary file build/temp.linux-x86_64-2.7/src/libmetis/gklib.o matches
Binary file build/temp.linux-x86_64-2.7/libmetis.a matches

IIRC it has occurred earlier, and I had said that the reason behind this is that gklib.c got renamed. However, this isn't an obvious reason. .c files can be renamed to .cc with the use of extern "C".

OrkoHunter commented 9 years ago

@ysitu Any comments on this?

ysitu commented 9 years ago

Can you try reviving the original gklib.c and move only the sorting functions into a separate gklib_sort.cc file?

OrkoHunter commented 9 years ago

Yes I'll try it. Thanks! Is there anything else which is needed to put in gklib_sort.cc for building the library or setup.py will manage all the object files?