Build issue with NAG 7.1 and MPICH 4.3.0: non-interoperable type LOGICAL
Today I tried to build MPICH 4.3.0 with NAG (following some advice in #5892) and got this:
Error: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 2525: BIND(C) function MPIR_REQUEST_IS_COMPLETE_C is of non-interoperable type LOGICAL
Errors in declarations, no further processing for MPI_C_INTERFACE_NOBUF
[NAG Fortran Compiler error termination, 1 error, 5 warnings]
make: *** [Makefile:47647: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.stamp] Error 1
So I took a look and I think this:
FUNCTION MPIR_Request_is_complete_c(request) &
bind(C, name="PMPIX_Request_is_complete") result(res)
USE, intrinsic :: iso_c_binding, ONLY : c_int
USE :: mpi_c_interface_types, ONLY : c_Request
IMPLICIT NONE
INTEGER(c_Request), VALUE, INTENT(in) :: request
LOGICAL :: res
END FUNCTION MPIR_Request_is_complete_c
needs to be:
FUNCTION MPIR_Request_is_complete_c(request) &
bind(C, name="PMPIX_Request_is_complete") result(res)
USE, intrinsic :: iso_c_binding, ONLY : c_int, c_bool
USE :: mpi_c_interface_types, ONLY : c_Request
IMPLICIT NONE
INTEGER(c_Request), VALUE, INTENT(in) :: request
LOGICAL(c_bool) :: res
END FUNCTION MPIR_Request_is_complete_c
where the LOGICAL type is now a LOGICAL(c_bool). I made this edit local to my build and NAG seemed happy with it.
NOTE: NAG still fails later with:
make[2]: Entering directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.0/build-nag-7.2.13'
GEN lib/libmpifort.la
libtool: warning: '/ford1/local/gcc/gcc-12.1.0/lib64/libatomic.la' seems to be moved
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7213
Option error: Unrecognised option -pthread
make[2]: *** [Makefile:13010: lib/libmpifort.la] Error 2
make[2]: Leaving directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.0/build-nag-7.2.13'
make[1]: *** [Makefile:40263: all-recursive] Error 1
make[1]: Leaving directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.0/build-nag-7.2.13'
make: *** [Makefile:10489: all] Error 2
I'm trying to figure out how -pthread is being passed to it...not sure.
I have the same first issue with NAG version 7.2.7229 (i.e. the LOGICAL that needs to be a LOGICAL(c_bool)).
The second issue (the -pthread) I don't have.
Edit: And I can add that the issue is not present in release 4.2.3
I just checked and this is still in 4.3.1 sadly:
MOD src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.stamp
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7236
Warning: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 1907: C_INT explicitly imported into MPIR_AINT_ADD_C but not used
Warning: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 1917: C_INT explicitly imported into MPIR_AINT_DIFF_C but not used
Warning: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 2525: C_INT explicitly imported into MPIR_REQUEST_IS_COMPLETE_C but not used
Warning: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 3134: C_INT explicitly imported into MPIR_WTICK_C but not used
Warning: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 3141: C_INT explicitly imported into MPIR_WTIME_C but not used
Error: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90, line 2525: BIND(C) function MPIR_REQUEST_IS_COMPLETE_C is of non-interoperable type LOGICAL
Errors in declarations, no further processing for MPI_C_INTERFACE_NOBUF
[NAG Fortran Compiler error termination, 1 error, 5 warnings]
make: *** [Makefile:47647: src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.stamp] Error 1
and then it fails again with the -lpthread (which seems to echo https://github.com/open-mpi/ompi/issues/12413 in Open MPI which @ggouaillardet has fixed there in a PR; maybe the same fix can be applied here?):
make[2]: Entering directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36'
GEN lib/libmpifort.la
libtool: warning: '/ford1/local/gcc/gcc-12.1.0/lib64/libatomic.la' seems to be moved
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7236
Option error: Unrecognised option -pthread
make[2]: *** [Makefile:13010: lib/libmpifort.la] Error 2
make[2]: Leaving directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36'
make[1]: *** [Makefile:40263: all-recursive] Error 1
make[1]: Leaving directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36'
make: *** [Makefile:10489: all] Error 2
NOTE: I would gladly submit a PR to fix at least the first (logical) issue, but I have absolutely no idea where the code is coming from. I think maybe maint/local_python/binding_f08.py but...wow. This code is confusing.
NOTE: I would gladly submit a PR to fix at least the first (logical) issue, but I have absolutely no idea where the code is coming from. I think maybe
maint/local_python/binding_f08.pybut...wow. This code is confusing.
Yes, the binding generation stuff is difficult to understand even for me. Doubly so for an outsider. If you'd like to send a plain diff against the generated sources that fixes the issue, we can port it back to the script and give you attribution.
@raffenet This was the change I made:
> diff Stock/mpich-4.3.1/src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90 mpich-4.3.1/build-nag-7.2.36/src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.f90
2520c2520
< USE, intrinsic :: iso_c_binding, ONLY : c_int
---
> USE, intrinsic :: iso_c_binding, ONLY : c_int, c_bool
2524c2524
< LOGICAL :: res
---
> LOGICAL(c_bool) :: res
So making the LOGICAL a c_bool
Thanks @mathomp4 ! I'll take a look and incorporate your patch.
Thanks @mathomp4 ! I'll take a look and incorporate your patch.
I can't wait to see how you update the binding generator for this. I'm sure it's simple, but boy my brain was not able to grep it :)
I have also waited for this to be fixed, and spent some time to look into those files without seeing any obvious places patch... I think there are some configuration files somewhere that are read in, but I never really figured out. Looking forward to the fix!
@hakostra I am surprised you aren't hitting the -pthread issue. Are you building on Linux?
@mathomp4 I am not sure where -pthread is from. It is an option for some compiler. It doesn't appear on my system. Could you try -
find . -name '*.la' | xargs grep 'pthread'
@hakostra I am surprised you aren't hitting the
-pthreadissue. Are you building on Linux?
Yes, I am.
@hakostra Well huh. I build with:
../configure CC=gcc CXX=g++ FC=nagfor MPICHLIB_FFLAGS=-mismatch -fpp MPICHLIB_FCFLAGS=-mismatch -fpp --enable-f08 CFLAGS=-I/ford1/share/gmao_SIteam/nag/7.2.36/lib/NAG_Fortran --prefix=/ford1/share/gmao_SIteam/MPI/mpich/4.3.1/nag-7.2.36
How do you build? Maybe I have flags I don't need, or you have flags I do?
@ggouaillardet (in Open MPI land) said:
So I finally found the issue. -pthread is pulled from the internal libevent library (I failed to see this because I was using my distro's libevent that did not provide the *.la files.
This does really apply to MPICH since no libevent anywhere in the configure scripts I can see!
Libevent is pulled in by hwloc
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Matt Thompson @.> Sent: Friday, August 29, 2025 8:41:36 AM To: pmodels/mpich @.> Cc: Hui Zhou @.>; Assign @.> Subject: Re: [pmodels/mpich] Build issue with NAG 7.1 and MPICH 4.3.0: non-interoperable type LOGICAL (Issue #7346)
mathomp4 left a comment (pmodels/mpich#7346) @hakostra Well huh. I build with: .. /configure CC=gcc CXX=g++ FC=nagfor MPICHLIB_FFLAGS=-mismatch -fpp MPICHLIB_FCFLAGS=-mismatch -fpp --enable-f08 CFLAGS=-I/ford1/share/gmao_SIteam/nag/7. 2. 36/lib/NAG_Fortran ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd [https://avatars.githubusercontent.com/u/2982494?s=20&v=4]mathomp4 left a comment (pmodels/mpich#7346)https://urldefense.us/v3/__https://github.com/pmodels/mpich/issues/7346*issuecomment-3237087990__;Iw!!G_uCfscf7eWS!cKzni3sUSgfsRgP72Wz-yvuwtvMAAlH8t0n4BveeYOt0TfXIMT-vpILdMqwOZd2uIJKmy018fDzFVCZfxshoCq8fvt0$
@hakostrahttps://urldefense.us/v3/__https://github.com/hakostra__;!!G_uCfscf7eWS!cKzni3sUSgfsRgP72Wz-yvuwtvMAAlH8t0n4BveeYOt0TfXIMT-vpILdMqwOZd2uIJKmy018fDzFVCZfxshoCyxuIbk$ Well huh. I build with:
../configure CC=gcc CXX=g++ FC=nagfor MPICHLIB_FFLAGS=-mismatch -fpp MPICHLIB_FCFLAGS=-mismatch -fpp --enable-f08 CFLAGS=-I/ford1/share/gmao_SIteam/nag/7.2.36/lib/NAG_Fortran --prefix=/ford1/share/gmao_SIteam/MPI/mpich/4.3.1/nag-7.2.36
How do you build? Maybe I have flags I don't need, or you have flags I do?
@ggouaillardethttps://urldefense.us/v3/__https://github.com/ggouaillardet__;!!G_uCfscf7eWS!cKzni3sUSgfsRgP72Wz-yvuwtvMAAlH8t0n4BveeYOt0TfXIMT-vpILdMqwOZd2uIJKmy018fDzFVCZfxshoC3GArcA$ (in Open MPI land) saidhttps://urldefense.us/v3/__https://github.com/open-mpi/ompi/issues/12413*issuecomment-2041302131__;Iw!!G_uCfscf7eWS!cKzni3sUSgfsRgP72Wz-yvuwtvMAAlH8t0n4BveeYOt0TfXIMT-vpILdMqwOZd2uIJKmy018fDzFVCZfxshobXK8jLk$:
So I finally found the issue. -pthread is pulled from the internal libevent library (I failed to see this because I was using my distro's libevent that did not provide the *.la files.
This does really apply to MPICH since no libevent anywhere in the configure scripts I can see!
— Reply to this email directly, view it on GitHubhttps://urldefense.us/v3/__https://github.com/pmodels/mpich/issues/7346*issuecomment-3237087990__;Iw!!G_uCfscf7eWS!cKzni3sUSgfsRgP72Wz-yvuwtvMAAlH8t0n4BveeYOt0TfXIMT-vpILdMqwOZd2uIJKmy018fDzFVCZfxshoCq8fvt0$, or unsubscribehttps://urldefense.us/v3/__https://github.com/notifications/unsubscribe-auth/AALNM7UR4U2MIXG4FIW6RLL3QBKBBAVCNFSM6AAAAABZGDLDF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMZXGA4DOOJZGA__;!!G_uCfscf7eWS!cKzni3sUSgfsRgP72Wz-yvuwtvMAAlH8t0n4BveeYOt0TfXIMT-vpILdMqwOZd2uIJKmy018fDzFVCZfxshoMxQjsGE$. You are receiving this because you were assigned.Message ID: @.***>
Libevent is pulled in by hwloc
Get Outlook for Android<aka.ms/AAb9ysg> …
Ahhh. And I see --with-hwloc=embedded! Time to do a test! 😄
Libevent is pulled in by hwloc
Actually, I probably was mistaken. I know pmix uses libevent. Libfabric may as well.
@mathomp4 Could you do a make clean then make -V > make.log and share the log file?
Good news: I can confirm that #7551 by @hzhou fixes the LOGICAL issue.
Bad news: --with-hwloc=embedded does not help my -pthread issue:
make[2]: Entering directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36'
/bin/sh ./libtool --tag=FC --mode=link nagfor -Isrc/binding/fortran/use_mpi -Isrc/binding/fortran/use_mpi_f08 -mismatch -fpp -O2 -version-info 17:1:5 -o lib/libmpifort.la -rpath /ford1/share/gmao_SIteam/MPI/mpich/4.3.1/nag-7.2.36/lib lib/libmpi.la lib/libf77_mpi.la lib/libf90_mpi.la lib/libf08_mpi.la
libtool: warning: '/ford1/local/gcc/gcc-12.1.0/lib64/libatomic.la' seems to be moved
libtool: link: nagfor -Wl,-shared -PIC -Wl,-Wl,,--whole-archive lib/.libs/libf77_mpi.a lib/.libs/libf90_mpi.a lib/.libs/libf08_mpi.a -Wl,-Wl,,--no-whole-archive -Wl,-Wl,,-rpath -Wl,-Wl,,/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36/lib/.libs -Wl,-Wl,,-rpath -Wl,-Wl,,/ford1/local/gcc/gcc-12.1.0/lib/../lib64 -Wl,-Wl,,-rpath -Wl,-Wl,,/ford1/share/gmao_SIteam/MPI/mpich/4.3.1/nag-7.2.36/lib -Wl,-Wl,,-rpath -Wl,-Wl,,/ford1/local/gcc/gcc-12.1.0/lib/../lib64 lib/.libs/libmpi.so -L/ford1/share/gmao_SIteam/MPI/mpich/4.3.1/nag-7.2.36/lib -L/ford1/local/gcc/gcc-12.1.0/lib64 -lm -ludev -lpciaccess -lrdmacm -lefa -lnl-3 -lnl-route-3 -libverbs -luuid -lnuma /ford1/local/gcc/gcc-12.1.0/lib/../lib64/libatomic.so -lpthread -ldl -lrt -mismatch -O2 -pthread -Wl,-Wl,,-soname -Wl,-Wl,,libmpifort.so.12 -o lib/.libs/libmpifort.so.12.5.1
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7236
Option error: Unrecognised option -pthread
make[2]: *** [Makefile:13010: lib/libmpifort.la] Error 2
make[2]: Leaving directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36'
make[1]: *** [Makefile:40263: all-recursive] Error 1
make[1]: Leaving directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.3.1/build-nag-7.2.36'
make: *** [Makefile:10489: all] Error 2
Thing is, that flag doesn't even appear in my config.log so I'm not sure it's mpich's fault, but it's being dragged in from elsewhere.
Maybe I should try clang+NAG?
Libevent is pulled in by hwloc
Actually, I probably was mistaken. I know
pmixuseslibevent. Libfabric may as well.@mathomp4 Could you do a
make cleanthenmake -V > make.logand share the log file?
@hzhou Will do, in a new issue! :)