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

Dominic Kempf dominic.r.kempf at gmail.com
Wed Jul 1 23:25:25 CEST 2015


Of course my scetch was missing the line
set(flaglist ${SUPPORTED_FLAGS})

On Wed, Jul 1, 2015 at 11:21 PM, Dominic Kempf <dominic.r.kempf at gmail.com>
wrote:

> Hey Carsten,
>
> that sounds much like an Ubuntu bug to me.
>
> 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:
>
> Untested scetch:
> macro(discarded_unsupported_flags flaglist)
>   set(SUPPORTED_FLAGS)
>   foreach(flag ${flaglist})
>     execute_command(COMMAND ${CMAKE_CXX_COMPILER} ${flag} dummy.cc
> RESULT_VARIABLE return_value)
>     if(return_value STREQUAL "0")
>       list(APPEND SUPPORTED_FLAGS ${flag})
>     endif()
>   endforeach()
> endmacro()
>
> Unfortunately, I have no better idea.
>
> Dominic
>
> On Wed, Jul 1, 2015 at 10:20 PM, Carsten Gräser <graeser at mi.fu-berlin.de>
> wrote:
>
>> 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
>>
>>
>>
>> _______________________________________________
>> Dune-devel mailing list
>> Dune-devel at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-devel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20150701/e46f2c79/attachment.html>


More information about the Dune-devel mailing list