micans / mcl

MCL, the Markov Cluster algorithm, also known as Markov Clustering, is a method and program for clustering weighted or simple networks, a.k.a. graphs.
https://micans.org/mcl
Other
86 stars 12 forks source link

'SIGALRM' undeclared when installing on Windows #9

Closed RaisssHab closed 1 year ago

RaisssHab commented 1 year ago

Hello. I'm using cygwin on Windows to install the MCL.

The first problem I encountered was 'checking build system type... autofoo/config.guess: unable to guess system type'. I solved it by replacing 'autofoo/config.guess' by a new one from https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD.

After configuring I tried to run 'make install' command and got the following:

proc.c: In function 'mclSigCatch': proc.c:65:18: error: 'SIGALRM' undeclared (first use in this function) { if (sig == SIGALRM) ^ proc.c:65:18: note: each undeclared identifier is reported only once for each function it appears in make[2]: [Makefile:239: proc.o] Error 1 make[2]: Leaving directory '/cygdrive/c/Users/raish/Downloads/22.08.2022 Работа/mcl-14-137/src/mcl' make[1]: [Makefile:233: install-recursive] Error 1 make[1]: Leaving directory '/cygdrive/c/Users/raish/Downloads/22.08.2022 Работа/mcl-14-137/src' make: *** [Makefile:279: install-recursive] Error 1

How can I solve this problem?

micans commented 1 year ago

Hi, thanks for the bug report. This is due to SIGALRM not existing in cygwin. As a short term fix, you can change the code around line 65 in the file src/mcl.c to this: (so substitute SIGQUIT for SIGALRM).

void mclSigCatch
(  int sig
)
   {  if (sig == SIGQUIT)
      abort_loop = 1
;  }

I haven't tested this (no access to cygwin currently), but think this should work.

The purpose of this bit of this bit of code is to enable users to signal mcl if it encounters a rare flip flop state where expansion and inflation cancel each other out - with large networks mcl might keep running for a long time. In the upcoming release this provision will no longer be needed, as mcl will enforce convergence after a certain number of iterations. Nevertheless, I will probably seek to just add some cygwin-specific test to fix this.

Thanks as well for flagging config.guess.

RaisssHab commented 1 year ago

Hello. Unfortunately, replacing SIGALRM with SIGQUIT doesn't work as well. The error is the same as for SIGALRM.

Replaced it with SIGINT, and now I get the following:

clmformat.c:999:20: error: too many arguments to function 'mkdir'
             {  if (mkdir(dn_fmt->str, 0777))
                    ^
In file included from C:/Strawberry/c/i686-w64-mingw32/include/unistd.h:10:0,
                 from clmformat.c:13:
C:/Strawberry/c/i686-w64-mingw32/include/io.h:267:15: note: declared here
   int __cdecl mkdir (const char *) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
               ^
make[2]: *** [Makefile:384: clmformat.o] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/raish/Downloads/22.08.2022 Работа/mcl-14-137/src/shcl'
make[1]: *** [Makefile:233: install-recursive] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/raish/Downloads/22.08.2022 Работа/mcl-14-137/src'
make: *** [Makefile:279: install-recursive] Error 1

After replacing

{  if (mkdir(dn_fmt->str, 0777))

with

{  if (mkdir(dn_fmt->str))

I get

clmps.o: In function `PSMain':
C:\Users\raish\Downloads\22.08.2022 ╨рсюЄр\mcl-14-137\src\shcl/clmps.c:557: undefined reference to
 `srandom'
C:\Users\raish\Downloads\22.08.2022 ╨рсюЄр\mcl-14-137\src\shcl/clmps.c:684: undefined reference to
 `random'
../../util/libutil.a(rand.o): In function `mcxSeed':
C:\Users\raish\Downloads\22.08.2022 ╨рсюЄр\mcl-14-137\util/rand.c:24: undefined reference to `getp
pid'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:314: clm.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/raish/Downloads/22.08.2022 Работа/mcl-14-137/src/shcl'
make[1]: *** [Makefile:233: install-recursive] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/raish/Downloads/22.08.2022 Работа/mcl-14-137/src'
make: *** [Makefile:279: install-recursive] Error 1

and I don't really have an idea what to do with this.

RaisssHab commented 1 year ago

Okay, the problem was with that I didn't install gcc for cygwin. The problems stated here do not appear anymore (including SIGALRM). However, there's another problem, which I'm going to describe in another issue.