readme-win.txt 3.9 KB
Newer Older
Mahmoud Mahmoud's avatar
Mahmoud Mahmoud committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Title: readme-windows-version

This file serves as a complementary readme file. Please refer to the readme.txt file for complete overview about the SCOTS requirements and structure. Here, we present step-by-step guide on how to install and use SCOTS in Windows.

Installation in Windows Systems
================================
1- (MSYS-2 Installation) 
You have to downbload and install MSYS2: https://sourceforge.net/projects/msys2/files/latest/download. We follow the default installation where MSYS-2 gets installed to c:\msys64. After installing, you run the following commands on MSYS-2 terminal to update it and install MinGW compilers. 
	
	- pacman -Su		(to update all)
	- pacman -S make
	- pacman -S mingw-w64-x86_64-gcc

Then, you need to add "C:\msys64\mingw64\bin" to windwows PATH variable.

2- (CUDD-3.0.0 Installation) 
Download and extract the CUDD-3.0.0 library. Now, you should use the mingw64 shell (C:\mingw64_shell.bat) and navigate to cudd root folder then run the configure with:
	./configure --enable-shared --enable-obj --enable-dddmp CXXFLAGS='-Wall -Wextra -std=c++11 -g -O3 -D_GLIBCXX_USE_CXX11_ABI=0'
	
This allows compiling cplusplus interface with old symbol naming for c++11 standard that became default after g++ 5.1. We do so because Matlab supports compilers with versions less than 5.0 (actually g++4.8 or MinGW_64_g++ 4.9) which causes using such old mangled symbols in the object files. More info about this issue : https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html. The following are the configurations used for CUDD:		
		--------------------------------------------------
		Configuration summary for cudd 3.0.0

		Build system   : x86_64-pc-mingw64
		Host system    : x86_64-pc-mingw64
		Prefix         : '/usr/local'
		Compilers      : 'gcc    -Wall -Wextra -g -O3'
			       : 'g++    -Wall -Wextra -std=c++0x -g -O3 -D_GLIBCXX_USE_CXX11_ABI=0'
		Shared library : yes
		dddmp enabled  : yes
		obj enabled    : yes
		--------------------------------------------------
Now, follow on compiling and instaling CUDD-3.0.0 by running the commands:
	- make
	- make install

Now you should get the file libcudd.a in /usr/local/lib. Copy it to libcudd.lib in the same folder, while keeping the original (.a) file.
Copy file libcudd-3-0-0-0.dll from /usr/local/bin to the "System32" windows folder.
Copy the config.h and util/util.h files to the /usr/local/include. 
	

3- (Testing: compile a SCOTS example) 
For example, you can compile one of the scots examples in the folder scots/examples/hscc16 but take care of the following changes in the Makefile:
	- use g++ if you dont have clang++ installed in windows
	- use /usr/local as the location of the cudd library instead of /opt/local
	- use the (-D_GLIBCXX_USE_CXX11_ABI=0) along with compilation flags
	- then use (make) and run the example

4- (Configuring MATLAB) 
In MATLAB, addons, install MinGW_64. With MSYS2-shell, Go to mfiles/mexfiles and edit the Makefile:
	- /usr/local for as a CUDD path
	- change path of MATLAB to match your installation path (linux path style)
	- use mex.exe instead of bin/mex
	- replace the last line with this: $(CC) CXXFLAGS='$(CXXFLAGS)' -largeArrayDims $(SCOTSINC) $(CUDDINC) $(CUDDLPATH) $(CUDDLIBS) $(TARGET).cc
	- make sure mex is confidured to use mingw-64 by:
		mex.exe -setup:"(MATLAB_PATH)\bin\win64\mexopts\mingw64.xml" C
		mex.exe -setup:"(MATLAB_PATH)\bin\win64\mexopts\mingw64_g++.xml" C++
	- make
	- restart matlab
		
5- Now you can compile any of SCOTS's examples (with the same configurations in step 3) from windows. Having the mingw46 folder in the PATH, you can compile directly with g++ from windwos shell or MSYS2 shell with the following:
	g++ -Wall -Wextra -std=c++11 -O3 -DNDEBUG -IC:\msys64\usr\local\include -I../../../bdd -I../../../utils -DM_PI=3.14159265359 -LC:\msys64\usr\local\lib -llibcudd $CPP_FILE_NAME$
	where $CPP_FILE_NAME$ is the name of the .cc source file.
You can use this as a build command in Visual-Studio