* Christoph Junghans:
I am trying to rebuild espresso to adapt to the recent cmake
changes,
when doing this I hit
https://github.com/espressomd/espresso/issues/3396, which prevents us
from compiling espresso with -lto, so I set _lto_cflags to %{nil},
which works for the build with openmpi, but gets ignored for the mpich
build.
I think the problem is that CMake picks up the lto flags from mpicxx
and then puts them in
MPI_CXX_COMPILE_OPTIONS. (Also compare mpicc -show).
So I think the fix would be to strip these flags from mpicc. Sounds
reasonable?
I think this could be an application for the extension_*flags macros in
redhat-rpm-config:
# Internal-only. Do not use. Expand a variable and strip the flags
# not suitable to extension builders.
%__extension_strip_flags() %{lua:
local name = rpm.expand("%{1}")
local value = " " .. rpm.expand("%{build_" .. name .. "}")
local result = string.gsub(value, "%s+-specs=[^%s]+", " ")
print(result)
}
# Variants of CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS for use within
# extension builders.
%extension_cflags %{__extension_strip_flags cflags}
%extension_cxxflags %{__extension_strip_flags cxxflags}
%extension_fflags %{__extension_strip_flags fflags}
%extension_ldflags %{__extension_strip_flags ldflags}
These were intended for scenarios where the flags are hard-coded into
other tools at build time. It's unfortunately rather difficult to
decide what should go into those flags.
Ideally, tools like mpicc would use a more dynamic approach to determine
the proper flags.
Thanks,
Florian