Created 7 October 2023
msys2 provides an environment much like posix/unix/linux with programs precompiled for use on windows installed in its own set of locations.
Do not use the -DWALL option to cmake or --enable-wall to configure or the meson equivalent as it causes a minor warning about I64u , from gcc (treated as an error).
When using configure note that building a static library libdwarf.a is not supported. A static libdwarf.a can be built with meson or cmake.
Libdwarf builds from configure and cmake are static (archive) library builds by default. Meson builds to a shared library by default.
On msys2 with cmake one can generate a shared library build with:
-DBUILD_SHARED=YES -DBUILD_NON_SHARED=NO
With the following on the meson command line one can build libdwarf as an archive and dwarfdump and the programs built will use the static library.
--default-library static
The meson default is shared and can be explicitly chosen by:
--default-library shared
configure will only allow generation of shared library builds, while for cmake and meson one can choose whether to build a shared library or a static (archive) library (libdwarf.a).
On msys2 with configure one gets a shared library build with:
--enable-shared --disable-static
If you are are linking code against a static library libdwarf.a you must arrange to define the macro LIBDWARF_STATIC in compiling your code that does a #include "libdwarf.h".
To pass LIBDWARF_STATIC to the preprocessor with Visual Studio:
right click on a project name
In the contextual menu, click on Properties at the very bottom
In the new window, double click on C/C++
On the right, click on Preprocessor definitions
The is a small down arrow on the right, click on it, then click on Modify
Add LIBDWARF_STATIC to the values
Click on OK to close the windows
We suggest you use meson for msys2 builds.
Direct your browser to msys2.org
Download a recent .exe from the downloads page. For example msys2-x86_64-20230718.exe Execute it and follow the instructions on msys2.org
A straightforward way to use the tests etc in the source is to find the appropriate MSYS2 shell program and put a link to it on the desktop. The Windows list of applications will show MSYS2 and under that category there will be a list of candidates to use.
The useful candidates on x86_64 are are
MSYS2 MINGW64 The compiler is gcc
MSYS2 CLANG64 The compiler is clang
the following should get you sufficient files for building and testing all the build mechanisms:
basics
pacman -Suy
pacman -S base-devel git autoconf automake libtool
pacnam -S mingw-w64-x86_64-python3
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-zlib
pacman -S mingw-w64-x86_64-zstd
pacman -S mingw-w64-x86_64-doxygen
extras for meson/cmake
pacman -S mingw-w64-x86_64-meson
pacman -S mingw-w64-x86_64-cmake
pacnam -S mingw-w64-x86_64-python3-pip
To create a distribution one needs xz:
pacman -S mingw-w64-x86_64-xz
to list packages
pacman -Q
to remove packages
pacman -R <packagename>
cmake will generate ninja makefiles on mingw by default, add '-G "Unix Makefiles"' to the cmake command line to generate makefiles for gnu make, but we suggest you use "-G Ninja" for speed and clarity..
This checks for the existence critical executables such as cmake,meson,and ninja and only runs builds that could work.
sh scripts/allsimplebuilds.sh
To get a usable set of executables set a prefix (for cmake, -DCMAKE_INSTALL_PREFIX=$HOME/bin presuming the bin directory is something in your $PATH in msys2. Set an appropriate prefix whichever build tool you use.
ninja install cp src/bin/dwarfdump/dwarfdump.conf to $HOME
dwarfdump.exe