I am not just working on the Win64 port, but also had a brief look at
building AOO with the newer MSVC 14 in Visual Studio 2015.

I used Cygwin64 but did a 32 bit AOO build. (You can do that now; my 64 bit
patches fixed the issues we had with Cygwin64 before.)

First step was patching oowintool to detect the new MSVC, by adding its
registry keys, but that wasn't sufficient and I had to use
--with-frame-home, --with-psdk-home, and co. I discovered I have different
MSVC registry keys for 32 bit and 64 bit; oowintool currently looks at the
current bitness keys first and on Cygwin64 falls back to 32 bit keys if
missing, but I think it needs to only look at keys in the AOO bitness.

Then oowintool is called to copy CRT files from MSVC, and needed more
patching copy the right files, with the new version numbers.

It turns out as of MSVC 14, Microsoft requires us link each binary with a
total of 4 C/C++ runtime libraries (https://docs.microsoft.com/en
-us/cpp/c-runtime-library/crt-library-features): the old MSVCRT.LIB which
has now become a CRT initialization library, the old MSVCPRT.LIB which
implements the C++ standard library, the new UCRT.LIB which is their new
C99 standard library, and the new VCRUNTIME.LIB which deals with exception
handling, RTTI and debugging. I guess the small mercy is that we would only
gain runtime dependencies on UCRTBASE.DLL and VCRUNTIME<version>.DLL, the
other 2 are statically linked. I hacked our dmake makefiles to link with
the new libraries by default. We'll also need to update our installer to
install the redistributable versions of these DLLs.

It also turns out that there is now this new Windows development component,
the "Windows Kit" under C:\Program Files (x86)\Windows Kits\<version>, that
you have to use, which contains the C standard header files and UCRT.LIB. I
had to hack SOLARINC and ILIB in my winenv.set.sh to add those, but we
should do that better somehow.

Anyway with those changes the build started. It successfully built a few
modules including ext_libraries/apr, then broke in main/solenv due to
PATH_MAX no longer existing in limits.h, but when I patched that, it
compiled and linked the solenv tools successfully. It broke further, in
ext_libraries/gtest, due to C++ template issues that don't seem easy to
fix. Maybe a newer version of Google Test would help; for now
--disable-unit-tests got me further, then it broke in main/python, which I
am now stuck at.

I don't think porting our code to use MSVC 14 will be that difficult. It
looks like just a few issues at the module level. Python may be hard to
fix, as it is fussy about the CRT libraries (the Python documentation says
it requires MSVCP90).

The patches need refinement before being committed. These "Windows Kits"
needs further research. Also would anyone be interested in helping?


Reply via email to