+1 vote
asked by (290 points)


I am rather ignorant in cmake. I followed the instructions from the ITensor website and tried to compile the library first, and got this message:

Configure: Writing current dir to this_dir.mk

Building ITensor library

make[1]: Entering directory '/home/tianqic/ITensor/itensor'
Building static library /home/tianqic/ITensor/lib/libitensor-g.a
make[1]: Leaving directory '/home/tianqic/ITensor/itensor'

Presumably I believe ITensor has been successfully compiled? Then I got to samples folder and tried to make them but I got this:

g++ -m64 -std=c++17 -fconcepts -fPIC -c -I. -I'/home/tianqic/ITensor' -I/opt/intel/mkl/include -I/usr/lib64/include -DITENSORUSEHDF5 -O2 -DNDEBUG -Wall -Wno-unknown-pragmas -o dmrg.o dmrg.cc
g++ -m64 -std=c++17 -fconcepts -fPIC -I. -I'/home/tianqic/ITensor' -I/opt/intel/mkl/include -I/usr/lib64/include -DITENSORUSEHDF5 -O2 -DNDEBUG -Wall -Wno-unknown-pragmas dmrg.o -o dmrg -L'/home/tianqic/ITensor/lib' -litensor -L/opt/intel/compilersandlibraries2020.0.166/linux/compiler/lib/intel64 -lmklintellp64 -lmklintelthread -lmklrt -lmklcore -liomp5 -lpthread -L/usr/lib64/lib -lhdf5 -lhdf5hl
/usr/bin/ld: cannot find -lmklintellp64
/usr/bin/ld: cannot find -lmklintelthread
/usr/bin/ld: cannot find -lmklrt
/usr/bin/ld: cannot find -lmkl
collect2: error: ld returned 1 exit status
make: *** [Makefile:29: dmrg] Error 1

Could anyone help me with this issue? Kind of clueless now. Thank you!


commented by (70.1k points)
Hi Tianqi,
Most likely these errors are due to incorrect linker flags in your BLAS_LAPACK_LIBFLAGS environment variable which is set in the ITensor options.mk file. We provide an example of BLAS_LAPACK_LIBFLAGS for the case of MKL, which seems to be what you're using, but you might need different flags depending on your machine and which version of MKL you're using.

I'd recommend these steps:
1. see if you are using the same BLAS_LAPACK_LIBFLAGS as for our MKL example, and if not, try those to see if they work.

2. use the MKL "Link Line Advisor" web tool which helps you to figure out what compiler flags to use for a particular version of MKL: https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html

Hope that helps!

commented by (70.1k points)
By the way, the provided example of BLAS_LAPACK_LIBFLAGS for MKL is:

BLAS_LAPACK_LIBFLAGS=-L/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_rt -lmkl_core -liomp5 -lpthread
commented by (290 points)
Hi Miles,

Thank you so much for the answers! I have finally solved the issue. The problem was that the path to those bias/lapack library was not correct and thus the libraries were unlinked: iomp5 was unlinked before.

Now everything is working!

commented by (70.1k points)
Glad to hear it!

1 Answer

0 votes
answered by (70.1k points)

(Please see discussion above.)

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.