Fiesta doesn't compile with gcc 10
*Created by: vshtabov*
Trying to compile Fiesta from the master branch with gcc 10.1 on Fedora 32 I get the following error
after `make` \(`make dep` goes through flawlessly\)
```shell
make -C ./real
make[1]: Entering directory '/media/Data/Projects/Other/fiesta/test/fiesta/FIESTA4/real'
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/collectstr.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/scanner.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/runline.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/hash.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/integrators.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/CIntegrate.c
../sources/CIntegrate.c: In function ‘main’:
../sources/CIntegrate.c:1148:13: warning: ‘strncpy’ specified bound 200 equals destination size [-Wstringop-truncation]
1148 | strncpy(res,buffer,200);
| ^~~~~~~~~~~~~~~~~~~~~~~
gcc collectstr.o scanner.o runline.o hash.o integrators.o CIntegrate.o -march=native -Wl,-Bstatic -L/sw/lib -L../usr/lib/ -L../usr/lib64/ -Wl,-Bstatic -lmpfr -lgmp -lcuba -Wl,-Bdynamic -pthread -lstdc++ -lrt -lz -lm -o CIntegrateMP
/usr/bin/ld: scanner.o:(.bss+0x2028): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2030): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2038): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2040): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2048): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: runline.o:(.bss+0x8): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: runline.o:(.bss+0x0): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: runline.o:(.bss+0x18): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: runline.o:(.bss+0x10): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: runline.o:(.bss+0x20): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: hash.o:(.bss+0x0): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: hash.o:(.bss+0x8): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: hash.o:(.bss+0x10): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: hash.o:(.bss+0x18): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: hash.o:(.bss+0x20): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: integrators.o:(.bss+0x0): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: integrators.o:(.bss+0x8): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: integrators.o:(.bss+0x10): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: integrators.o:(.bss+0x18): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: integrators.o:(.bss+0x20): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x230): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x238): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x248): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x240): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x228): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: cannot find -lmpfr
/usr/bin/ld: ../usr/lib//libcuba.a(Suave.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Divonne.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Cuhre.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Fork.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Global.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:12: CIntegrateMP] Error 1
make[1]: Leaving directory '/media/Data/Projects/Other/fiesta/test/fiesta/FIESTA4/real'
make: *** [Makefile:9: default] Error 2
```
`libmpfr` is located in `/usr/lib64/libmpfr.so `. I remember having no such issues on Fedora 30 that shipped with gcc 9
I managed to solve the problem `libmpfr` by editing `real/Makefile` and changing
```
$(CC) $(OBJ) ${LFLAGS} ${MPFRLIBDIR} ${CUBALIBDIR} ${LIBSSTART} -lmpfr -lgmp -lcuba ${LIBSEND} -o $@
```
to
```
$(CC) $(OBJ) ${LFLAGS} ${MPFRLIBDIR} ${CUBALIBDIR} ${LIBSSTART} -lgmp -lcuba --verbose ${LIBSEND} -lmpfr -o $@
```
However, in this case I still cannot compile Fiesta
```
make -C ./real
make[1]: Entering directory '/media/Data/Projects/Other/fiesta/test/fiesta/FIESTA4/real'
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/collectstr.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/scanner.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/runline.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/hash.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/integrators.c
gcc -O3 -Werror -Wall -Wno-char-subscripts -DPRECISION=64 -I/sw/include -I../usr/include/ -c ../sources/CIntegrate.c
../sources/CIntegrate.c: In function ‘main’:
../sources/CIntegrate.c:1148:13: warning: ‘strncpy’ specified bound 200 equals destination size [-Wstringop-truncation]
1148 | strncpy(res,buffer,200);
| ^~~~~~~~~~~~~~~~~~~~~~~
gcc collectstr.o scanner.o runline.o hash.o integrators.o CIntegrate.o -march=native -Wl,-Bstatic -L/sw/lib -L../usr/lib/ -L../usr/lib64/ -Wl,-Bstatic -lgmp -lcuba --verbose -Wl,-Bdynamic -pthread -lstdc++ -lrt -lz -lm -lmpfr -o CIntegrateMP
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC)
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-march=native' '-L/sw/lib' '-L../usr/lib/' '-L../usr/lib64/' '-v' '-pthread' '-o' 'CIntegrateMP'
/usr/libexec/gcc/x86_64-redhat-linux/10/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper -plugin-opt=-fresolution=/tmp/cc55eugJ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o CIntegrateMP /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/10/crtbegin.o -L/sw/lib -L../usr/lib/ -L../usr/lib64/ -L/usr/lib/gcc/x86_64-redhat-linux/10 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../.. collectstr.o scanner.o runline.o hash.o integrators.o CIntegrate.o -Bstatic -Bstatic -lgmp -lcuba -Bdynamic -lstdc++ -lrt -lz -lm -lmpfr -lgcc --push-state --as-needed -lgcc_s --pop-state -lpthread -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-redhat-linux/10/crtend.o /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crtn.o
/usr/bin/ld: scanner.o:(.bss+0x2028): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2030): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2038): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2040): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: scanner.o:(.bss+0x2048): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: runline.o:(.bss+0x8): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: runline.o:(.bss+0x0): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: runline.o:(.bss+0x18): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: runline.o:(.bss+0x10): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: runline.o:(.bss+0x20): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: hash.o:(.bss+0x0): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: hash.o:(.bss+0x8): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: hash.o:(.bss+0x10): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: hash.o:(.bss+0x18): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: hash.o:(.bss+0x20): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: integrators.o:(.bss+0x0): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: integrators.o:(.bss+0x8): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: integrators.o:(.bss+0x10): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: integrators.o:(.bss+0x18): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: integrators.o:(.bss+0x20): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x230): multiple definition of `cuba_thread_number'; collectstr.o:(.bss+0x8): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x238): multiple definition of `buffer_shared_id_address'; collectstr.o:(.bss+0x10): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x248): multiple definition of `new_core_number'; collectstr.o:(.bss+0x20): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x240): multiple definition of `statistics'; collectstr.o:(.bss+0x18): first defined here
/usr/bin/ld: CIntegrate.o:(.bss+0x228): multiple definition of `cuda_statistics'; collectstr.o:(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Suave.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Divonne.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Cuhre.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Fork.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
/usr/bin/ld: ../usr/lib//libcuba.a(Global.o):(.bss+0x0): multiple definition of `cubafun_'; ../usr/lib//libcuba.a(Vegas.o):(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:12: CIntegrateMP] Error 1
make[1]: Leaving directory '/media/Data/Projects/Other/fiesta/test/fiesta/FIESTA4/real'
make: *** [Makefile:9: default] Error 2
```
It would be great if you could have a look at this.
issue