Compile error: /usr/bin/ld: cannot find -lhwloc

61 views
Skip to first unread message

Solal Amouyal

unread,
Sep 16, 2019, 5:11:30 AM9/16/19
to cp2k
Hi,

I am trying to install cp2k locally. I have successfully installed cp2k using spack but as I need to modify parts of the source code, a local installation makes things easier.

Some system information:

$ lsb_release -a: 
LSB Version:    :core-4.1-amd64:core-4.1-ia32:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.6.1810 (Core)
Release:        7.6.1810
Codename:       Core
$ uname -a:
Linux arthemis.localdomain 5.0.10-1.el7.elrepo.x86_64 #1 SMP Sat Apr 27 08:40:16 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

Compilers/libraries:

$ gfortran --version
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ mpif90 --showme
/root/usr/bin/gfortran -I/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/include -fexceptions -pthread -I/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/lib -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/zlib-1.2.11-j3zdmzqsbyenjda44kvkceohj352n5ga/lib -Wl,-rpath -Wl,/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib -Wl,-rpath -Wl,/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/zlib-1.2.11-j3zdmzqsbyenjda44kvkceohj352n5ga/lib -Wl,-rpath -Wl,/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/lib -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi

I am using Openmpi-4.0.1

I am compiling with the following optional libraries: FFTW3, libint, libxc, Scalpack. Attached is the arch file.

Steps to reproduce error:

$ make ARCH=Linux-x86-64-gfortran VERSION=popt
...
...
mpif90 -D__F2008 -D__FFTW3 -D__LIBINT -D__LIBXC -D__MPI_VERSION=3 -D__LIBINT_MAX_AM=7 -D__LIBDERIV_MAX_AM1=6 -D__MAX_CONTR=4 -D__parallel -D__SCALAPACK  -O2 -ffast-math -ffree-form -ffree-line-length-none -ftree-vectorize -funroll-loops -mtune=native -std=f2008 -I/root/tmp/fftw-3.3.5/include -I/root/tmp/libint-1.1.4/include -I/root/tmp/libxc/include  -D__COMPILE_ARCH="\"Linux-x86-64-gfortran\"" -D__COMPILE_DATE="\"Mon Sep 16 11:46:43 IDT 2019\"" -D__COMPILE_HOST="\"arthemis.localdomain\"" -D__COMPILE_REVISION="\"svn:18464\"" -D__DATA_DIR="\"/root/tmp/cp2k-6.1.0/share/cp2k-6.1.0/data\"" -static -L/root/tmp/cp2k-6.1.0/share/cp2k-6.1.0/lib/Linux-x86-64-gfortran/popt -o /root/tmp/cp2k-6.1.0/share/cp2k-6.1.0/exe/Linux-x86-64-gfortran/dbcsr_example_1.popt dbcsr_example_1.o  -ldbcsr -ldbcsrmm -ldbcsrops -ldbcsrbblock -ldbcsrbdist -ldbcsrbase -ldbcsrdata -lcp2kmpiwrap -lmicsmm -lclsmm -lcp2kacc -lcp2kaccmic -lcp2kaccopencl -lcp2kbase /root/tmp/scalapack-2.0.2/lib/libscalapack.a /root/tmp/blas/lib/liblapack.a /root/tmp/blas/lib/libblas.a /root/tmp/fftw-3.3.5/lib/libfftw3.a /root/tmp/libxc/lib/libxcf03.a /root/tmp/libxc/lib/libxc.a /root/tmp/libint-1.1.4/lib/libderiv.a /root/tmp/libint-1.1.4/lib/libint.a -ldl
/usr/bin/ld: cannot find -lhwloc

What I've tried:
  • Linking explicity libhwloc
    •  based on the  mpif90 --showme output, add: -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib -lhwloc
    • This only an additional error message: /usr/bin/ld: cannot find -lhwloc
  • Add the path to LD_LIBRAR_PATH
    • export LD_LIBRARY_PATH=/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib:$LD_LIBRARY_PATH
    • No change
  • Execute ldd command to all lib* to make sure libhwloc is well linked. 
