Knowledge base dedicated to Linux and applied mathematics.

Home > Mathematics > Linear Systems > How to patch metis-4.0 error: conflicting types for __log2

How to patch metis-4.0 error: conflicting types for __log2

METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes.
I give a patch for metis-4.0 software, compilation fails with gcc 4.4.x

nsoualem@gold: -> cd metis-4.0
nsoualem@gold: -> make
(cd Lib ; make )
make[1]: Entering directory `/home/nsoualem/test/lib_ext/lib_ext/metis-4.0/Lib'
cc  -O2  -I. -c coarsen.c
In file included from ./metis.h:36,
                from coarsen.c:13:
./proto.h:462: error: conflicting types for '__log2'
/usr/include/bits/mathcalls.h:145: note: previous declaration of '__log2' was here
make[1]: *** [coarsen.o] Error 1
make[1]: Leaving directory `/home/nsoualem/test/lib_ext/lib_ext/metis-4.0/Lib'
make: *** [default] Error 2

This error is due to the duplication of __log2 /usr/include/bits/mathcalls.h:145

Here is the patch
to get compilation successful

nsoualem@gold: -> cd metis-4.0
nsoualem@gold: -> patch -p1 < metis-4.0.patch

Any message or comments?

comments powered by Disqus