METIS icon indicating copy to clipboard operation
METIS copied to clipboard

Compilation error on mingW64

Open Plume-SPH opened this issue 1 year ago • 1 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?

Plume-SPH avatar Sep 17 '23 22:09 Plume-SPH

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__)

gfaster avatar Sep 18 '23 04:09 gfaster