Installation on WIndows Cygwin

+1 vote

Hi, I am trying to install itensor on my Windows laptop with Cygwin. While it is working well with Mac machine, Windows installation keep showing following error:

make[1]: Entering directory '/ITENSOR/itensor'
Compiling itensor/util/args.cc with optimizations
util/args.cc:8:31: fatal error: itensor/util/args.h: No such file or directory
compilation terminated.
Failure while executing command: g++ -m64 -std=c++11 -c -I/ITENSOR -I/openblas/include -fpermissive -DHAVELAPACKCONFIGH -DLAPACKCOMPLEXSTRUCTURE -O2 -DNDEBUG -Wall -DPLATFORMopenblas -DASSERTMACROSDEFINEVERSIONSWITHOUTUNDERSCORES=0 -DPLATFORMopenblas -DASSERTMACROSDEFINEVERSIONSWITHOUT_UNDERSCORES=0 -o util/args.o util/args.cc
make[1]: *** [Makefile:57: util/args.o] Error 1
make[1]: Leaving directory '/ITENSOR/itensor'
make: *** [Makefile:14: itensor] Error 2

It seems the directory is not properly included with -I flag, but I cannot find why. I would greatly appreciate it if anybody can advise this.

Thank you!

commented Apr 25, 2017 by (130 points)
For information, it is WIndows 10 laptop and Cygwin is x86 64bit version, g++ installed(checked working with other codes).
commented Apr 26, 2017 by (130 points)
Problem solved:
It was just the issue of Cygwin. Cygwin seems not recognizing -nix type paths. So I had to set paths explicitly, e.g. PREFIX=C:/cygwin64/ITENSOR, and similarly for -I and -L paths for lapack and blas. Hope it helps other Windows users that are not familiar with Cygwin as myself..  :)

answered May 7, 2017 by (20,240 points)

Glad to hear you solved your problem! (And sorry about the slow reply.) Hope you are finding the library useful and great that it's working now.

answered Jun 10, 2017 by (200 points)

Would you please upload or copy your mk file here? That will help me a lot. I have problem of mk file, too.

commented Jun 10, 2017 by (130 points)
I did manually put commands instead of using mk file. However, it seems there were other problems after the installation.. I gave up using ITensor on Windows, and I am currently using ITensor in Linux virtual machine instead.
answered Aug 3, 2017 by (610 points)
edited Aug 3, 2017

I was successfully able to get ITensor working using Cygwin on a laptop running Windows 10.

There are two steps, as follows:
1. Install Cygwin, making sure to put check marks for the options you want. Below I copied a write-up of the installation options I selected when I installed Cygwin:

First, download cygwin installation file, setup-x86_64.exe. It doesn't matter where it is saved.

Run the setup file. A large list of add-ons will be provided; you will need to check the following.

First click the box next to Debug, and click on the box under the column Bin? (but not Src?) for the following options:
->Debug
cygwindebuginfo
gcc
debuginfo
lapackdebuginfo
Then click the box for the heading Devel, and select the following options:
-> Devel
binutils
cygwin
devel
gcccore
gcc
g++
libargp
libcloogisl4
libltdl7
make
mingw64-i686-binutils
-gcc-core
-g++
-runtime
-windows-default-manifest
mingw64-x86
64-binutils
-gcc-g++
-runtime
-windwos default manifest

->editors
nano (if you want the nano editor, otherwise vi is included with gcc-core)

Some of these might be added automatically when you select the main file. For instance, gcccore, gccg++ might automatically come with cygwin_devel but I forget which ones are automatic.

If these options are not sufficient simply re-install cygwin and add more options. I found some videos on youtube that were helpful.

Cygwin should be installed within the C: drive; it will then have its' own home file, within which you should create a user folder for yourself. In this user folder, install itensor.

In this way, cygwin creates a separate computer within your computer that acts like Linux. When you run the cygwin program, for instance by clicking on the cygwin icon on your desktop if you create a desktop icon, it will open up a unix-like shell that you can run itensor from. This cygwin shell then starts you at a "home" folder that is located within cygwin; from here you can use the shell just like you would in linux with the same navigation commands.

SECOND STEP. Add the following sections in your options.mk file (I only copied the relevant parts)

Section [1] ------------------------------

## GCC On Windows cygwin
## Extra flags are workaround for limitations
## of this compiler with Windows binary format
CCCOM=g++ -std=c++11 -Wa,-mbig-obj -O2


Section [2]------------------------------

##
## Example using a C interface to LAPACK on GNU/LINUX systems
## (Path to lib/ folder may differ on your system)
##

PLATFORM=lapack
BLAS_LAPACK_LIBFLAGS=-L /usr/lib -lblas -llapack


Section [3]----------------------------------

## This step is optional, but if you wish to customize the flags
## used to compile optimized and debug code, you can do so here.

## Flags to give the compiler for "release mode"
OPTIMIZATIONS=-O2 -DNDEBUG -Wall

## Flags to give the compiler for "debug mode"
DEBUGFLAGS=-DDEBUG -g -Wall -pedantic -O2

###
### Other Makefile variables defined for convenience.
### Not necessary to modify these for most cases.
###

PREFIX=$(THIS_DIR) ITENSOR_LIBDIR=$(PREFIX)/lib
ITENSOR_INCLUDEDIR=$(PREFIX) OPTIMIZATIONS+= -DPLATFORM_$(PLATFORM) -
D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0
DEBUGFLAGS+= -DPLATFORM_$(PLATFORM) - D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 ITENSOR_LIBNAMES=itensor ITENSOR_LIBFLAGS=$(patsubst %,-l%, $(ITENSOR_LIBNAMES)) ITENSOR_LIBFLAGS+=$(BLAS_LAPACK_LIBFLAGS)
ITENSOR_LIBGFLAGS=$(patsubst %,-l%-g,$(ITENSOR_LIBNAMES))
ITENSOR_LIBGFLAGS+= $(BLAS_LAPACK_LIBFLAGS) ITENSOR_LIBS=$(patsubst %,$(ITENSOR_LIBDIR)/lib%.a,$(ITENSOR_LIBNAMES))
ITENSOR_GLIBS=$(patsubst %,$(ITENSOR_LIBDIR)/lib%-g.a, $(ITENSOR_LIBNAMES)) ITENSOR_INCLUDEFLAGS=-I$(ITENSOR_INCLUDEDIR) $(BLAS_LAPACK_INCLUDEFLAGS) ifndef CCCOM$(error Makefile variable CCCOM not defined in options.mk; please define it.)
endif

CCFLAGS=-I. $(ITENSOR_INCLUDEFLAGS)$(OPTIMIZATIONS) -Wno-unused-variable
CCGFLAGS=-I. $(ITENSOR_INCLUDEFLAGS)$(DEBUGFLAGS)
LIBFLAGS=-L$(ITENSOR_LIBDIR)$(ITENSOR_LIBFLAGS)
LIBGFLAGS=-L$(ITENSOR_LIBDIR)$(ITENSOR_LIBGFLAGS)


Note that it took Miles a long time to figure out the compiler workarounds in the above file. But since then I have been using it with no problems.