Windows
This wiki page contains information about how to use deal.II on the
For an overview of different ways to use deal.II on Windows have a look at the corresponding FAQ entry.
Windows 10 has gained a compatibility layer for running Linux binaries natively on Windows. You can find more information on the Wikipedia page.
In the following section a detailed HowTo is given to install the subsystem and a Linux distribution on top of it. Our choice at hand is Ubuntu 20.04 but the latest Debian GNU/Linux is also a good choice. With both, you can install the latest deal.II release in binary form.
Have a look at the excellent documentation about the Linux subsystem on the Windows help pages
-
(As described in detail on the Windows help pages, we first have to install the subsystem. For this, locate the Windows PowerShell in your Start menu (
Start
->Windows PowerShell
), right click onWindows PowerShell
->More
->Run as administrator
-
Install the subsystem by using the following command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
and restart
-
Open the Microsoft Store and search for "Ubuntu", and install it. When finished start the application. You will be prompted to create a user account with username and password.
-
Switch to the "root" account by running
sudo -i
Enter the password that you used in step 3.
We continue the installation process by installing the deal.II library with
development headers and documentation. The packages in Debian or Ubuntu
are called libdeal.ii-dev
and libdeal.ii-doc
:
-
As root user (see above) run:
export REPO=ppa:ginggs/deal.ii-9.3.0-backports apt-get update && apt-get install -y software-properties-common add-apt-repository $REPO apt-get update apt-get install libdeal.ii-dev libdeal.ii-doc
At this point, let us install a number of useful, additional tools:
root@computer# apt install build-essential cmake ninja-build gdb clang-format git-core [...] Do you want to continue? [Y/n] <Enter> [...]
If you plan to use graphical tools, a number of useful programs are:
root@computer# apt install xterm gnuplot [...] Do you want to continue? [Y/n] <Enter> [...]
You can also install gnuplot and ParaView natively on Windows to view the files created by deal.II.
Finally, exit the root account:
root@computer# exit user@computer$
-
Do a quick "smoke test" whether everything installed fine by compiling and running the first example step:
user@computer$ cd user@computer$ cp -r /usr/share/doc/libdeal.ii-doc/examples/step-55 . user@computer$ cd step-55 user@computer$ cmake . user@computer$ make release user@computer$ make run [...] [100%] Built target run
In order to run graphical applications from within the Linux Subsystem a so-called X server has to be installed. This step is in particular necessary, if you plan to install Eclipse, or KDevelop via the Linux subsystem.
-
Download and install xming.
-
Start xming. A styliced X should appear in the task bar.
-
Open a Linux terminal and try to run xterm:
user@computer$ export DISPLAY=:0 user@computer$ xterm
This should spawn a new window with a shell. Simply close the shell again.
-
In order to avoid to have to export
DISPLAY=:0
every single time, it is convenient to appendexport DISPLAY=:0
to the end of the
.bashrc
file.
You should now be able to proceed and run all graphical and command lines tools that are mentioned in the documentation and video lectures about deal.II.
This step is optional and only needed if you intent to use MSVC for code development. (Great alternatives are Eclipse, or KDevelop.)
-
Go to the Microsoft website 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.
-
Launch the web installer. Make sure to select "Linux development with C++"
-
Restart.
-
To fix occasional IntelliSense bugs, install the Visual Studio tool IntelliSense Extender.
Next, let us create a small example project with MSVC. First, you have to
decide where the MSVC project shall be located. For this example we will
use the directory workspace
in the (Windows) documents directory of the
current user located on driver C. The corresponding path to access this
directory from Linux is /mnt/c/Users/<user>/Documents/workspace
. (Substitute
<user>
with your Windows username in the following console listings!)
-
Copy an example step to the Windows user directory. For this, start the Linux terminal again and
cd
to the user directory and copy and example step:user@computer$ mkdir -p /mnt/c/Users/<user>/Documents/workspace user@computer$ cd /mnt/c/Users/<user>/Documents/workspace user@computer$ cp -r /usr/share/doc/libdeal.ii-doc/examples/step-6 . user@computer$ cd step-6 user@computer$ cmake .
-
(Only once) Download a script for generating Visual C++ Linux project files:
user@computer$ cd /mnt/c/Users/<user>/Documents/workspace user@computer$ git clone https://github.com/robotdad/vclinux
-
Generate the Visual C++ Linux project file:
user@computer$ cd /mnt/c/Users/<user>/Documents/workspace/step-6 user@computer$ ../vclinux/bash/genvcxproj.sh . step-6.vcxproj
-
Start the sshd server:
root@computer$ sudo service ssh start
Make sure to keep the terminal open and the sshd server running while working in Visual Studio
-
Open Visual Studio and navigate to
Tools
->Options
->Cross Platform
->Connection Manager
- The Host name should be 'localhost'
- The Port should be 22
- The User Name and Password are the ones you used to set up Debian
- Hit okay and wait for Visual Studio to run through setting up the connection
-
Configure the project in Visual Studio
- Open the project file
c:\Users\<user>\Documents\workspace\step-6.vcxproj
in Visual Studio. - In the
Solution Explorer
right-click on the project and selectProperties
- Go to the
Debugging
page and setProgram
to/mnt/c/Users/<user>/Documents/workspace/step-6/step-6
and setWorking Directory
to/mnt/c/Users/<user>/Documents/workspace/step-6/
- Go to the
Remote Build
page and setBuild Command Line
tocd "/mnt/c/Users/<user>/Documents/workspace/step-6/" && cmake . && make
.
- Open the project file
-
Run the executable via
Debug
->Start Debugging
(or pressF5
) and celebrate!
Warning: please be aware that the following is experimental and you will likely encounter bugs in compilers and deal.II itself. Only continue if you are willing to experiment.
Since deal.II 8.4.0 we have experimental support for the newer Visual Studio C++ compilers (2017 or newer), but this is still work in progress. You can check the current development status here
Installation instructions:
-
Download and install Visual Studio (2017 or newer): https://www.visualstudio.com/vs/ and make sure you select the C++ compiler
-
Install cmake from https://cmake.org/download/ (pick the windows installer)
-
Extract deal.II to a folder, for example c:\dealii (or clone the git development version)
-
Configure using cmake by opening the 64bit command line shortcut and run:
set PreferredToolArchitecture=x64 cd c:\dealii mkdir build cd c:\dealii\build cmake -G "Visual Studio 15 2017 Win64" ..
Note: Setting the tool architecture to 64 bit works around problems of the compiler or linker running out of memory and leads to much quicker compile times.
Note: Use generator
"Visual Studio 15 2017 Win64"
for Visual Studio 2017 andVisual Studio 16 2019"
for Visual Studio 2019. -
Compile and install the library by opening
deal.II.sln
in c:\dealii\build, pick the install target and compile. Note: you need to either compile in the same terminal as above (usingcmake --build .
) or opendevenv.exe
from the same terminal, to use the 64 bit tool architecture. -
in cmd go to one of the examples in c:\dealii\examples\step-xy:
cmake -D DEAL_II_DIR=c:\dealii\build -G "Visual Studio 15 2017 Win64" .
or
cmake -D DEAL_II_DIR=c:\dealii\build -G "Visual Studio 16 2019" .
-
Open the newly created solution (step-xy.sln) in that directory and compile/run/debug.
Install git and mingw (for perl etc). Then create a .bat file:
git pull origin master
rmdir /Q /S buildtest17
mkdir buildtest17
cd buildtest17
ctest -C Debug -DMAKEOPTS="/m:1" -DCTEST_CMAKE_GENERATOR="Visual Studio 15 2017" -S ../tests/run_buildtest.cmake -V
cd ..
Cygwin and forks such as MinGW and MinGW-64 are unsupported due to multiple unresolved miscompilation issues.
We haven't had much success with any other compiler on Windows (Intel, Borland, ...).