Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8242468: VS2019 build missing vcruntime140_1.dll #193

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/autoconf/basics.m4
Expand Up @@ -498,6 +498,8 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
# Corresponds to --with-msvcr-dll
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
# Corresponds to --with-vcruntime-1-dll
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VCRUNTIME_1_DLL])
# Corresponds to --with-msvcp-dll
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
# Corresponds to --with-ucrt-dll-dir
Expand Down
1 change: 1 addition & 0 deletions common/autoconf/spec.gmk.in
Expand Up @@ -608,6 +608,7 @@ USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
MSVCR_DLL:=@MSVCR_DLL@
VCRUNTIME_1_DLL:=@VCRUNTIME_1_DLL@
MSVCP_DLL:=@MSVCP_DLL@
UCRT_DLL_DIR:=@UCRT_DLL_DIR@

Expand Down
30 changes: 29 additions & 1 deletion common/autoconf/toolchain_windows.m4
Expand Up @@ -84,8 +84,9 @@ VS_VS_PLATFORM_NAME_2017="v141"
VS_SDK_PLATFORM_NAME_2017=

VS_DESCRIPTION_2019="Microsoft Visual Studio 2019"
VS_VERSION_INTERNAL_2019=141
VS_VERSION_INTERNAL_2019=142
VS_MSVCR_2019=vcruntime140.dll
VS_VCRUNTIME_1_2019=vcruntime140_1.dll
VS_MSVCP_2019=msvcp140.dll
VS_ENVVAR_2019="VS160COMNTOOLS"
VS_USE_UCRT_2019="true"
Expand Down Expand Up @@ -279,6 +280,7 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
fi
eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
eval VCRUNTIME_1_NAME="\${VS_VCRUNTIME_1_${VS_VERSION}}"
eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
Expand Down Expand Up @@ -325,6 +327,7 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
eval VCRUNTIME_1_NAME="\${VS_VCRUNTIME_1_${VS_VERSION}}"
eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
# The rest of the variables are already evaled while probing
Expand Down Expand Up @@ -660,6 +663,31 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
AC_SUBST(MSVCP_DLL)
fi

AC_ARG_WITH(vcruntime-1-dll, [AS_HELP_STRING([--with-vcruntime-1-dll],
[path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows only) @<:@probed@:>@])])

if test "x$VCRUNTIME_1_NAME" != "x"; then
if test "x$with_vcruntime_1_dll" != x; then
# If given explicitly by user, do not probe. If not present, fail directly.
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$with_vcruntime_1_dll],
[--with-vcruntime-1-dll])
if test "x$MSVC_DLL" = x; then
AC_MSG_ERROR([Could not find a proper $VCRUNTIME_1_NAME as specified by --with-vcruntime-1-dll])
fi
VCRUNTIME_1_DLL="$MSVC_DLL"
elif test "x$DEVKIT_VCRUNTIME_1_DLL" != x; then
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$DEVKIT_VCRUNTIME_1_DLL], [devkit])
if test "x$MSVC_DLL" = x; then
AC_MSG_ERROR([Could not find a proper $VCRUNTIME_1_NAME as specified by devkit])
fi
VCRUNTIME_1_DLL="$MSVC_DLL"
else
TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}])
VCRUNTIME_1_DLL="$MSVC_DLL"
fi
AC_SUBST(VCRUNTIME_1_DLL)
fi

AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
[path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])

Expand Down
18 changes: 18 additions & 0 deletions hotspot/make/windows/makefiles/compile.make
Expand Up @@ -169,6 +169,9 @@ COMPILER_NAME=VS2017
!if "$(MSC_VER)" == "1916"
COMPILER_NAME=VS2017
!endif
!if "$(MSC_VER)" >= "1920" && "$(MSC_VER)" <= "1929"
COMPILER_NAME=VS2019
!endif
!endif

# By default, we do not want to use the debug version of the msvcrt.dll file
Expand Down Expand Up @@ -318,6 +321,21 @@ MT=mt.exe
SAFESEH_FLAG = /SAFESEH
!endif

!if "$(COMPILER_NAME)" == "VS2019"
PRODUCT_OPT_OPTION = /O2 /Oy-
FASTDEBUG_OPT_OPTION = /O2 /Oy-
DEBUG_OPT_OPTION = /Od
GX_OPTION = /EHsc
LD_FLAGS = /manifest $(LD_FLAGS)
MP_FLAG = /MP
# Manifest Tool - used in VS2005 and later to adjust manifests stored
# as resources inside build artifacts.
!if "x$(MT)" == "x"
MT=mt.exe
!endif
SAFESEH_FLAG = /SAFESEH
!endif

