First steps in building with MSVC 14 / Visual Studio 2015
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?
On 03/13/18 13:10, Pedro Giffuni wrote:
> Hi Damjan;
> Glad to see this progress! To build python with newer versions of
> MSVC, you may have to change the BUILD_DIR to "PCbuild".
> Look at main/python/makefile.mk line 125.
I committed a small adjustment in r1826694, to clarify better the situation.
I don't have a way of testing the windows build so feel free to revert
if I managed to break things in some spectacular way :-/.
To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]
Re: First steps in building with MSVC 14 / Visual Studio 2015
Am 14.03.2018 um 03:39 schrieb Pedro Giffuni:
> Hi again;
> On 03/13/18 13:10, Pedro Giffuni wrote:
>> Hi Damjan;
>> Glad to see this progress! To build python with newer versions of
>> MSVC, you may have to change the BUILD_DIR to "PCbuild".
>> Look at main/python/makefile.mk line 125.
> I committed a small adjustment in r1826694, to clarify better the
> I don't have a way of testing the windows build so feel free to revert
> if I managed to break things in some spectacular way :-/.
My latest builds for Windows (with Cygwin64) were successful. ;-)