[petsc-dev] Possible error running C/C++ src/snes/examples/tutorials/ex19 with 1 MPI process

Satish Balay balay at mcs.anl.gov
Wed Oct 12 12:21:17 CDT 2016


On Wed, 12 Oct 2016, Antonio Trande wrote:

> On 10/11/2016 11:52 PM, Antonio Trande wrote:
> > On 10/11/2016 09:39 PM, Satish Balay wrote:
> >> On Tue, 11 Oct 2016, Antonio Trande wrote:
> >>
> >>> 'configure' does not recognize '-D_FORTIFY_SOURCE=2' flag (it says that
> >>> should be -D-FORTIFY-SOURCE=2) that comes from default flags used on
> >>> Fedora and automatically set when package is built. I'm forced to
> >>> exclude it with 'configure' and re-introduce it with 'make'.
> >>> This is the reason because flags are set more times.
> >>> It's good if you can fix this problem with 'configure'.
> >>
> >> I suspect thats hapenning because you are missing quotes for CFLAGS=""
> >> [as mentioned earlier] - so configure it treating -D_FORTIFY_SOURCE=2
> >> as an argument to configure - and not as the text inside CFLAGS argument.
> >>
> >> Satish
> > 
> > You're right.
> > I'm fixing all settings of compiler flags.
> > 
> 
> Is there a quick way to override compiler/linker flags in 'make test'?
> I guess some flags could prevent running tests properly (there is no
> errors when i use flags for debugging).

Its possible [by overriding stuff in PCC_FLAGS, PCC_LINKER_FLAGS etc -
from PETSC_ARCH/lib/conf/petscvariables] But the error is comingfroma
function in the petsc library [when it calls MPI] - so I'm not sure if
that would make a difference.

> 
> Latest builds:
> http://copr-fe.cloud.fedoraproject.org/coprs/sagitter/petsc/build/464373/

I've mentioned this a few times - You haven't been able to run the sequntial test in valgrind?

I'll try and see if I can reproduce this.. [in a 32bit VM]..


Before doing further builds - perhaps you can clean up the configure options a bit more.
https://copr-be.cloud.fedoraproject.org/results/sagitter/petsc/fedora-rawhide-i386/00464373-petsc/build.log.gz

>>>>>>>>>>

+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ COPTFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ CXXOPTFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ FOPTFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ export FFLAGS
+ FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ export FCFLAGS
+ LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
+ export LDFLAGS
<<<<<<<<<<<

remove all these env flags. PETSc Configure does not process env flags..


./configure

--build=i686-redhat-linux-gnu
--host=i686-redhat-linux-gnu
--program-prefix=
--disable-dependency-tracking
--prefix=/usr
--exec-prefix=/usr
--bindir=/usr/bin
--sbindir=/usr/sbin
--sysconfdir=/etc
--datadir=/usr/share
--includedir=/usr/include
--libdir=/usr/lib
--libexecdir=/usr/libexec
--localstatedir=/var
--sharedstatedir=/var/lib
--mandir=/usr/share/man
--infodir=/usr/share/info

#[I understand some of the options are used by rpmbuild - which you can't eliminate]
# Except for --prefix - none of the above options are used.

'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
'FCFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
'FFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
'LDFLAGS=-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
'COPTFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
'CXXOPTFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
'FOPTFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'

# I would remove duplicate options from COPTFLAGS, FOPTFLAGS CXXOPTFLAGS [they just make the compile lines longer - and harder to read. i.e specify them as: COPTFLAGS= FOPTFLAGS= CXXOPTFLAGS=

--with-default-arch=0
--with-make=1
--with-single-library=1
--enable-shared=1

# --enable-shared is ignored - but --with-shared-libraries from below is used.

--with-precision=double
--with-index-size=32

# --with-index-size is ignored

--with-petsc-arch=i386
--with-clanguage=C
--with-shared-libraries=1
--with-64-bit-indices=0
--with-fortran-interfaces=1
--with-windows-graphics=0
--CC=gcc
--FC=gfortran
--with-gnu-compilers=1
--with-vendor-compilers=0

# you are missing 'CXX=g++' - but then --with-gnu-compilers=1 is guessing and compensating. I would remove --with-gnu-compilers --with-vendor-compilers - and just list all compilers [CC, FC, CXX].

--with-shared-ld=ld
--with-pic=1
--with-clib-autodetect=0
--with-fortranlib-autodetect=0
--with-threadsafety=0
--with-log=1
--with-cxxlib-autodetect=0
--with-debugging=0
'--with-blas-lapack-lib=-L/usr/lib -lopenblas'

# I would remove -L/usr/lib from everywhere..

--known-64-bit-blas-indices=0
--with-fc=gfortran

This is a duplicate for 'FC' - and would remove it. [i.e use CC, CXX, FC collectively - or use --with-cc, --with-cxx, --with-fc]

--with-mpiuni-fortran-binding=1
--with-mpi=0
--with-x=1
--with-openmp=0
--with-metis=0
--with-hwloc=0
--with-ssl=0
--with-pthread=1
--with-valgrind=1

Satish



More information about the petsc-dev mailing list