!if "$(BUILDARCH)" == "i486"
LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS)
!endif
Expand Down
4 changes: 4 additions & 0 deletions hotspot/make/windows/makefiles/sanity.make
Expand Up @@ -31,6 +31,8 @@ checkCL:
if "$(MSC_VER)" NEQ "1800" \
if "$(MSC_VER)" NEQ "1900" \
if "$(MSC_VER)" NEQ "1912" \
if "$(MSC_VER)" NEQ "1920" if "$(MSC_VER)" NEQ "1921" if "$(MSC_VER)" NEQ "1922" if "$(MSC_VER)" NEQ "1923" if "$(MSC_VER)" NEQ "1924" \
if "$(MSC_VER)" NEQ "1925" if "$(MSC_VER)" NEQ "1926" if "$(MSC_VER)" NEQ "1927" if "$(MSC_VER)" NEQ "1928" if "$(MSC_VER)" NEQ "1929" \
echo *** WARNING *** unrecognized cl.exe version $(MSC_VER) ($(RAW_MSC_VER)). Use FORCE_MSC_VER to override automatic detection.

checkLink:
Expand All @@ -39,4 +41,6 @@ checkLink:
if "$(LD_VER)" NEQ "1300" \
if "$(LD_VER)" NEQ "1400" \
if "$(LD_VER)" NEQ "1412" \
if "$(LD_VER)" NEQ "1420" if "$(LD_VER)" NEQ "1421" if "$(LD_VER)" NEQ "1422" if "$(LD_VER)" NEQ "1423" if "$(LD_VER)" NEQ "1424" \
if "$(LD_VER)" NEQ "1425" if "$(LD_VER)" NEQ "1426" if "$(LD_VER)" NEQ "1427" if "$(LD_VER)" NEQ "1428" if "$(LD_VER)" NEQ "1429" \
echo *** WARNING *** unrecognized link.exe version $(LD_VER) ($(RAW_LD_VER)). Use FORCE_LD_VER to override automatic detection.
2 changes: 1 addition & 1 deletion hotspot/make/windows/makefiles/vm.make
Expand Up @@ -129,7 +129,7 @@ CXX_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER

!if "$(USE_PRECOMPILED_HEADER)" != "0"
CXX_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp"
!if "$(COMPILER_NAME)" == "VS2012" || "$(COMPILER_NAME)" == "VS2013" || "$(COMPILER_NAME)" == "VS2015" || "$(COMPILER_NAME)" == "VS2017"
!if "$(COMPILER_NAME)" == "VS2012" || "$(COMPILER_NAME)" == "VS2013" || "$(COMPILER_NAME)" == "VS2015" || "$(COMPILER_NAME)" == "VS2017" || "$(COMPILER_NAME)" == "VS2019"
# VS2012 and later require this object file to be listed:
LD_FLAGS=$(LD_FLAGS) _build_pch_file.obj
!endif
Expand Down
7 changes: 6 additions & 1 deletion jdk/make/CopyFiles.gmk
Expand Up @@ -263,12 +263,17 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
FILES := $(MSVCR_DLL), \
MACRO := copy-and-chmod))

$(eval $(call SetupCopyFiles,COPY_VCRUNTIME_1, \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(VCRUNTIME_1_DLL), \
MACRO := copy-and-chmod))

$(eval $(call SetupCopyFiles,COPY_MSVCP, \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(MSVCP_DLL), \
MACRO := copy-and-chmod))

COPY_FILES += $(COPY_MSVCR) $(COPY_MSVCP)
COPY_FILES += $(COPY_MSVCR) $(COPY_VCRUNTIME_1) $(COPY_MSVCP)

