GNAT2017 GCC breaks SMG_Comms MPI: extern inline function issues.

November 11th, 2018

UPDATE: diana_coman has pointed out that this is a known issue related to default C version used by later gcc versions. phf had exactly the same problem with vdiff. So the patches in the end of the article should be ignored. Use the following instead (or better, install gcc 4.9):

curl 'http://bvt-trace.net/vpatches/smg_comms_mpi_c_version.vpatch' > smg_comms_mpi_c_version.vpatch
curl 'http://bvt-trace.net/vpatches/smg_comms_mpi_c_version.vpatch.bvt.sig' > smg_comms_mpi_c_version.vpatch.bvt.sig

--

diana_coman: hm, weird; now I'm really curious if you get the same complaint with asciilifeform's ffa (or my smg comms for that matter)

I use nonstandard GNAT compiler as a leftover from the pre-WoT days1. I expect that I will stop using it some time in the future, and I sure as hell don't expect that people will change anything in their software (well-established at this point) to make it work with this nonstandard item. However, sometimes it exposes subtle breakage, so I believe that using this compiler has paid off so far.

Having tested compiling FFA Chapter 8 code to check if GNAT will specialize a package in presence of numerous restrictions, I wanted to do the same test with SMG_Comms. I discovered no problems related to specialization, however I did find issue with multiple definitions of inline functions in C code:

$ gprbuild tests/test_comms.gpr
Compile
   [Ada]          testall.adb
   [Ada]          test_packing.adb
test_packing.adb:74:80: (style) this line is too long
test_packing.adb:75:80: (style) this line is too long
test_packing.adb:76:80: (style) this line is too long
test_packing.adb:77:80: (style) this line is too long
test_packing.adb:78:80: (style) this line is too long
test_packing.adb:79:80: (style) this line is too long
   [Ada]          test_rsa_oaep.adb
   [Ada]          test_serializing.adb
   [Ada]          test_serpent.adb
Bind
   [gprbind]      testall.bexch
   [Ada]          testall.ali
