[Dune-devel] Building dune-common with gcc-4.8 fails

Carsten Gräser graeser at mi.fu-berlin.de
Wed Jul 1 22:20:57 CEST 2015


Am 01.07.2015 um 15:50 schrieb Carsten Gräser:
> Am 01.07.2015 um 15:40 schrieb Jö Fahlke:
>> Am Wed,  1. Jul 2015, 15:35:12 +0200 schrieb Carsten Gräser:
>>> Date: Wed, 01 Jul 2015 15:35:12 +0200
>>> From: Carsten Gräser <graeser at mi.fu-berlin.de>
>>> To: "dune-devel at dune-project.org" <dune-devel at dune-project.org>
>>> Subject: Re: [Dune-devel] Building dune-common with gcc-4.8 fails
>>>
>>> Hi Jö,
>>
>>> CMakeCache shows that this flag is also present in MPI_CXX_COMPILE_FLAGS
>>> and MPI_C_COMPILE_FLAGS.
>>
>> In your other Mail you bisected the problem to the patch that enabled mpi by
>> default in cmake.  So this sounds very mpi-related.  Maybe that flag is
>> extracted from mpicc?  And you don't have a problem before the patch because
>> dune-common did not look for mpi then, but is doing it now?
>>
>> Which MPI are you using?
> It's mpich-3.1.
> 
> I also noticed that passing the compiler to mpic++ via -cxx preserves
> this -fstack-protector-strong option which seems to be the ubuntu default.

I guess I've found the origin of the problem, but I don't now
who's to blame and how to fix this: Recent Ubuntu decided to enable

  -D_FORTIFY_SOURCE=2  -fstack-protector-strong

by default for security reasons. This also seems to imply that these
flags are by default used with the mpi compiler wrappers, at least
according to

  mpicxx -show

Not surprisingly the cmake module FindMPI detects these flags and
stores them in MPI_C_COMPILER_FLAGS which we forwarded to
MPI_DUNE_COMPILE_FLAGS and thus use when building dune
applications with mpi. The problem is that the second flag is
not supported with gcc versions < 4.9, but the flag is always passed.
It's a little unclear, who is to blame for this problem:

a)Dune is blindly passing the mpi compile flags regardless of the
  selected compiler.

b)FindMPI does not allow to pass a compiler in order to detect
  suitable flags.

c)Even "mpicc -cc=/usr/bin/gcc-4.8" does not provide suitable flags.

d)Is it a ubuntu bug to always provide these flags with mpi,
  regardless of the compiler?

I'd like to at least circumvent the problem to be able to test
with all my compilers, but it seems that one cannot overwrite
the MPI_C_COMPILER_FLAGS with a command line argument.
For now I have to manually remove the flag in the cache
if I want to test with a packaged but older compiler. Does
anybody more familiar with mpi and cmake now a better way
to get around this?

Best,
Carsten


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20150701/869feec4/attachment.sig>


More information about the Dune-devel mailing list