Closed OrkoHunter closed 9 years ago
@ysitu I think I am facing an ambiguous error. Earlier I said that renaming gklib.c
into gklib.cc
worked fine. But as of now, If I fetch and combine all the 4 branches from orkohunter/networkx-metis i.e. master
, setup
, wrapper
and pyx-and-pxd
and do
$ python setup.py build_clib
followed by
$ python setup.py build_ext --inplace
,
then this error is generated.
test/ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import metis
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "metis.py", line 19, in <module>
from _metis import node_nd, part_graph, compute_vertex_separator
ImportError: ./_metis.so: undefined symbol: libmetis__rpqSeeTopVal
Can you please look at it sometime?
See inline comments in #4.
@ysitu Thanks for the fix in setup.py
. That helped building the .cc files. But, I've encountered another issue while building the library.
Related to gklib.cc
, it seems that the declared datatypes are not being recognized. Here's a small gist
src/libmetis/gklib.cc:16:27: error: ‘ikv_t’ does not name a type
bool operator()(const ikv_t &lhs, const ikv_t &rhs) const {
^
src/libmetis/gklib.cc: In member function ‘bool ikvi_t_less::operator()(const int&, const int&) const’:
src/libmetis/gklib.cc:17:35: error: request for member ‘key’ in ‘lhs’, which is of non-class type ‘const int’
return std::make_pair(lhs.key, lhs.val) < std::make_pair(rhs.key, rhs.val);
^
src/libmetis/gklib.cc: At global scope:
src/libmetis/gklib.cc:22:27: error: ‘uvw_t’ does not name a type
bool operator()(const uvw_t &lhs, const uvw_t &rhs) const {
^
and here's one example of the error in sort.cc
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8/algorithm:61,
from src/GKlib/sort.cc:5:
/usr/include/c++/4.8/bits/stl_iterator.h:347:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
operator<(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.8/bits/stl_iterator.h:347:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/4.8/algorithm:62:0,
from src/GKlib/sort.cc:5:
/usr/include/c++/4.8/bits/stl_algo.h:89:18: note: ‘gk_fkv_t’ is not derived from ‘const std::reverse_iterator<_Iterator>’
else if (*__a < *__c)
^
Are we still missing something in setup.py
?
You probably need to move your C includes above the anonymous namespace.
The std::greater<>()
also seems to have problem with these data types.
In file included from /usr/include/c++/4.8/algorithm:62:0,
from src/GKlib/sort.cc:5:
/usr/include/c++/4.8/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = gk_ckv_t*]’:
/usr/include/c++/4.8/bits/stl_algo.h:2211:62: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = gk_ckv_t*]’
/usr/include/c++/4.8/bits/stl_algo.h:5453:47: required from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = gk_ckv_t*]’
src/GKlib/sort.cc:176:27: required from here
/usr/include/c++/4.8/bits/stl_algo.h:2137:13: error: no match for ‘operator<’ (operand types are ‘gk_ckv_t’ and ‘gk_ckv_t’)
if (*__i < *__first)
^
/usr/include/c++/4.8/bits/stl_algo.h:2137:13: note: candidates are:
In file included from /usr/include/c++/4.8/utility:70:0,
from /usr/include/c++/4.8/algorithm:60,
from src/GKlib/sort.cc:5:
/usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template<class _T1, class _T2> bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
/usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/4.8/algorithm:62:0,
from src/GKlib/sort.cc:5:
/usr/include/c++/4.8/bits/stl_algo.h:2137:13: note: ‘gk_ckv_t’ is not derived from ‘const std::pair<_T1, _T2>’
if (*__i < *__first)
^
You need to define comparison functors similar to the ones you have in gklib.cc
.
Yes I tried it. This leads to
src/GKlib/sort.cc: In member function ‘bool {anonymous}::gk_ikv_t_greater::operator()(const gk_ikv_t&, const gk_ikv_t&) const’:
src/GKlib/sort.cc:24:18: error: no match for ‘operator>’ (operand types are ‘const gk_ikv_t’ and ‘const gk_ikv_t’)
return a > b;
^
You cannot just use >
. That is never defined. You need to look at the original sort.c
and replicate the comparison logic.
This adds _metis.pyx and _api.pxd files.