snap-stanford / snap

Stanford Network Analysis Platform (SNAP) is a general purpose network analysis and graph mining library.
Other
2.17k stars 797 forks source link

Arch Linux: error: invalid use of incomplete type ‘struct __exception’ #146

Open dvs23 opened 6 years ago

dvs23 commented 6 years ago

On arch linux, I'm unable to compile - neither the 4.0 release from the website nor a fresh clone from github. Relevant part of the "make all" output:

In file included from ../glib-core/base.cpp:79,
                 from Snap.cpp:6:
../glib-core/bd.cpp: In function ‘int _matherr(__exception*)’:
../glib-core/bd.cpp:14:4: error: invalid use of incomplete type ‘struct __exception’
   e->retval=0;
    ^~
../glib-core/bd.cpp:13:21: note: forward declaration of ‘struct __exception’
 int _matherr(struct __exception* e){
                     ^~~~~~~~~~~

If you add the following in bp.cpp:12

struct __exception {
    int    type;      /* Exception type */
    char*  name;      /* Name of function causing exception */
    double arg1;      /* 1st argument to function */
    double arg2;      /* 2nd argument to function */
    double retval;    /* Function return value */
};

(copied from http://man7.org/linux/man-pages/man3/matherr.3.html)
it seems to compile. Quick and dirty hack, so I'm not sure if it breaks anything else...

Compiler: gcc (GCC) 8.1.0 glibc: ldd (GNU libc) 2.27 Arch Linux: 4.16.10-1-ARCH

YasCoMa commented 6 years ago

I am having the same problem on ubuntu 18.04. Did you solve it? If yes, Could you share the solution?

dvs23 commented 6 years ago

No, I didn't find a better solution that just adding the stuct above to bs.cpp in line 12 - but it seems to work with that :)

YasCoMa commented 6 years ago

It worked here. It was compiled with many warnings. Thanks.

dibstern commented 6 years ago

Amazing, you saved me, thank you so much!

Sleris commented 5 years ago

Encountered a similar error today on 3 flavor of linux (Arch/ubuntu/gentoo) all with more or less latest GCC, only difference is that the incriminated file was glib-core/bd.cpp . The same dirty trick on glib-core/bd.h allowed to compile. This is happening on both 4.0 and 4.1 (haven't tested others)