JiaweiZhuang / cloud-gchp-paper

Code to reproduce GCHP-on-cloud paper
MIT License
5 stars 3 forks source link

Error installing netcdf: "Intel C compiler cannot create executables" #4

Closed rsignell-usgs closed 4 years ago

rsignell-usgs commented 4 years ago

We are following the guide, and in the section "build libraries using spack and intel compiler" we are hitting a snag when trying to install netcdf. Can you see the problem? Did we miss a step?

[centos@ip-10-0-0-80 ~]$ spack -v install netcdf-fortran %intel ^netcdf~mpi ^hdf5~mpi+fortran+hl
==> Installing libsigsegv
==> Searching for binary cache of libsigsegv
==> Warning: No Spack mirrors are currently configured
==> No binary for libsigsegv found: installing from source
==> Using cached archive: /home/centos/spack/var/spack/cache/libsigsegv/libsigsegv-2.11.tar.gz
==> Staging archive: /tmp/centos/spack-stage/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq/libsigsegv-2.11.tar.gz
==> Created stage in /tmp/centos/spack-stage/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq
==> No patches needed for libsigsegv
==> Building libsigsegv [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> [2020-03-27-18:48:36.723644] '/tmp/centos/spack-stage/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq/spack-src/configure' '--prefix=/home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq' '--enable-shared'

Build Tools:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... /home/centos/spack/lib/spack/env/intel/icc
checking whether the C compiler works... no
configure: error: in `/tmp/centos/spack-stage/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq/spack-src':
configure: error: C compiler cannot create executables
See `config.log' for more details
==> Error: ProcessError: Command exited with status 77:
    '/tmp/centos/spack-stage/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq/spack-src/configure' '--prefix=/home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/libsigsegv-2.11-u3wti3qzaudxm73uzyyzrbje3rptgppq' '--enable-shared'

2 errors found in build log:
     8     checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
     9     checking for gawk... gawk
     10    checking whether make sets $(MAKE)... yes
     11    checking whether make supports nested variables... yes
     12    checking for gcc... /home/centos/spack/lib/spack/env/intel/icc
     13    checking whether the C compiler works... no
  >> 14    configure: error: in `/tmp/centos/spack-stage/libsigsegv-2.11-u3wti3
           qzaudxm73uzyyzrbje3rptgppq/spack-src':
  >> 15    configure: error: C compiler cannot create executables

( we did verify that both the intel icc and ifort compilers could compile and run "hello world" programs...)

JiaweiZhuang commented 4 years ago

Similar to this issue? https://github.com/spack/spack/issues/5705#issuecomment-336229224

Is the ~/.spack/linux/compilers.yaml file set up correctly?

rsignell-usgs commented 4 years ago

@JiaweiZhuang , it's not clear to me what to learn from that issue comment.

Did you mean to try changing modules: [] to modules: [intel/19.0.4]?

If yes, I tried that and have the same issue with C compiler cannot create executables.

I looked at the config.log and the problem is configure can't find the standard libraries:

configure:3252: /home/centos/spack/lib/spack/env/intel/icc -v >&5
icc version 19.0.4.243 (gcc version 4.8.5 compatibility)
ld    /usr/lib/gcc/x86_64-redhat-linux/4.8.5/32/crtbegin.o --eh-frame-hdr --buil
d-id -dynamic-linker /lib/ld-linux.so.2 -m elf_i386 -o a.out -L/home/centos/spac
k/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwq
wjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/compiler/lib/ia32_lin -L/us
r/lib/gcc/x86_64-redhat-linux/4.8.5/32/ -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5
/../../../../lib/ -L/lib/../lib/ -L/usr/lib/../lib/ -L/usr/lib/gcc/x86_64-redhat
-linux/4.8.5/32 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/ -L/usr/lib/gcc/x86_64-
redhat-linux/4.8.5/../../../ -L/lib/ -L/usr/lib -rpath=/home/centos/spack/opt/sp
ack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydg
vmi/compilers_and_libraries_2019.4.243/linux/compiler/lib/intel64 -Bdynamic -Bst
atic -limf -lsvml -lirng -Bdynamic -lm -Bstatic -lipgo -ldecimal --as-needed -Bd
ynamic -lcilkrts -lstdc++ --no-as-needed -lgcc --as-needed -lgcc_s --no-as-neede
d -Bstatic -lirc -lsvml -Bdynamic -lc -lgcc --as-needed -lgcc_s --no-as-needed -
Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/32/crt
end.o
ld: cannot find -lm
ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5//libstdc++.so w
hen searching for -lstdc++
ld: cannot find -lstdc++
ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5//libgcc_s.so wh
en searching for -lgcc_s
ld: cannot find -lgcc_s
ld: cannot find -lc
ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5//libgcc_s.so wh
en searching for -lgcc_s
ld: cannot find -lgcc_s
... rest of stderr output deleted ...

FWIW, this is our (not-working-yet) ~/.spack/compilers/linux.yaml:

compilers:
- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    implicit_rpaths: []
    modules: []
    operating_system: centos7
    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: []
    flags: {}
    modules: [intel/19.0.4]
    operating_system: centos7
    paths:
      cc: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-1
9.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/
bin/ia32/icc
      cxx: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-
19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux
/bin/ia32/icpc
      f77: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-
19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux
/bin/ia32/ifort
      fc: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-1
9.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/
bin/ia32/ifort
    spec: intel@19.0.4
    target: x86_64

Does this give you any ideas of what could be wrong?

JiaweiZhuang commented 4 years ago

@rsignell-usgs The only thing comes to my mind is the extra_rpaths setting (currently empty in your config), but not sure if this can fix your problem...

Ref:

rsignell-usgs commented 4 years ago

@JiaweiZhuang , problem solved!

Since the intel compiler was working from the command line, I ran:

 spack compiler add

and it added a complier with implicit_rpaths to my compilers.yaml file:

- compiler:
    environment: {}
    extra_rpaths: []
    flags: {}
    implicit_rpaths:
    - /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/mpi/intel64/libfabric/lib
    - /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/tbb/lib/intel64/gcc4.7
    - /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/compiler/lib/intel64_lin
    modules: []
    operating_system: centos7
    paths:
      cc: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/bin/intel64/icc
      cxx: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/bin/intel64/icpc
      f77: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/bin/intel64/ifort
      fc: /home/centos/spack/opt/spack/linux-centos7-x86_64/intel-19.0.4/intel-19.0.4-u3y3ya4cuwa5r25r6akwqwjkyiydgvmi/compilers_and_libraries_2019.4.243/linux/bin/intel64/ifort
    spec: intel@19.0.4.243
    target: x86_64

I deleted the other intel entry I had and I was good to go!