+1 vote
asked by (130 points)

Hi, I am trying to install ITensor library on my Ubuntu (v. 16.04.3) virtual machine.
I followed the instruction, but when I compile the library, the error shows up at the stage of compiling mps module. The error reads:

...
Compiling itensor/mps/mps.cc with optimizations
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::copyWriteDir() [with Tensor 
= itensor::ITensorT<itensor::Index>]':
mps/mps.cc::1035:9: warning: ignoring return value of 'int system(const char*)', declared with     
attribute warn_unused_result [-Wunused-result]
         system(cmdstr.c_str());
         ^
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::copyWriteDir() [with Tensor 
= itensor::ITensorT<itensor::IQIndex>]':
mps/mps.cc::1035:9: warning: ignoring return value of 'int system(const char*)', declared with     
attribute warn_unused_result [-Wunused-result]
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::cleanupWrite() [with Tensor 
= itensor::ITensorT<itensor::Index>]':
mps/mps.cc::1051:9: warning: ignoring return value of 'int system(const char*)', declared with     
attribute warn_unused_result [-Wunused-result]
         system(cmdstr.c_str());
         ^
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::cleanupWrite() [with Tensor 
= itensor::ITensorT<itensor::Index>]':
mps/mps.cc::1051:9: warning: ignoring return value of 'int system(const char*)', declared with     
attribute warn_unused_result [-Wunused-result]

Other modules were compiled without errors.
The makefile was used with options below:
[1]
## GNU GCC compiler
CCCOM=g++ -m64 -std=c++11 -fPIC
[2]
PLATFORM=lapack
BLASLAPACKLIBFLAGS=-lpthread -L/usr/lib -lblas -llapack

Thank you!

commented by (70.1k points)
Hi, did the code continue to compile or did compilation not finish? In the printout above I see that you did get warnings but I don't see a line where it says "error". Depending on the answer I can help you more with your question -

(If you're not sure if the code compiled or not, check the lib/ folder underneath where options.mk is located to see if there is a file libitensor.a located there.)
commented by (130 points)
Thank you for your superfast answer!
The code continued compiling, so compilation was finished with a file libitensor.a in /lib folder.
Since I got same warning messages (ignoring return value...) on compiling sample files, so I just worried about some missing parts in my procedure.
However, I just rechecked the compiled executable files, and I think it works pretty nice.
Anyway, I really appreciate your reply!

1 Answer

0 votes
answered by (70.1k points)

Ok thanks for posting this question. For the answer see the discussion above ^

I'd recommend turning off this particular warning, actually. The reason is it's a "catch 22" warning, meaning that if you do assign the return value to a variable, the warning goes away. But then if you don't use the assigned variable, you get a different warning about "unused variable". So you get a warning either way. That's why I just turn this one off because there can be perfectly good reasons to ignore return values.

Miles

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.

Categories

...