Remove command line option from the gfortran wrapper

The gildas package fails to build on Hydra x86_64-darwin because the log file size exceeds the maximum allowed size. This is because the gfortran wrapper on Darwin adds a number of command line options which are passed along to clang:

gfortran -c   -fimplicit-none -Wuninitialized -Wunused-variable -Wunused-label   -I./ -I./built/x86_64-darwin-gfortran-openmp -I/private/tmp/nix-build-gildas-20180801_a.drv-0/gildas-src-aug18a/integ/x86_64-darwin-gfortran-openmp/include -Wrealloc-lhs-all -J./built/x86_64-darwin-gfortran-openmp -pipe -fno-backslash -fno-range-check -fno-second-underscore -fPIC -fopenmp -O built/x86_64-darwin-gfortran-openmp/newdat.f90 -o built/x86_64-darwin-gfortran-openmp/newdat.o
clang-5.0: warning: argument unused during compilation: '-D _FORTIFY_SOURCE=2' [-Wunused-command-line-argument]
clang-5.0: warning: argument unused during compilation: '-fstack-protector-strong' [-Wunused-command-line-argument]
clang-5.0: warning: argument unused during compilation: '--param ssp-buffer-size=4' [-Wunused-command-line-argument]
clang-5.0: warning: argument unused during compilation: '-fno-strict-overflow' [-Wunused-command-line-argument]
[...]

How can I remove the -Wunused-command-line-argument option when building on Darwin?

I’ve just opened an issue on GitHub.

Something like this is usually the correct solution, since these issues generally depend on the compiler being used. Clang is a bit stricter about a bunch of stuff compared to gcc.

stdenv.mkDerivation {
  # ...
  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang
    "-Wno-unused-command-line-argument";
}
1 Like