Skip to content

Compiler flags not being passed into some packages' builds #6640

@junkudo

Description

@junkudo

Expected Result

I think my compiler flags should be being passed into my packages and used when compiling.
If I specify:

spack install zlib@1.2.11%intel@16.0.3 cflags="-g -O0" cppflags="-g -O0" cxxflags="-g -O0" fflags="-g -O0" +optimize+pic+shared arch=linux-rhel7-x86_64`

I then expect the compiler to use -g -O0.

Actual Result

Compilers flags are being ignored by multiple packages and instead developer specified flags are being used.
For the same example , zlib, I specifically see in the build:

icc -fPIC -O2 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c

I see similar issues for ...

hypre:

Spack command:

spack install hypre@2.12.1%intel@16.0.3 cflags="-g -O0" cppflags="-g -O0" cxxflags="-g -O0" fflags="-g -O0" ~int64+internal-superlu+mpi+shared arch=linux-rhel7-x86_64

Build snippet:

...
mpicc -O -fPIC -DHAVE_CONFIG_H -I.. -I./.. -I.    -c amg_linklist.c
...

metis:

Spack command:

spack install metis@4.0.3%intel@16.0.3 cflags="-g -O0" cppflags="-g -O0" cxxflags="-g -O0" fflags="-g -O0" ~debug~gdb~int64~real64+shared arch=linux-rhel7-x86_64

Build snippet:

...
cc -fPIC -O2  -I. -c coarsen.c
...

mfem

Spack command:

spack install mfem@3.3.2%intel@16.0.3 cflags="-g -O0" cppflags="-g -O0" cxxflags="-g -O0" fflags="-g -O0" debug~examples~gzstream+hypre+lapack~miniapps~mpfr+mpi+netcdf~openmp~petsc~suite-sparse~sundials~superlu-dist~threadsafe arch=linux-rhel7-x86_64

Build snippet:

...
mpicxx  -O3 -I/g/g14/kudo4/spack/opt/spack/linux-rhel7-x86_64/intel-16.0.3/hypre-2.12.1-y2lc4zfkpphjqgdhcohvj4635ekm7qzg/include -I/g/g14/kudo4/spack/opt/spack/linux-rhel7-x86_\
   64/intel-16.0.3/metis-4.0.3-sacetyhy56rhqu6ggx3hzjfcwsaxs5t3/include -I/usr/lib64/include -I/g/g14/kudo4/spack/opt/spack/linux-rhel7-x86_64/intel-16.0.3/netcdf-4.4.1.1-uwmi56bi2mqzpklohtfclty6rkipuhc7/include  -c general/optparser.cp\
   p -o general/optparser.o
...

mumps

Spack command:

spack install mumps@5.1.1%intel@16.0.3 cflags="-g -O0" cppflags="-g -O0" cxxflags="-g -O0" fflags="-g -O0" +complex+double+float~int64~metis~mpi~parmetis~ptscotch~scotch+shared arch=linux-rhel7-x86_64

Build snippet:

...
 cc -I../include -fPIC -O   -c graph.c -ograph.o
...

ipopt

Spack command:

spack install ipopt@3.12.7%intel@16.0.3 cflags="-g -O0" cppflags="-g -O0" cxxflags="-g -O0" fflags="-g -O0" +coinhsl+metis arch=linux-rhel7-x86_64

Build snippet:

...
if /bin/sh ../../../libtool --tag=CXX --mode=compile /g/g14/kudo4/spack/lib/spack/env/intel/icpc -DHAVE_CONFIG_H -I. -I`echo .`     -O3 -ip -mp1  -DNDEBUG    -DIPOPT_BUILD -MT IpDebug.lo -MD -MP -MF ".deps/IpDebug.Tpo" -c -o IpDebug\
    .lo IpDebug.cpp;

...

Information on your system

Platform : TOSS3/TOSS (Tri-Lab Operating System Stack)

Relevant configuration details:
compilers.yaml

compilers:
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    modules: []
    operating_system: rhel7
    paths:
      cc: /usr/bin/gcc
      cxx: /usr/bin/g++
      f77: /usr/bin/gfortran
      fc: /usr/bin/gfortran
    spec: gcc@4.8.5
    target: x86_64
- compiler:
    environment: {}
    extra_rpaths: []
    modules: []
    operating_system: rhel7
    paths:
      cc: /usr/tce/packages/intel/intel-16.0.3/bin/icc
      cxx: /usr/tce/packages/intel/intel-16.0.3/bin/icpc
      f77: /usr/tce/packages/intel/intel-16.0.3/bin/ifort
      fc: /usr/tce/packages/intel/intel-16.0.3/bin/ifort
    flags:
      cflags: -O0 -g
      cxxflags: -O0 -g
      cppflags: -O0 -g
      fflags: -O0 -g
    spec: intel@16.0.3
    target: x86_64

packages.yaml:

packages:
  all:
    compiler: [intel, gcc, pgi, clang, xl, nag]
    providers:
      mpi: [mvapich2]
      blas: [netlib-lapack]
      lapack: [netlib-lapack]
  metis:
    version: [4.0.3]
  netlib-lapack:
    paths:
      netlib-lapack@3.4.2: /usr/lib64/
    buildable: False
  mvapich2:
    paths:
      mvapich2@2.2: /usr/tce/packages/mvapich2/mvapich2-2.2-intel-16.0.3/
    buildable: False
  mpich:
    buildable: False
  openmpi:
    buildable: False
  intel-mpi:
    buildable: False
  spectrum-mpi:
    buildable: False
  intel-parallel-studio:
    buildable: False
  cmake:
    paths:
      cmake@3.5.2 arch=linux-rhel7-x86_64: /usr/tce/packages/cmake/cmake-3.5.2/
    buildable: False
  pkg-config:
    paths:
      pkg-config@0.27.1 arch=linux-rhel7-x86_64: /usr/bin/
    buildable: False
  m4:
    paths:
      m4@1.4.16 arch=linux-rhe17-x86_64: /usr/bin/
    buildable: False

Let me know if I'm doing something obviously wrong!
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions