+1 vote
asked by (340 points)


I've successfully compiled version V3 of ITensor however when calling some functions the following error occurs

./two: symbol lookup error: ./two: undefined symbol: ZN7itensor3svdERKNS7ITensorERKNS8IndexSetENS4ArgsE

This error occurs when running the tutorial two but not the tutorial one, per example. I think this has to do with library linking but from the error message, I cannot understand which libraries...

A few things that didn't work:

  1. I've tried to make clean and then make
  2. The debug message is the same
  3. I'm currently using MKL but have tried just the LAPAK

Thank you for the support

1 Answer

+1 vote
answered by (70.1k points)

Hi, thanks for the question but I'm also not sure why you'd be getting this error if you:
1. fully did a make clean and make, and it built successfully
2. used the provided Makefile to build your code

Could you please post some more output of your build, the compiler command and output, and the error message?

Did you happen to move the ITensor source folder to a different location on your computer from a previous location?


commented by (340 points)
Sure thing!
Currently, I have an older ITensor version installed in my machine and wanted to test code against the new ITensor version. So I went to a folder and "git clone" the V3 branch. I change the MKL line to:

## MKL example - you may need to change the names of the folders below
BLAS_LAPACK_LIBFLAGS=-L/home/joaosf/intel/mkl/lib/intel64 -lmkl_intel_lp64 ->


Then I compile. The output of the "make clean"+"make" is (only the end):

Building static library /home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor/lib/libitensor-g.a
ar: creating /home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor/lib/libitensor-g.a
Building dynamic library /home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor/lib/libitensor-g.so
make[1]: Leaving directory '/home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor/itensor'

If I go to the second tutorial and compile, the output is:

g++ -m64 -std=c++17 -fconcepts -fPIC -c -I. -I'/home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor' -I/home/joaosf/intel/mkl/include -O2 -DNDEBUG -Wall -Wno-unknown-pragmas -Wno-unused-variable -o two.o two.cc
g++ -m64 -std=c++17 -fconcepts -fPIC -I. -I'/home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor' -I/home/joaosf/intel/mkl/include -O2 -DNDEBUG -Wall -Wno-unknown-pragmas -Wno-unused-variable two.o -o two -L'/home/joaosf/Work/PhD_Thesis/Open_TEBD/V2/itensor/lib' -litensor -L/home/joaosf/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_rt -lmkl_core -liomp5 -lpthread

The executable file is generated and when I run it I get:
./two: symbol lookup error: ./two: undefined symbol: _ZN7itensor3svdERKNS_7ITensorERKNS_8IndexSetENS_4ArgsE
commented by (70.1k points)
Hi, I see. Thanks for those details.

I’m still not exactly sure what’s going wrong, but here are some other questions I have for you:

1. are you making a brand new “options.mk” file for your new v3 compile, copying it from the provided options.mk.sample? Or did you reuse the options.mk file from your v2 install?

2. does the output from “make” of the library also show that libitensor.a is being made? I only see libitensor-g.a but it could be showing that in the lines above the ones you showed.

3. Can you please try setting ITENSOR_MAKE_DYLIB=0 and try again? That might help, because I don’t think you’re using the dynamic library but it could be making the situation go wrong, possibly.

We can keep iterating on it -

commented by (340 points)
Hi Miles. Thank you for the quick reply, it worked!

1. I'm using the new options and just adding the MKL library.
2. yes, libtensor.a is being generated.
3. Indeed setting ITENSOR_MAKE_DYLIB=0  solved the problem!

I'm very confused about this and available to debug further if you think it's necessary.
commented by (70.1k points)
Great! I'm not 100% sure what's happened, but I think it's that the compiler tried to use the shared library since it was available, but for that to work you need to have /PATH/TO/itensor/lib/ in your LD_LIBRARY_PATH environment variable. So it's probably that you don't have it in your LD_LIBRARY_PATH.

If you're motivated to get to the bottom of this, could you update your environment variable, check that it's updated, then recompile ITensor with ITENSOR_MAKE_DYLIB=1 again, and finally check that it all works (hopefully)?

Personally I find the static library option good enough, but the dynamic library option is nice for certain people's setups or if they care about binary size, etc. We didn't used to offer it but a few users asked us pretty strongly for it.

commented by (340 points)
That was the cause. Indeed LD_LIBRARY_PATH  had the old version linked but not the new one. Thank you very much.

commented by (70.1k points)
Glad we solved it!
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.