We are having trouble compiling git.mumps with similar errors (using ifort 2017, yikes).
Could the forwarded patches be applied to petsc/pkg-mumps, please?

Thanks in advance (and sorry if this should be handled @petsc-maint),
Pierre

Begin forwarded message:

From: "Antonio Trande" ([email protected] via mumps-users Mailing List) <[email protected]>
Subject: [mumps-users] MUMPS MPI (5.2.1) does not compile
Date: 29 June 2019 at 5:56:28 PM CEST

Hi all.

MUMPS-5.2.1 is not compiling on Fedora 30 because of this error:

/usr/lib64/openmpi/bin/mpif77 -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-Dscotch -Dmetis -Dptscotch -pthread -I/usr/lib64/gfortran/modules
-Dintel_ -Wno-unused-dummy-argument -Wno-maybe-uninitialized
-I/usr/include/openmpi-x86_64 -I/usr/include/openblas
-I/usr/include/openmpi-x86_64 -Dpord -I. -I../include -fPIC -c
cmumps_save_restore.F -o cmumps_save_restore.o
cmumps_save_restore.F:8105:50:

8105 |                IF(associated(id%MPITOOMP_PROCS_MAP)) THEN
     |                                                  1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8108:49:

8108 |      &                 size(id%MPITOOMP_PROCS_MAP,1)*SIZE_INT
     |                                                 1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8113:72:

8113 |             elseif(trim(mode).EQ."save") then
     |
      1
Error: Unexpected ELSE IF statement at (1)
cmumps_save_restore.F:8114:50:

8114 |                IF(associated(id%MPITOOMP_PROCS_MAP)) THEN
     |                                                  1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8115:67:

8115 |                   write(unit,iostat=err)
size(id%MPITOOMP_PROCS_MAP,1)
     |                                                                   1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8124:62:

8124 |                   write(unit,iostat=err) id%MPITOOMP_PROCS_MAP
     |                                                              1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8125:72:

8125 |                ELSE
     |
      1
Error: Unexpected ELSE statement at (1)
cmumps_save_restore.F:8136:18:

8136 |                ENDIF
     |                  1
Error: Expecting END SELECT statement at (1)
cmumps_save_restore.F:8145:72:

8145 |             elseif(trim(mode).EQ."restore") then
     |
      1
Error: Unexpected ELSE IF statement at (1)
cmumps_save_restore.F:8146:44:

8146 |                nullify(id%MPITOOMP_PROCS_MAP)
     |                                            1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8163:48:

8163 |                   allocate(id%MPITOOMP_PROCS_MAP(size_array1),
     |                                                1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8171:61:

8171 |                   read(unit,iostat=err) id%MPITOOMP_PROCS_MAP
     |                                                             1
Error: 'mpitoomp_procs_map' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8184:15:

8184 |             endif
     |               1
Error: Expecting END SELECT statement at (1)
cmumps_save_restore.F:8188:64:

8188 |                SIZE_VARIABLES(i1)=SIZE_INT*size(id%METIS_OPTIONS,1)
     |                                                                1
Error: 'metis_options' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8190:54:

8190 |                write(unit,iostat=err) id%METIS_OPTIONS
     |                                                      1
Error: 'metis_options' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8200:64:

8200 |                SIZE_VARIABLES(i1)=SIZE_INT*size(id%METIS_OPTIONS,1)
     |                                                                1
Error: 'metis_options' at (1) is not a member of the 'cmumps_struc'
structure
cmumps_save_restore.F:8201:53:

8201 |                read(unit,iostat=err) id%METIS_OPTIONS
     |                                                     1
Error: 'metis_options' at (1) is not a member of the 'cmumps_struc'
structure
make[3]: *** [Makefile:396: cmumps_save_restore.o] Error 1

I'm patching MUMPS for compiling shared libraries for Fedora. I'm
attaching the patch used.

--
---
Antonio Trande
Fedora Project
mailto 'sagitter at fedoraproject dot org'
GPG key: 0x6e0331dd1699e4d7
GPG key server: https://keys.fedoraproject.org/
Set flags according to the Make.seq.inc file

Index: mumps/examples/Makefile
===================================================================
--- mumps.orig/examples/Makefile
+++ mumps/examples/Makefile
@@ -27,28 +27,28 @@
 LIBSMUMPS = $(libdir)/libsmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
 
 ssimpletest:  $(LIBSMUMPS)  [email protected]
-	$(FL) -o $@ $(OPTL) ssimpletest.o  $(LIBSMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+	$(FL) -o $@ $(OPTL) ssimpletest.o  $(LIBSMUMPS) $(LORDERINGS) $(LIBS) $(MUMPS_LIBF77) $(LIBBLAS) $(LIBOTHERS)
 
 
 LIBDMUMPS = $(libdir)/libdmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
 
 dsimpletest: $(LIBDMUMPS)  [email protected] 
-	$(FL) -o $@ $(OPTL) dsimpletest.o  $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+	$(FL) -o $@ $(OPTL) dsimpletest.o  $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(MUMPS_LIBF77) $(LIBBLAS) $(LIBOTHERS)
 
 
 LIBCMUMPS = $(libdir)/libcmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
 
 csimpletest: $(LIBCMUMPS)  [email protected]
-	$(FL) -o $@ $(OPTL) csimpletest.o  $(LIBCMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+	$(FL) -o $@ $(OPTL) csimpletest.o  $(LIBCMUMPS) $(LORDERINGS) $(LIBS) $(MUMPS_LIBF77) $(LIBBLAS) $(LIBOTHERS)
 
 
 LIBZMUMPS = $(libdir)/libzmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
 
 zsimpletest: $(LIBZMUMPS)  [email protected]
-	$(FL) -o $@ $(OPTL) zsimpletest.o  $(LIBZMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+	$(FL) -o $@ $(OPTL) zsimpletest.o  $(LIBZMUMPS) $(LORDERINGS) $(LIBS) $(MUMPS_LIBF77) $(LIBBLAS) $(LIBOTHERS)
 
 c_example:	$(LIBDMUMPS) [email protected]
-	$(FL) -o $@ $(OPTL) [email protected] $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+	$(FL) -o $@ $(OPTL) [email protected] $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(MUMPS_LIBF77) $(LIBBLAS) $(LIBOTHERS)
 
 
 multiple_arithmetics_example:	$(LIBSMUMPS) $(LIBDMUMPS) $(LIBCMUMPS) $(LIBZMUMPS) [email protected]
##
##  This file derives by that original in MUMPS 4.10.0.
##  Adapted by Antonio Trande from Make.inc/Makefile.gfortran.PAR for RPM 
packaging for Fedora.
##

#Begin orderings

# NOTE that PORD is distributed within MUMPS by default. If you would like to
# use other orderings, you need to obtain the corresponding package and modify
# the variables below accordingly.
# For example, to have Metis available within MUMPS:
#          1/ download Metis and compile it
#          2/ uncomment (suppress # in first column) lines
#             starting with LMETISDIR,  LMETIS
#          3/ add -Dmetis in line ORDERINGSF
#             ORDERINGSF  = -Dpord -Dmetis
#          4/ Compile and install MUMPS
#             make clean; make   (to clean up previous installation)
#
#          Metis/ParMetis and SCOTCH/PT-SCOTCH (ver 5.1 and later) orderings 
are now available for MUMPS.
#

SCOTCHDIR  = /usr
#ISCOTCH    = -I$(SCOTCHDIR)/include 
# You have to choose one among the following two lines depending on
# the type of analysis you want to perform. If you want to perform only
# sequential analysis choose the first (remember to add -Dscotch in the 
ORDERINGSF
# variable below); for both parallel and sequential analysis choose the second 
# line (remember to add -Dptscotch in the ORDERINGSF variable below)

LSCOTCH    = -L$(SCOTCHDIR)/lib -lesmumps -lscotch -lscotcherr
LSCOTCH    = -L$(SCOTCHDIR)/lib -lptesmumps -lptscotch -lptscotcherr


LPORDDIR = $(topdir)/PORD/lib/
IPORD    = -I$(topdir)/PORD/include/
LPORD    = -L$(LPORDDIR) -lpord$(PLAT)

#LMETISDIR = /local/metis/
#IMETIS    = # Metis doesn't need include files (Fortran interface avail.)

# You have to choose one among the following two lines depending on
# the type of analysis you want to perform. If you want to perform only
# sequential analysis choose the first (remember to add -Dmetis in the 
ORDERINGSF
# variable below); for both parallel and sequential analysis choose the second 
# line (remember to add -Dparmetis in the ORDERINGSF variable below)

LMETIS    = -L$(LMETISDIR) -lmetis
#LMETIS    = -L$(LMETISDIR) -lparmetis -lmetis

# The following variables will be used in the compilation process.
# Please note that -Dptscotch and -Dparmetis imply -Dscotch and -Dmetis 
respectively.
#ORDERINGSF = -Dscotch -Dmetis -Dpord -Dptscotch -Dparmetis
ORDERINGSF  = -Dpord
ORDERINGSC  = $(ORDERINGSF)

LORDERINGS = $(LMETIS) $(LPORD) $(LSCOTCH)
IORDERINGSF = $(ISCOTCH)
IORDERINGSC = $(IMETIS) $(IPORD) $(ISCOTCH)

#End orderings
########################################################################
################################################################################

PLAT    =
LIBEXT  = .so
OUTC    = -o 
OUTF    = -o 
RM = /bin/rm -f
CC = gcc
FC = gfortran
FL = gfortran
AR = ar vr
#RANLIB = ranlib
RANLIB  = echo
SCALAP  = -lscalapack -lmpiblacs
#INCPAR = -I/usr/local/include
INCPAR = $(MUMPS_INCDIR)
#LIBPAR = $(SCALAP)  -L/usr/local/lib/ -llammpio -llamf77mpi -lmpi -llam -lutil 
-ldl -lpthread
MPIFLIB = @@MPIFORTRANLIB@@
MPICLIB = @@MPICLIB@@
METISLIB = -lmetis
LIBPAR = $(SCALAP) $(MPIFLIB) 
# See point 17 in the FAQ to have more details on the compilation of mpich with 
gfortran
INCSEQ = -I$(topdir)/libseq
LIBSEQ  =  -L$(topdir)/libseq -lmpiseq$(PLAT)
#LIBBLAS = -L/usr/lib/xmm/ -lf77blas -latlas
#LIBBLAS = -lblas
LIBOTHERS = -lpthread
#Preprocessor defs for calling Fortran from C (-DAdd_ or -DAdd__ or -DUPPER)
CDEFS   = -DAdd_

#Begin Optimized options
OPTF    = @@CFLAGS@@ -Dintel_ -Wno-unused-dummy-argument 
-Wno-maybe-uninitialized
OPTL    = @@-O@@
OPTC    = @@CFLAGS@@
#End Optimized options
INCS = $(INCPAR)
#LIB = $(LIBPAR)
LIBSEQNEEDED =
Create a shared version of the MUMPS library.

Index: mumps/src/Makefile
===================================================================
--- mumps.orig/src/Makefile
+++ mumps/src/Makefile
@@ -23,8 +23,10 @@
 
 include $(topdir)/Makefile.inc
 
-mumps_lib:    $(libdir)/libmumps_common$(PLAT)$(LIBEXT) \
-              $(libdir)/lib$(ARITH)mumps$(PLAT)$(LIBEXT)
+mumps_lib:    $(libdir)/libmumps_common$(PLAT).a \
+              $(libdir)/libmumps_common$(PLAT).so \
+              $(libdir)/lib$(ARITH)mumps$(PLAT).a \
+              $(libdir)/lib$(ARITH)mumps$(PLAT).so
 
 OBJS_COMMON_MOD = \
         ana_omp_m.o\
@@ -177,14 +179,23 @@
         $(ARITH)tools.o\
         $(ARITH)type3_root.o
 
-$(libdir)/libmumps_common$(PLAT)$(LIBEXT):      $(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
-	$(AR)$@ $?
+$(libdir)/libmumps_common$(PLAT).a:      $(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
+	$(AR) $@ $?
 	$(RANLIB) $@
 
-$(libdir)/lib$(ARITH)mumps$(PLAT)$(LIBEXT):    $(OBJS_MOD) $(OBJS_OTHER)
-	$(AR)$@ $?
+$(libdir)/libmumps_common$(PLAT).so:	$(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
+	$(FC) -shared $^ -Wl,-soname,libmumps_common$(PLAT)-$(SONAME_VERSION).so $(OPTL) -L$(libdir) $(LORDERINGS) -lpthread $(MUMPS_LIBF77) $(MPIFLIB) $(MPICLIB) $(METISLIB) -o $(libdir)/libmumps_common$(PLAT)-$(SONAME_VERSION).so $(OPTL) -Wl,-z,defs
+	ln -fs libmumps_common$(PLAT)-$(SONAME_VERSION).so $@
+
+$(libdir)/lib$(ARITH)mumps$(PLAT).a:    $(OBJS_MOD) $(OBJS_OTHER)
+	$(AR) $@ $?
 	$(RANLIB) $@
 
+$(libdir)/lib$(ARITH)mumps$(PLAT).so:    $(OBJS_MOD) $(OBJS_OTHER)
+	$(FC) -shared $^ -Wl,-soname,lib$(ARITH)mumps$(PLAT)-$(SONAME_VERSION).so $(OPTL) -L$(libdir) -lmumps_common$(PLAT) $(MUMPS_LIBF77) $(LORDERINGS) $(MPIFLIB) $(METISLIB) $(SCALAP) -o $(libdir)/lib$(ARITH)mumps$(PLAT)-$(SONAME_VERSION).so $(OPTL) -Wl,-z,defs
+	ln -fs lib$(ARITH)mumps$(PLAT)-$(SONAME_VERSION).so $@
+
+
 # Dependencies between modules:
 # i) arithmetic-dependent modules:
 $(ARITH)ana_aux.o:              $(ARITH)mumps_struc_def.o \
@@ -382,13 +393,13 @@
 
 .SUFFIXES: .c .F .o
 .F.o:
-	$(FC) $(OPTF) $(INCS) $(IORDERINGSF) $(ORDERINGSF) -I. -I../include -c $*.F $(OUTF)$*.o
+	$(FC) $(OPTF) $(INCS) $(IORDERINGSF) $(ORDERINGSF) -I. -I../include -fPIC -c $*.F $(OUTF)$*.o
 .c.o:
-	$(CC) $(OPTC) $(INCS) -I../include $(CDEFS) $(IORDERINGSC) $(ORDERINGSC) -c $*.c $(OUTC)$*.o
+	$(CC) $(OPTC) $(INCS) -I../include $(CDEFS) $(IORDERINGSC) $(ORDERINGSC) -fPIC -c $*.c $(OUTC)$*.o
 
 $(ARITH)mumps_c.o:	mumps_c.c
 	$(CC) $(OPTC) $(INCS) $(CDEFS) -DMUMPS_ARITH=MUMPS_ARITH_$(ARITH) \
-	      $(IORDERINGSC) $(ORDERINGSC) -I../include -c mumps_c.c $(OUTC)$@
+	      $(IORDERINGSC) $(ORDERINGSC) -I../include -fPIC -c mumps_c.c $(OUTC)$@
 
 clean:
 	$(RM) *.o *.mod
Create static and shared versions of the PORD library.

Index: mumps/PORD/lib/Makefile
===================================================================
--- mumps.orig/PORD/lib/Makefile
+++ mumps/PORD/lib/Makefile
@@ -9,7 +9,7 @@
 
 INCLUDES = -I../include
 
-COPTIONS = $(INCLUDES) $(CFLAGS) $(OPTFLAGS)
+COPTIONS = $(INCLUDES) $(CFLAGS) $(OPTFLAGS) -fPIC
 
 OBJS = graph.o gbipart.o gbisect.o ddcreate.o ddbisect.o nestdiss.o \
        multisector.o gelim.o bucket.o tree.o \
@@ -24,12 +24,16 @@
 .c.o:
 	$(CC) $(COPTIONS) -c $*.c $(OUTC)$*.o
 
-libpord$(LIBEXT):$(OBJS)
-	$(AR)$@ $(OBJS)
+libpord$(PLAT).a:$(OBJS)
+	$(AR) $@ $(OBJS)
 	$(RANLIB) $@
 
+libpord$(PLAT).so: $(OBJS)
+	$(CC) -shared $(OBJS) -Wl,-soname,libpord$(PLAT)-$(SONAME_VERSION).so -o libpord$(PLAT)-$(SONAME_VERSION).so $(OPTL) -Wl,-z,defs
+	ln -fs libpord$(PLAT)-$(SONAME_VERSION).so $@
+
 clean:
 	rm -f *.o
 
 realclean:
-	rm -f *.o libpord.a
+	rm -f *.o libpord*.a *.so
Index: mumps/Makefile
===================================================================
--- mumps.orig/Makefile
+++ mumps/Makefile
@@ -54,7 +54,7 @@
 multi_example:	s d c z
 	(cd examples ; $(MAKE) multi)
 
-requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT)$(LIBEXT)
+requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT).a $(libdir)/libpord$(PLAT).so
 
 # dummy MPI library (sequential version)
 
@@ -62,19 +62,26 @@
 	(cd libseq; $(MAKE))
 
 # Build the libpord.a library and copy it into $(topdir)/lib
-$(libdir)/libpord$(PLAT)$(LIBEXT):
+$(libdir)/libpord$(PLAT).a:
 	if [ "$(LPORDDIR)" != "" ] ; then \
 	  cd $(LPORDDIR); \
 	  $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT); \
 	fi;
 	if [ "$(LPORDDIR)" != "" ] ; then \
-	  cp $(LPORDDIR)/libpord$(LIBEXT) $@; \
+	  cp $(LPORDDIR)/libpord$(PLAT).a $@; \
 	fi;
 
+$(libdir)/libpord$(PLAT).so:
+	if [ "$(LPORDDIR)" != "" ] ; then \
+	cd $(LPORDDIR); make CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" ARFUNCT= RANLIB="$(RANLIB)" libpord$(PLAT).so; fi;
+	if [ "$(LPORDDIR)" != "" ] ; then \
+	cp -a $(LPORDDIR)/libpord*.so lib/; fi;
+
+
 clean:
 	(cd src; $(MAKE) clean)
 	(cd examples; $(MAKE) clean)
-	(cd $(libdir); $(RM) *$(PLAT)$(LIBEXT))
+	(cd $(libdir); $(RM) *$(PLAT).a *$(PLAT).so)
 	(cd libseq; $(MAKE) clean)
 	if [ "$(LPORDDIR)" != "" ] ; then \
 	  cd $(LPORDDIR); $(MAKE) realclean; \

Reply via email to