1 This wiki page contains information about how to use deal.II on the
2 - [Windows subsystem for Linux](#using-dealii-with-the-windows-subsystem-for-windows)
3 - [Using deal.II on native Windows](#using-dealii-on-native-windows)
4 For an overview of different ways to use deal.II on Windows have a look at
5 the corresponding [FAQ entry](https://github.com/dealii/dealii/wiki/Frequently-Asked-Questions#can-i-use-dealii-on-a-windows-platform).
7 # Using deal.II with the Windows Subsystem for Linux
9 **Warning: please be aware that the following is experimental and you will
10 likely encounter bugs in compilers and deal.II itself. Only continue if you
11 are willing to experiment.**
13 Windows 10 has gained a compatibility layer for running Linux binaries
14 natively on Windows. You can find more information on the
15 [Wikipedia page](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
17 In the following section a detailed HowTo is given to install the subsystem
18 and a Linux distribution on top of it. Our choice at hand is [Debian
19 GNU/Linux](https://www.microsoft.com/en-us/store/p/debian-gnu-linux/9msvkqc78pk6)
20 because it already contains the latest deal.II release in binary form.
21 (<b>Note:</b> The same is true for the Ubuntu distribution.)
23 ## (Required) Installing the subsystem and Debian GNU/Linux
25 Have a look at the excellent documentation about the Linux subsystem on the
26 [Windows help pages](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
28 1. (As described in detail on the Windows help pages, we first have to
29 install the subsystem. For this, locate the Windows PowerShell in your
30 Start menu (`Start` -> `Windows PowerShell`), right click on `Windows PowerShell`
31 -> `More` -> `Run as administrator`
33 2. Install the subsystem by using the following command
35 Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
39 3. Open the Windows Store and search for "Debian", and install "Get Debian
40 GNU/Linux". When finished start the application. You will be prompted to
41 enter a user name and password.
43 4. Switch to the "root" account by running
45 user@computer% sudo -s
47 Enter the password that you used in step 3.
49 5. Edit the package manager configuration by using nano (or an editor of
52 root@computer# nano /etc/apt/sources.list
54 You should see three lines. If they contain the release name `stretch`,
55 remove all three lines and replace them with a single line:
57 deb http://deb.debian.org/debian buster main contrib non-free
60 6. Now update/upgrade the system by running
62 root@computer# apt update
65 root@computer# apt dist-upgrade
67 Do you want to continue? [Y/n] <Enter>
70 root@computer# apt autoremove
72 Do you want to continue? [Y/n] <Enter>
76 ## (Required) Installing the deal.II library and tools
78 We continue the installation process by installing the deal.II library with
79 development headers and documentation. The packages in Debian (or Ubuntu)
80 are called `libdeal.ii-dev` and `libdeal.ii-doc`:
82 1. As root user (see above) run:
84 root@computer# apt install libdeal.ii-dev libdeal.ii-doc
86 0 upgraded, 443 newly installed, 0 to remove and 0 not upgraded.
87 Need to get 441 MB of archives.
88 After this operation, 2,016 MB of additional disk space will be used.
89 Do you want to continue? [Y/n] <Enter>
93 At this point, let us install a number of useful, additional tools:
95 root@computer# apt install build-essential cmake ninja-build gdb clang clang-format
97 Do you want to continue? [Y/n] <Enter>
101 If you plan to use graphical tools, a number of useful programs are:
103 root@computer# apt install xterm gnuplot
105 Do you want to continue? [Y/n] <Enter>
108 You can also install gnuplot and ParaView natively on Windows to view the files created by deal.II.
110 If you plan to use MSVC, you will also need to install ssh, rsync, zip and
113 root@computer# apt install ssh zip unzip rsync
115 Do you want to continue? [Y/n] <Enter>
118 You will also need to install git:
120 root@computer# apt-get install git-core
122 Do you want to contiue? [Y/n] <Enter>
126 If you would like to use the CMake version managed by Microsoft, run the following:
128 git clone https://github.com/Microsoft/CMake.git
141 Now, exit the root account:
147 2. Do a quick "smoke test" whether everything installed fine by compiling
148 and running the first example step:
151 user@computer$ cp -r /usr/share/doc/libdeal.ii-doc/examples/step-55 .
152 user@computer$ cd step-55
153 user@computer$ cmake .
154 user@computer$ make release
155 user@computer$ make run
157 [100%] Built target run
160 ## (Recommended) Installing an X server
162 In order to run graphical applications from within the Linux Subsystem a
163 so-called X server has to be installed. This step is in particular
164 necessary, if you plan to install
165 [Eclipse](https://github.com/dealii/dealii/wiki/Eclipse), or
166 [KDevelop](https://github.com/dealii/dealii/wiki/KDevelop) via the Linux
169 1. Download and install [xming](https://sourceforge.net/projects/xming/).
171 2. Start xming. A styliced X should appear in the task bar.
173 3. Open a Linux terminal and try to run xterm:
175 user@computer$ export DISPLAY=:0
178 This should spawn a new window with a shell. Simply close the shell
181 4. In order to avoid to have to export `DISPLAY=:0` every single time, it
182 is convenient to append
186 to the end of the `.bashrc` file.
188 You should now be able to proceed and run all graphical and command lines
189 tools that are mentioned in the documentation and video lectures about
193 ## (Optional) Installing Microsoft Visual Studio Community Edition
195 This step is optional and only needed if you intent to use MSVC for code
196 development. (Great alternatives are
197 [Eclipse](https://github.com/dealii/dealii/wiki/Eclipse), or
198 [KDevelop](https://github.com/dealii/dealii/wiki/KDevelop).)
200 1. Go to the [Microsoft website](https://www.visualstudio.com/downloads)
201 and download Microsoft Visual Studio Community Edition. Visual Studio versions below 15.8.0 will have problems with IntelliSense. You might need to install the Preview edition of Visual Studio to get version 15.8.0.
203 2. Launch the web installer. Make sure to select "Linux development with C++"
207 4. To fix occasional IntelliSense bugs, install the Visual Studio tool IntelliSense Extender.
209 ### Create MSVC project
211 Next, let us create a small example project with MSVC. First, you have to
212 decide where the MSVC project shall be located. For this example we will
213 use the directory `workspace` in the (Windows) documents directory of the
214 current user located on driver C. The corresponding path to access this
215 directory from Linux is `/mnt/c/Users/<user>/Documents/workspace`. (Substitute
216 `<user>` with your Windows username in the following console listings!)
218 1. Copy an example step to the Windows user directory. For this, start the Linux
219 terminal again and `cd` to the user directory and copy and example step:
221 user@computer$ mkdir -p /mnt/c/Users/<user>/Documents/workspace
222 user@computer$ cd /mnt/c/Users/<user>/Documents/workspace
223 user@computer$ cp -r /usr/share/doc/libdeal.ii-doc/examples/step-6 .
224 user@computer$ cd step-6
225 user@computer$ cmake .
228 2. (Only once) Download a script for generating Visual C++ Linux project files:
230 user@computer$ cd /mnt/c/Users/<user>/Documents/workspace
231 user@computer$ git clone https://github.com/robotdad/vclinux
234 3. Generate the Visual C++ Linux project file:
236 user@computer$ cd /mnt/c/Users/<user>/Documents/workspace/step-6
237 user@computer$ ../vclinux/bash/genvcxproj.sh . step-6.vcxproj
240 4. Start the sshd server:
242 root@computer$ sudo service ssh start
244 Make sure to keep the terminal open and the sshd server running while working in Visual Studio
246 5. Open Visual Studio and navigate to `Tools` -> `Options` -> `Cross Platform` -> `Connection Manager`
247 * The Host name should be 'localhost'
248 * The Port should be 22
249 * The User Name and Password are the ones you used to set up Debian
250 * Hit okay and wait for Visual Studio to run through setting up the connection
252 6. Configure the project in Visual Studio
253 * Open the project file `c:\Users\<user>\Documents\workspace\step-6.vcxproj` in Visual Studio.
254 * In the `Solution Explorer` right-click on the project and select `Properties`
255 * Go to the `Debugging` page and set `Program` to `/mnt/c/Users/<user>/Documents/workspace/step-6/step-6` and set `Working Directory` to `/mnt/c/Users/<user>/Documents/workspace/step-6/`
256 * Go to the `Remote Build` page and set `Build Command Line` to `cd /mnt/c/Users/<user>/Documents/workspace/step-6/; cmake .; make`.
258 7. Run the executable via `Debug` -> `Start Debugging` (or press `F5`) and celebrate!
260 # Using deal.II on native Windows
262 **Warning: please be aware that the following is experimental and you will
263 likely encounter bugs in compilers and deal.II itself. Only continue if you
264 are willing to experiment.**
268 Since deal.II 8.4.0 we have experimental support for the newer Visual
269 Studio C++ compilers (2017 or newer), but this is still work in progress.
270 You can check the current development status
271 [here](https://github.com/dealii/dealii/issues/1921)
273 Installation instructions:
275 1. Download and install Visual Studio 2017:
276 https://www.visualstudio.com/vs/ and make sure you select the C++
278 2. Install cmake from https://cmake.org/download/ (pick the windows
280 3. Extract deal.II to a folder, for example c:\dealii (or clone the git
282 4. Configure using cmake by opening the 64bit command line shortcut and
286 set PreferredToolArchitecture=x64
290 cmake -G "Visual Studio 15 2017 Win64" ..
292 <b>Note:</b> Setting the tool architecture to 64 bit works around problems of
293 the compiler or linker running out of memory and leads to much quicker
295 <b>Note:</b> Use generator ``"Visual Studio 15 2017 Win64"`` for Visual Studio
298 6. Compile and install the library by opening ``deal.II.sln`` in
299 c:\dealii\build, pick the install target and compile. Note: you need to
300 either compile in the same terminal as above (using ``cmake --build .``)
301 or open ``devenv.exe`` from the same terminal, to use the 64 bit tool
304 7. in cmd go to one of the examples in c:\dealii\examples\step-xy:
306 cmake -D DEAL_II_DIR=c:\dealii\build -G "Visual Studio 15 2017 Win64" .
309 8. Open the newly created solution (step-xy.sln) in that directory and
312 ## Running build tests on Windows:
314 Install git and mingw (for perl etc). Then create a .bat file:
316 git pull origin master
317 rmdir /Q /S buildtest17
320 ctest -C Debug -DMAKEOPTS="/m:1" -DCTEST_CMAKE_GENERATOR="Visual Studio 15 2017" -S ../tests/run_buildtest.cmake -V
326 Cygwin and forks such as MinGW and MinGW-64 are unsupported due to multiple
327 unresolved miscompilation issues.
329 ## Other Windows compilers
331 We haven't had much success with any other compiler on Windows (Intel,