problem while compiling fasthenry2
Hi,
When I try to compile the master branch the following error is thrown:
make[2]: Leaving directory '/home/rsmarinho/fasthenry/FastHenry2/src/fasthenry/sparse'
cc -o fasthenry -O -DFOUR -m64 induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o parse_command_line.o default_opts.o Prec_cost.o hole.o dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o barnoldi.o regurgitate.o mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o uglieralloc.o capsolve.o find_nonuni_path.o read_tree.o contact.o sparse/sparse.a -lm
/usr/bin/ld: gmres.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: readGeom.o:(.bss+0x20): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: joelself.o:(.bss+0x60): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: writefastcap.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: SetupMulti.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: calcp.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: SetupComputePsi.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: mulSetup.o:(.bss+0x2000): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: BreakupSeg.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: Precond.o:(.bss+0x0): multiple definition of fp'; induct.o:(.bss+0x1e8): first defined here
/usr/bin/ld: Precond.o:(.bss+0x20): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: addgroundplane.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: findpaths.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: fillM.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: cx_ludecomp.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: parse_command_line.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: default_opts.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: Prec_cost.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: hole.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: dist_betw_fils.o:(.bss+0x20): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: mutual.o:(.bss+0x20): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: newPrecond.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: deg_mutual.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: barnoldi.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: regurgitate.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: mulGlobal.o:(.bss+0x400): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: mulDo.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: mulMulti.o:(.bss+0x60): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: mulLocal.o:(.bss+0x20): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: mulMats.o:(.bss+0x60): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: direct.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: capsolve.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: find_nonuni_path.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here /usr/bin/ld: read_tree.o:(.bss+0x0): multiple definition of timestuff'; induct.o:(.bss+0x200): first defined here
/usr/bin/ld: contact.o:(.bss+0x0): multiple definition of `timestuff'; induct.o:(.bss+0x200): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:26: fasthenry] Error 1
make[1]: Leaving directory '/home/rsmarinho/fasthenry/FastHenry2/src/fasthenry'
make: *** [Makefile:17: fasthenry] Error 2
I'm running Fedora 33 with gcc: $ gcc --version gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)
Maybe a definition problem I do not know how to solve.
Thanks, Rafael
Same problem on ubuntu too:
gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
You need the -fcommon flag for newer GCC versions due to missing header guards.
This works on Windows 10 and MSYS with GCC 11.2.0.
To solve this, I opened /src/fasthenry/resusage.h and changed
struct rusage timestuff;
to
inline struct rusage timestuff;
and
struct tms timestuff;
to
inline struct tms timestuff;