I am unable to find a working solution for building the librevenge static libs for Windows.
For wider context, I need to build the librevenge static libraries because this is a dependancy for the libcdr library. I need libcdr to work on 64 bit windows (release) so I need to build librevenge for x64/release.
For reference, this is the librevenge project I have cloned from GitHub: https://github.com/Distrotech/librevenge
The librevenge project uses GNU Make to handle the build process and from experimenting I have found I am unable to run the autogen.sh and configure scripts in the Windows Git Bash terminal due to many errors ranging from syntax issues to multiple missing packages. I can confirm these scripts run correctly on WSL and MacOS just fine with very few problems that were straight forward to resolve after a few google searches. Of course, this is to be expected since Windows is not part of the UNIX family and GNU Make is made to work on UNIX based systems.
Using Visual Studio
According to the librevenge README, there are workspaces in build/win32/ where the static libs can be built from the Visual Studio solution files provided. Inside build/win32 I have opened the librevenge.vcxproj.sln in VS2022 and I have changed the solution configurations to output release/x64.
Strangely, there are many source files that are referenced in the librevenge project but of them do not actually exist anywhere in the repo. As expected, the project is unable to be built as a result of this.
Visual Studio missing source file errors
I have tried checking out to different tags in the librevenge repo for example librevenge-0.0.4, librevenge-0.0.0 etc. and encountering the same errors when attempting to build the VS project.
My assumptions are the visual studio solutions have not been updated to match the source files used in the newer version of librevenge. If this is the case, is there perhaps a workaround I could use to find what source files are needed to successfully compile the librevenge project?
Using GNU Make in WSL
An alternative is to use WSL to emulate a linux distrobuiton on my Windows machine. Using the g++ compiler I have successfully compiled the librevenge library in the form of .so files.
I have tried using x86_64-w64-mingw32-g++ which is capable of cross-compilation.
Commands:
./autogen.sh
No problems here once the correct packages are installed.
./configure --build=x86_64-linux-gnu --host=x86_64-w64-mingw32 CC=x86_64-w64-mingw32-g++ --disable-werror
Has taken some time to work out what parameters are required for cross-compilation but I believe this is getting closer to what I need. So --build is specifying the current environment I am building in and --host is 64 bit Windows which I am building for. I need --disable-werror so that the compiler ignores "unnecessary parathenses" that ceases compilation.
make
Here I am encountering a problem where the zlib.h cannot be found even though zlib.h is already installed in usr/include and usr/x86_64-w64-mingw32-g++/include.
I may continue down this route of getting cross-compilation to work but I would much rather have the library built natively in Windows using Visual Studio.
Summary
Going forward, please may I have some pointers on either building librevenge in Visual Studio or WSL. As I said previously, I would rather build librevenge on Visual Studio since this would make building for Windows straight forward in future.