Link
   [link]         testall.adb
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-mul.o): In function `mpihelp_add_1':
mpi-mul.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-mul.o): In function `mpihelp_add':
mpi-mul.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-mul.o): In function `mpihelp_sub_1':
mpi-mul.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-mul.o): In function `mpihelp_sub':
mpi-mul.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-div.o): In function `mpihelp_add_1':
mpih-div.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-div.o): In function `mpihelp_add':
mpih-div.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-div.o): In function `mpihelp_sub_1':
mpih-div.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-div.o): In function `mpihelp_sub':
mpih-div.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-pow.o): In function `mpihelp_add_1':
mpi-pow.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-pow.o): In function `mpihelp_add':
mpi-pow.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-pow.o): In function `mpihelp_sub_1':
mpi-pow.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-pow.o): In function `mpihelp_sub':
mpi-pow.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-inv.o): In function `mpihelp_add_1':
mpi-inv.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-inv.o): In function `mpihelp_add':
mpi-inv.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-inv.o): In function `mpihelp_sub_1':
mpi-inv.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-inv.o): In function `mpihelp_sub':
mpi-inv.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-add.o): In function `mpihelp_add_1':
mpi-add.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-add.o): In function `mpihelp_add':
mpi-add.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-add.o): In function `mpihelp_sub_1':
mpi-add.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-add.o): In function `mpihelp_sub':
mpi-add.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpiutil.o): In function `mpihelp_add_1':
mpiutil.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpiutil.o): In function `mpihelp_add':
mpiutil.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpiutil.o): In function `mpihelp_sub_1':
mpiutil.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpiutil.o): In function `mpihelp_sub':
mpiutil.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-rshift.o): In function `mpihelp_add_1':
mpih-rshift.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-rshift.o): In function `mpihelp_add':
mpih-rshift.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-rshift.o): In function `mpihelp_sub_1':
mpih-rshift.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-rshift.o): In function `mpihelp_sub':
mpih-rshift.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-scan.o): In function `mpihelp_add_1':
mpi-scan.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-scan.o): In function `mpihelp_add':
mpi-scan.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-scan.o): In function `mpihelp_sub_1':
mpi-scan.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-scan.o): In function `mpihelp_sub':
mpi-scan.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-cmp.o): In function `mpihelp_add_1':
mpi-cmp.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-cmp.o): In function `mpihelp_add':
mpi-cmp.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-cmp.o): In function `mpihelp_sub_1':
mpi-cmp.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-cmp.o): In function `mpihelp_sub':
mpi-cmp.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-lshift.o): In function `mpihelp_add_1':
mpih-lshift.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-lshift.o): In function `mpihelp_add':
mpih-lshift.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-lshift.o): In function `mpihelp_sub_1':
mpih-lshift.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-lshift.o): In function `mpihelp_sub':
mpih-lshift.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul.o): In function `mpihelp_add_1':
mpih-mul.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul.o): In function `mpihelp_add':
mpih-mul.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul.o): In function `mpihelp_sub_1':
mpih-mul.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul.o): In function `mpihelp_sub':
mpih-mul.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul1.o): In function `mpihelp_add_1':
mpih-mul1.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul1.o): In function `mpihelp_add':
mpih-mul1.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul1.o): In function `mpihelp_sub_1':
mpih-mul1.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul1.o): In function `mpihelp_sub':
mpih-mul1.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-bit.o): In function `mpihelp_add_1':
mpi-bit.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-bit.o): In function `mpihelp_add':
mpi-bit.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-bit.o): In function `mpihelp_sub_1':
mpi-bit.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-bit.o): In function `mpihelp_sub':
mpi-bit.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-add1.o): In function `mpihelp_add_1':
mpih-add1.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-add1.o): In function `mpihelp_add':
mpih-add1.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-add1.o): In function `mpihelp_sub_1':
mpih-add1.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-add1.o): In function `mpihelp_sub':
mpih-add1.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-sub1.o): In function `mpihelp_add_1':
mpih-sub1.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-sub1.o): In function `mpihelp_add':
mpih-sub1.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-sub1.o): In function `mpihelp_sub_1':
mpih-sub1.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-sub1.o): In function `mpihelp_sub':
mpih-sub1.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpicoder.o): In function `mpihelp_add_1':
mpicoder.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpicoder.o): In function `mpihelp_add':
mpicoder.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpicoder.o): In function `mpihelp_sub_1':
mpicoder.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpicoder.o): In function `mpihelp_sub':
mpicoder.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-cmp.o): In function `mpihelp_add_1':
mpih-cmp.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-cmp.o): In function `mpihelp_add':
mpih-cmp.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-cmp.o): In function `mpihelp_sub_1':
mpih-cmp.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-cmp.o): In function `mpihelp_sub':
mpih-cmp.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul3.o): In function `mpihelp_add_1':
mpih-mul3.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul3.o): In function `mpihelp_add':
mpih-mul3.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul3.o): In function `mpihelp_sub_1':
mpih-mul3.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul3.o): In function `mpihelp_sub':
mpih-mul3.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul2.o): In function `mpihelp_add_1':
mpih-mul2.c:(.text+0x0): multiple definition of `mpihelp_add_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x0): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul2.o): In function `mpihelp_add':
mpih-mul2.c:(.text+0xd7): multiple definition of `mpihelp_add'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0xd7): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul2.o): In function `mpihelp_sub_1':
mpih-mul2.c:(.text+0x168): multiple definition of `mpihelp_sub_1'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x168): first defined here
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpih-mul2.o): In function `mpihelp_sub':
mpih-mul2.c:(.text+0x242): multiple definition of `mpihelp_sub'
~/src/smg-comms/a/smg_comms/mpi/bin/libMPI.a(mpi-div.o):mpi-div.c:(.text+0x242): first defined here
collect2: error: ld returned 1 exit status
gprbuild: link of testall.adb failed

The functions in question (mpihelp_add, mpihelp_add_1, mpihelp_sub, mpihelp_sub_1) are declared in 'mpi/include/mpi-internal.h' and defined in 'mpi/include/mpi-inline.h'. All files where double definitions are present (mpi-add.c, mpi-bit.c, mpi-cmp.c, mpicoder.c, mpi-div.c, mpih-add1.c, mpih-cmp.c, mpih-div.c, mpih-lshift.c, mpih-mul1.c, mpih-mul2.c, mpih-mul3.c, mpih-mul.c, mpih-rshift.c, mpih-sub1.c, mpi-inv.c, mpi-mul.c, mpi-pow.c, mpi-scan.c, mpiutil.c) directly or indirectly include these headers. After studying the C standard for some time, I fixed the problem removing 'extern' from function definitions, and adding 'inline' to function declarations. Given that the compiler inside GNAT2017 is gcc-6.3.1, which is explicitly tagged as broken, I really don't expect inclusion of this vpatch into the tree. But in any case, here it is:

curl 'http://bvt-trace.net/vpatches/smg_comms_fix_mpi_inline.vpatch' > smg_comms_fix_mpi_inline.vpatch
curl 'http://bvt-trace.net/vpatches/smg_comms_fix_mpi_inline.vpatch.bvt.sig' > smg_comms_fix_mpi_inline.vpatch.bvt.sig
curl 'http://wot.deedbot.org/6CF3EFF892A7F23E7E798E5EBA6B8C054B962B68.asc' > bvt.asc
  1. My compiler is musltronized GNAT 2017 from AdaCore. The standard one is done by ave1. []