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>
92 At this point, let us install a number of useful, additional tools:
94 root@computer# apt install build-essential cmake ninja-build gdb clang clang-format
96 Do you want to continue? [Y/n] <Enter>
99 If you plan to use graphical tools, a number of useful programs are:
101 root@computer# apt install xterm gnuplot
103 Do you want to continue? [Y/n] <Enter>
106 If you plan to use MSVC, you will also need to install ssh, zip and
109 root@computer# apt install ssh zip unzip
111 Do you want to continue? [Y/n] <Enter>
114 Now, exit the root account:
120 2. Do a quick "smoke test" whether everything installed fine by compiling
121 and running the first example step:
124 user@computer$ cp -r /usr/share/doc/libdeal.ii-doc/examples/step-55 .
125 user@computer$ cd step-55
126 user@computer$ cmake .
127 user@computer$ make release
128 user@computer$ make run
130 [100%] Built target run
133 ## (Recommended) Installing an X server
135 In order to run graphical applications from within the Linux Subsystem a
136 so-called X server has to be installed. This step is in particular
137 necessary, if you plan to install
138 [Eclipse](https://github.com/dealii/dealii/wiki/Eclipse), or
139 [KDevelop](https://github.com/dealii/dealii/wiki/KDevelop) via the Linux
142 1. Download and install [xming](https://sourceforge.net/projects/xming/).
144 2. Start xming. A styliced X should appear in the task bar.
146 3. Open a Linux terminal and try to run xterm:
148 user@computer$ export DISPLAY=:0
151 This should spawn a new window with a shell. Simply close the shell
154 4. In order to avoid to have to export `DISPLAY=:0` every single time, it
155 is convenient to append
159 to the end of the `.bashrc` file.
161 You should now be able to proceed and run all graphical and command lines
162 tools that are mentioned in the documentation and video lectures about
166 ## (Optional) Installing Microsoft Visual Studio Community Edition
168 This step is optional and only needed if you intent to use MSVC for code
169 development. (Great alternatives are
170 [Eclipse](https://github.com/dealii/dealii/wiki/Eclipse), or
171 [KDevelop](https://github.com/dealii/dealii/wiki/KDevelop).)
173 1. Go to the [Microsoft website](https://www.visualstudio.com/downloads)
174 and download Microsoft Visual Studio Community Edition
176 2. Launch the web installer. Make sure to select "Linux development with C++"
180 ### Create MSVC project
182 Next, let us create a small example project with MSVC. First, you have to
183 decide where the MSVC project shall be located. For this example we will
184 use the directory `workspace` in the (Windows) documents directory of the
185 current user located on driver C. The corresponding path to access this
186 directory from Linux is `/mnt/c/Users/<user>/Documents/workspace`. (Substitute
187 `<user>` with your Windows username in the following console listings!)
189 1. Copy an example step to the Windows user directory. For this, start the Linux
190 terminal again and `cd` to the user directory and copy and example step:
192 user@computer$ mkdir -p /mnt/c/Users/<user>/Documents/workspace
193 user@computer$ cd /mnt/c/Users/<user>/Documents/workspace
194 user@computer$ cp -r /usr/share/doc/libdeal.ii-doc/examples/step-6 .
195 user@computer$ cd step-6
196 user@computer$ cmake .
199 2. (Only once) Download a script for generating Visual C++ Linux project files:
201 user@computer$ cd /mnt/c/Users/<user>/Documents/workspace
202 user@computer$ git clone https://github.com/robotdad/vclinux
205 3. Generate the Visual C++ Linux project file:
207 user@computer$ cd /mnt/c/Users/<user>/Documents/workspace/step-6
208 user@computer$ ../vclinux/bash/genvcxproj.sh . step-6.vcxproj
211 4. Start the sshd server:
213 root@computer$ sudo service ssh start
215 Make sure to keep the terminal open and the sshd server running while working in Visual Studio
217 5. Configure the project in Visual Studio
218 * Open the project file `c:\Users\<user>\Documents\workspace\step-6.vcxproj` in Visual Studio.
219 * In the `Solution Explorer` right-click on the project and select `Properties`
220 * Go to the `Debugging` page and set `Program` to `/mnt/c/Users/<user>/Documents/workspace/step-6/step-6`.
221 * Go to the `Build` page and set `Build Command Line` to `cd /mnt/c/Users/<user>/Documents/workspace/step-6/; cmake .; make`.
223 6. Run the executable via `Debug` -> `Start Debugging` (or press `F5`) and celebrate!
225 # Using deal.II on native Windows
227 **Warning: please be aware that the following is experimental and you will
228 likely encounter bugs in compilers and deal.II itself. Only continue if you
229 are willing to experiment.**
233 Since deal.II 8.4.0 we have experimental support for the newer Visual
234 Studio C++ compilers (2017 or newer), but this is still work in progress.
235 You can check the current development status
236 [here](https://github.com/dealii/dealii/issues/1921)
238 Installation instructions:
240 1. Download and install Visual Studio 2017:
241 https://www.visualstudio.com/vs/ and make sure you select the C++
243 2. Install cmake from https://cmake.org/download/ (pick the windows
245 3. Extract deal.II to a folder, for example c:\dealii (or clone the git
247 4. Configure using cmake by opening the 64bit command line shortcut and
251 set PreferredToolArchitecture=x64
255 cmake -G "Visual Studio 15 2017 Win64" ..
257 <b>Note:</b> Setting the tool architecture to 64 bit works around problems of
258 the compiler or linker running out of memory and leads to much quicker
260 <b>Note:</b> Use generator ``"Visual Studio 15 2017 Win64"`` for Visual Studio
263 6. Compile and install the library by opening ``deal.II.sln`` in
264 c:\dealii\build, pick the install target and compile. Note: you need to
265 either compile in the same terminal as above (using ``cmake --build .``)
266 or open ``devenv.exe`` from the same terminal, to use the 64 bit tool
269 7. in cmd go to one of the examples in c:\dealii\examples\step-xy:
271 cmake -D DEAL_II_DIR=c:\dealii\build -G "Visual Studio 15 2017 Win64" .
274 8. Open the newly created solution (step-xy.sln) in that directory and
277 ## Running build tests on Windows:
279 Install git and mingw (for perl etc). Then create a .bat file:
281 git pull origin master
282 rmdir /Q /S buildtest17
285 ctest -C Debug -DMAKEOPTS="/m:1" -DCTEST_CMAKE_GENERATOR="Visual Studio 15 2017" -S ../tests/run_buildtest.cmake -V
291 Cygwin and forks such as MinGW and MinGW-64 are unsupported due to multiple
292 unresolved miscompilation issues.
294 ## Other Windows compilers
296 We haven't had much success with any other compiler on Windows (Intel,