Any help is appreciated. Thanks





Linux-x86-64-gfortran.popt

Tiziano Müller

unread,
Sep 16, 2019, 6:56:16 AM9/16/19
to cp...@googlegroups.com
Hi Solal,

fairly recent versions of Spack started archiving the CP2K arch file
used for building CP2K.

Use `spack find -p cp2k` to get the Spack directory for your build of
CP2K. Inside this directory there is a subdirectory
`.spack/archived-files/cp2k/arch/` which contains the arch file
generated in Spack's build process. You should be able to use this arch
file build your own version of CP2K with the libraries provided by Spack.

From the command line you sent I can't reproduce what you did, and it
is therefore also difficult to say what you're missing. But it seems
that you started to build your own stuff in `/root/tmp`. If you're going
this road I'd recommend to use the toolchain scripts in
`tools/toolchain` instead to build both the libraries and a matching
arch file.

Best regards,
Tiziano

On 16.09.19 11:11, Solal Amouyal wrote:
> Hi,
>
> I am trying to install cp2k locally. I have successfully installed cp2k
> using spack but as I need to modify parts of the source code, a local
> installation makes things easier.
>
> *Some system information:*
>
> $ lsb_release -a:
> LSB Version:    :core-4.1-amd64:core-4.1-ia32:core-4.1-noarch
> Distributor ID: CentOS
> Description:    CentOS Linux release 7.6.1810 (Core)
> Release:        7.6.1810
> Codename:       Core
> $ uname -a:
> Linux arthemis.localdomain 5.0.10-1.el7.elrepo.x86_64 #1 SMP Sat Apr 27
> 08:40:16 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux
>
> *Compilers/libraries*:
>
> $ gfortran --version
> gcc (GCC) 9.2.0
> Copyright (C) 2019 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> $ mpif90 --showme
> /root/usr/bin/gfortran
> -I/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/include
> -fexceptions -pthread
> -I/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/lib
> -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib
> -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/zlib-1.2.11-j3zdmzqsbyenjda44kvkceohj352n5ga/lib
> -Wl,-rpath
> -Wl,/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib
> -Wl,-rpath
> -Wl,/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/zlib-1.2.11-j3zdmzqsbyenjda44kvkceohj352n5ga/lib
> -Wl,-rpath
> -Wl,/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/lib
> -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/openmpi-4.0.1-v5ndqdyuke2sz3umfee2sigg3ymt2qnd/lib
> -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
>
> I am using Openmpi-4.0.1
>
> I am compiling with the following optional libraries: FFTW3, libint,
> libxc, Scalpack. Attached is the arch file.
>
> *Steps to reproduce error:*
> *What I've tried:*
>
> * Linking explicity libhwloc
> o  based on the mpif90 --showme output, add:
> -L/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib
> -lhwloc
> o This only an additional error message: /usr/bin/ld: cannot find
> -lhwloc
> * Add the path to LD_LIBRAR_PATH
> o export
> LD_LIBRARY_PATH=/root/usr/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/hwloc-1.11.11-relc7hrklipjovl3gbzppgxjb55pc24t/lib:$LD_LIBRARY_PATH
> o No change
> * Execute ldd command to all lib* to make sure libhwloc is well linked.
>
> Any help is appreciated. Thanks
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cp2k+uns...@googlegroups.com
> <mailto:cp2k+uns...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cp2k/49b88030-4e3e-4279-8507-993f0fd18dbc%40googlegroups.com
> <https://groups.google.com/d/msgid/cp2k/49b88030-4e3e-4279-8507-993f0fd18dbc%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Tiziano Müller
University of Zurich
Department of Chemistry
Winterthurerstrasse 190
CH-8057 Zürich

Tel: +41 44 63 54234
www.chem.uzh.ch
tiziano...@chem.uzh.ch

Solal Amouyal

unread,
Sep 24, 2019, 9:13:34 AM9/24/19
to cp2k
Hi Tiziano,

Thank you for the help. I had to modify a few things for the arch file to work but it lead me in the right direction anyway!

Solal
Reply all
Reply to author
Forward
0 new messages