KarypisLab / METIS

METIS - Serial Graph Partitioning and Fill-reducing Matrix Ordering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error on mingW64

Plume-SPH opened this issue · comments

Hi, when I try to compile on mingW64, I am seeing the following error:
cd C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/build/programs && C:/msys64/mingw64/bin/cc.exe @CMakeFiles/gpmetis.dir/includes_C.rsp -std=c99 -fno-strict-aliasing -march=native -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label -DNDEBUG -DNDEBUG2 -O3 -MD -MT programs/CMakeFiles/gpmetis.dir/gpmetis.c.obj -MF CMakeFiles/gpmetis.dir/gpmetis.c.obj.d -o CMakeFiles/gpmetis.dir/gpmetis.c.obj -c C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/programs/gpmetis.c
C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/programs/gpmetis.c: In function 'GPReportResults':
C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/programs/gpmetis.c:244:19: error: storage size of 'usage' isn't known
244 | struct rusage usage;
| ^~~~~
C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/programs/gpmetis.c:245:5: error: implicit declaration of function 'getrusage' [-Werror=implicit-function-declaration]
245 | getrusage(RUSAGE_SELF, &usage);
| ^~~~~~~~~
C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/programs/gpmetis.c:245:15: error: 'RUSAGE_SELF' undeclared (first use in this function)
245 | getrusage(RUSAGE_SELF, &usage);
| ^~~~~~~~~~~
C:/Users/hitca/Documents/New_pre/code/dependencies-new/METIS/programs/gpmetis.c:245:15: note: each undeclared identifier is reported only once for each function it appears

This seems due to METIS is using getrusage() which is only available on Linux? Could you give some advice on how to walk around this issue?

A quick solution would be to just change the ifdef flags in those files.

At mpmetis.c:191, gpmetis.c:242, and ndmetis.c:175, change from

#ifndef MACOS

to

#if !defined(MACOS) && !defined(WIN32) && !defined(__MINGW32__)