<div dir="ltr"><div>Of course my scetch was missing the line<br></div>set(flaglist ${SUPPORTED_FLAGS})<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 1, 2015 at 11:21 PM, Dominic Kempf <span dir="ltr"><<a href="mailto:dominic.r.kempf@gmail.com" target="_blank">dominic.r.kempf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hey Carsten,<br><br></div>that sounds much like an Ubuntu bug to me.<br><br></div>It might not be very nice, but you could write a cmake macro, that restricts a given set of compiler flags to the set of flags accepted by the compiler:<br><br></div><div>Untested scetch:<br></div>macro(discarded_unsupported_flags flaglist)<br></div><div> set(SUPPORTED_FLAGS)<br></div><div> foreach(flag ${flaglist})<br></div><div> execute_command(COMMAND ${CMAKE_CXX_COMPILER} ${flag} dummy.cc RESULT_VARIABLE return_value)<br></div><div> if(return_value STREQUAL "0")<br></div><div> list(APPEND SUPPORTED_FLAGS ${flag})<br></div><div> endif()<br></div><div> endforeach()<br></div>endmacro()<br><br></div>Unfortunately, I have no better idea.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Dominic<br></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Jul 1, 2015 at 10:20 PM, Carsten Gräser <span dir="ltr"><<a href="mailto:graeser@mi.fu-berlin.de" target="_blank">graeser@mi.fu-berlin.de</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div><div>Am 01.07.2015 um 15:50 schrieb Carsten Gräser:<br>
> Am 01.07.2015 um 15:40 schrieb Jö Fahlke:<br>
>> Am Wed, 1. Jul 2015, 15:35:12 +0200 schrieb Carsten Gräser:<br>
>>> Date: Wed, 01 Jul 2015 15:35:12 +0200<br>
>>> From: Carsten Gräser <<a href="mailto:graeser@mi.fu-berlin.de" target="_blank">graeser@mi.fu-berlin.de</a>><br>
>>> To: "<a href="mailto:dune-devel@dune-project.org" target="_blank">dune-devel@dune-project.org</a>" <<a href="mailto:dune-devel@dune-project.org" target="_blank">dune-devel@dune-project.org</a>><br>
>>> Subject: Re: [Dune-devel] Building dune-common with gcc-4.8 fails<br>
>>><br>
>>> Hi Jö,<br>
>><br>
>>> CMakeCache shows that this flag is also present in MPI_CXX_COMPILE_FLAGS<br>
>>> and MPI_C_COMPILE_FLAGS.<br>
>><br>
>> In your other Mail you bisected the problem to the patch that enabled mpi by<br>
>> default in cmake. So this sounds very mpi-related. Maybe that flag is<br>
>> extracted from mpicc? And you don't have a problem before the patch because<br>
>> dune-common did not look for mpi then, but is doing it now?<br>
>><br>
>> Which MPI are you using?<br>
> It's mpich-3.1.<br>
><br>
> I also noticed that passing the compiler to mpic++ via -cxx preserves<br>
> this -fstack-protector-strong option which seems to be the ubuntu default.<br>
<br>
</div></div>I guess I've found the origin of the problem, but I don't now<br>
who's to blame and how to fix this: Recent Ubuntu decided to enable<br>
<br>
-D_FORTIFY_SOURCE=2 -fstack-protector-strong<br>
<br>
by default for security reasons. This also seems to imply that these<br>
flags are by default used with the mpi compiler wrappers, at least<br>
according to<br>
<br>
mpicxx -show<br>
<br>
Not surprisingly the cmake module FindMPI detects these flags and<br>
stores them in MPI_C_COMPILER_FLAGS which we forwarded to<br>
MPI_DUNE_COMPILE_FLAGS and thus use when building dune<br>
applications with mpi. The problem is that the second flag is<br>
not supported with gcc versions < 4.9, but the flag is always passed.<br>
It's a little unclear, who is to blame for this problem:<br>
<br>
a)Dune is blindly passing the mpi compile flags regardless of the<br>
selected compiler.<br>
<br>
b)FindMPI does not allow to pass a compiler in order to detect<br>
suitable flags.<br>
<br>
c)Even "mpicc -cc=/usr/bin/gcc-4.8" does not provide suitable flags.<br>
<br>
d)Is it a ubuntu bug to always provide these flags with mpi,<br>
regardless of the compiler?<br>
<br>
I'd like to at least circumvent the problem to be able to test<br>
with all my compilers, but it seems that one cannot overwrite<br>
the MPI_C_COMPILER_FLAGS with a command line argument.<br>
For now I have to manually remove the flag in the cache<br>
if I want to test with a packaged but older compiler. Does<br>
anybody more familiar with mpi and cmake now a better way<br>
to get around this?<br>
<br>
Best,<br>
Carsten<br>
<br>
<br>
<br></div></div><span class="">_______________________________________________<br>
Dune-devel mailing list<br>
<a href="mailto:Dune-devel@dune-project.org" target="_blank">Dune-devel@dune-project.org</a><br>
<a href="http://lists.dune-project.org/mailman/listinfo/dune-devel" rel="noreferrer" target="_blank">http://lists.dune-project.org/mailman/listinfo/dune-devel</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>