ifneq ($(UCRT_DLL_DIR), )
$(eval $(call SetupCopyFiles,COPY_UCRT_DLLS, \
Expand Down
3 changes: 3 additions & 0 deletions jdk/make/lib/CoreLibraries.gmk
Expand Up @@ -388,6 +388,9 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
# Supply the name of the C runtime lib.
LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
ifneq ($(VCRUNTIME_1_DLL), )
LIBJLI_CFLAGS += -DVCRUNTIME_1_DLL_NAME='"$(notdir $(VCRUNTIME_1_DLL))"'
endif
ifneq ($(MSVCP_DLL), )
LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
endif
Expand Down
17 changes: 17 additions & 0 deletions jdk/src/windows/bin/java_md.c
Expand Up @@ -286,6 +286,23 @@ LoadMSVCRT()
}
}
#endif /* MSVCR_DLL_NAME */
#ifdef VCRUNTIME_1_DLL_NAME
if (GetJREPath(crtpath, MAXPATHLEN)) {
if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") +
JLI_StrLen(VCRUNTIME_1_DLL_NAME) >= MAXPATHLEN) {
JLI_ReportErrorMessage(JRE_ERROR11);
return JNI_FALSE;
}
(void)JLI_StrCat(crtpath, "\\bin\\" VCRUNTIME_1_DLL_NAME); /* Add crt dll */
JLI_TraceLauncher("CRT path is %s\n", crtpath);
if (_access(crtpath, 0) == 0) {
if (LoadLibrary(crtpath) == 0) {
JLI_ReportErrorMessage(DLL_ERROR4, crtpath);
return JNI_FALSE;
}
}
}
#endif /* VCRUNTIME_1_DLL_NAME */
#ifdef MSVCP_DLL_NAME
if (GetJREPath(crtpath, MAXPATHLEN)) {
if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") +
Expand Down
3 changes: 1 addition & 2 deletions jdk/src/windows/native/sun/windows/awt_DCHolder.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,6 @@
* questions.
*/

#include "awt.h"
#include "awt_ole.h"
#include "awt_DCHolder.h" // main symbols

Expand Down
4 changes: 1 addition & 3 deletions jdk/src/windows/native/sun/windows/awt_DnDDT.cpp
Expand Up @@ -23,18 +23,16 @@
* questions.
*/

#include "awt.h"
#include <shlwapi.h>
#include <shellapi.h>
#include <memory.h>

#include "awt_DataTransferer.h"
#include "awt_Toolkit.h"
#include "java_awt_dnd_DnDConstants.h"
#include "sun_awt_windows_WDropTargetContextPeer.h"
#include "awt_Container.h"
#include "alloc.h"
#include "awt_ole.h"
#include "awt_Toolkit.h"
#include "awt_DnDDT.h"
#include "awt_DnDDS.h"

Expand Down
4 changes: 2 additions & 2 deletions jdk/src/windows/native/sun/windows/awt_ole.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,10 +26,10 @@
#ifndef AWT_OLE_H
#define AWT_OLE_H

#include "awt.h"
#include <ole2.h>
#include <comdef.h>
#include <comutil.h>
#include "awt.h"

#ifdef _DEBUG
#define _SUN_DEBUG
Expand Down
6 changes: 4 additions & 2 deletions make/devkit/createWindowsDevkit2019.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -33,7 +33,7 @@ VS_VERSION_NUM_NODOT="160"
VS_DLL_VERSION="140"
SDK_VERSION="10"
SDK_FULL_VERSION="10.0.17763.0"
MSVC_DIR="Microsoft.VC141.CRT"
MSVC_DIR="Microsoft.VC142.CRT"
MSVC_FULL_VERSION="14.12.27508"
REDIST_FULL_VERSION="14.20.27508"

Expand Down Expand Up @@ -102,6 +102,7 @@ DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
echo "Creating devkit in $DEVKIT_ROOT"

MSVCR_DLL=${MSVC_DIR}/vcruntime${VS_DLL_VERSION}.dll
VCRUNTIME_1_DLL=${MSVC_DIR}/vcruntime${VS_DLL_VERSION}_1.dll
MSVCP_DLL=${MSVC_DIR}/msvcp${VS_DLL_VERSION}.dll

################################################################################
Expand Down Expand Up @@ -188,6 +189,7 @@ echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/x64:\$DEVKIT_ROOT
echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/x64;\$DEVKIT_ROOT/VC/atlmfc/lib/x64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\""
echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\""
echo-info "DEVKIT_VCRUNTIME_1_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$VCRUNTIME_1_DLL\""
echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\""
echo-info "DEVKIT_UCRT_DLL_DIR_x86_64=\"\$DEVKIT_ROOT/10/Redist/ucrt/DLLs/x64\""
echo-info ""
Expand Down