8245033: Fixes for building in WSL
Reviewed-by: erikj
This commit is contained in:
parent
e13c481c7f
commit
8c5430972f
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2017, 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
|
||||
@ -35,17 +35,22 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
|
||||
$(FIXPATH_COPY): $(firstword $(FIXPATH))
|
||||
$(call install-file)
|
||||
|
||||
FIXPATH_WORKSPACE_ROOT := $(call FixPath, $(WORKSPACE_ROOT))
|
||||
FIXPATH_OUTPUTDIR := $(call FixPath, $(OUTPUTDIR))
|
||||
else
|
||||
FIXPATH_WORKSPACE_ROOT := $(WORKSPACE_ROOT)
|
||||
FIXPATH_OUTPUTDIR := $(OUTPUTDIR)
|
||||
endif
|
||||
|
||||
BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties
|
||||
|
||||
FIXPATH_ECHO := $(FIXPATH) $(call FixPath, $(ECHO))
|
||||
BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties
|
||||
|
||||
$(BUILD_INFO_PROPERTIES):
|
||||
$(call MakeTargetDir)
|
||||
$(ECHO) "# Build info properties for JDK tests" > $@
|
||||
$(FIXPATH_ECHO) "build.workspace.root=$(WORKSPACE_ROOT)" >> $@
|
||||
$(FIXPATH_ECHO) "build.output.root=$(OUTPUTDIR)" >> $@
|
||||
$(ECHO) "build.workspace.root=$(FIXPATH_WORKSPACE_ROOT)" >> $@
|
||||
$(ECHO) "build.output.root=$(FIXPATH_OUTPUTDIR)" >> $@
|
||||
|
||||
prepare-test-image: $(FIXPATH_COPY) $(BUILD_INFO_PROPERTIES)
|
||||
$(call MakeDir, $(TEST_IMAGE_DIR))
|
||||
|
@ -423,24 +423,16 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
|
||||
# is the same. On older AIXes we just continue to live with a "not local build" warning.
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
DF_LOCAL_ONLY_OPTION='-T local'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# In WSL, we can only build on a drvfs file system (that is, a mounted real Windows drive)
|
||||
DF_LOCAL_ONLY_OPTION='-t drvfs'
|
||||
else
|
||||
DF_LOCAL_ONLY_OPTION='-l'
|
||||
fi
|
||||
if $DF $DF_LOCAL_ONLY_OPTION $1 > /dev/null 2>&1; then
|
||||
$2
|
||||
else
|
||||
# In WSL, local Windows drives are considered remote by df, but we are
|
||||
# required to build into a directory accessible from windows, so consider
|
||||
# them local here.
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
if $DF $1 | $GREP -q "^[[A-Z]]:"; then
|
||||
$2
|
||||
else
|
||||
$3
|
||||
fi
|
||||
else
|
||||
$3
|
||||
fi
|
||||
$3
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
@ -97,7 +97,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
||||
UTIL_PATH_PROGS(NICE, nice)
|
||||
|
||||
UTIL_PATH_PROGS(LSB_RELEASE, lsb_release)
|
||||
UTIL_PATH_PROGS(CMD, [cmd.exe /mnt/c/Windows/System32/cmd.exe])
|
||||
UTIL_PATH_PROGS(CMD, cmd.exe, /mnt/c/Windows/System32)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
|
@ -634,7 +634,12 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
|
||||
# There is no specific version flag, but all output starts with a version string.
|
||||
# First line typically looks something like:
|
||||
# Microsoft (R) Incremental Linker Version 12.00.31101.0
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
LINKER_VERSION_STRING=`$LD 2>&1 | $HEAD -n 1 | $TR -d '\r'`
|
||||
PATH="$old_path"
|
||||
# Extract version number
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
|
||||
@ -732,13 +737,23 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
||||
UTIL_FIXUP_EXECUTABLE(LD)
|
||||
# Verify that we indeed succeeded with this trick.
|
||||
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
|
||||
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
|
||||
"$LD" --version > /dev/null
|
||||
|
||||
if test $? -eq 0 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
PATH="$old_path"
|
||||
|
||||
LDCXX="$LD"
|
||||
# jaotc being a windows program expects the linker to be supplied with exe suffix.
|
||||
LD_JAOTC="$LD$EXE_SUFFIX"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 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
|
||||
@ -485,10 +485,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
fi
|
||||
|
||||
# Now execute the newly created bat file.
|
||||
# The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
|
||||
# Change directory so we don't need to mess with Windows paths in redirects.
|
||||
cd $VS_ENV_TMP_DIR
|
||||
$CMD /c extract-vs-env.bat | $CAT
|
||||
$CMD /c extract-vs-env.bat > extract-vs-env.log 2>&1
|
||||
cd $CONFIGURE_START_DIR
|
||||
|
||||
if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
|
||||
|
@ -534,7 +534,7 @@ AC_DEFUN([UTIL_SETUP_TOOL],
|
||||
# Otherwise we believe it is a complete path. Use it as it is.
|
||||
AC_MSG_NOTICE([Will use user supplied tool "$tool_command"])
|
||||
AC_MSG_CHECKING([for $tool_command])
|
||||
if test ! -x "$tool_command"; then
|
||||
if test ! -x "$tool_command" && test ! -x "$tool_command.exe"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_command" does not exist or is not executable])
|
||||
fi
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 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
|
||||
@ -127,10 +127,15 @@ AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL],
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([TOPDIR_windows])
|
||||
# First convert to Windows path to make input valid for cmd
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([input_path])
|
||||
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
|
||||
# which, in combination with WSLENV, will make the WSL layer complain
|
||||
old_path="$PATH"
|
||||
PATH=
|
||||
new_path=`$CMD /c $TOPDIR_windows/make/scripts/windowsShortName.bat "$input_path" \
|
||||
| $SED -e 's|\r||g' \
|
||||
| $TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
# Rewrite back to unix style
|
||||
PATH="$old_path"
|
||||
UTIL_REWRITE_AS_UNIX_PATH([new_path])
|
||||
fi
|
||||
])
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 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
|
||||
@ -465,8 +465,13 @@ endif
|
||||
# This is normally not needed since we use the FIXPATH prefix for command lines,
|
||||
# but might be needed in certain circumstances.
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
FixPath = \
|
||||
ifeq ($(call isBuildOsEnv, windows.wsl), true)
|
||||
FixPath = \
|
||||
$(shell $(WSLPATH) -m $1)
|
||||
else
|
||||
FixPath = \
|
||||
$(shell $(CYGPATH) -m $1)
|
||||
endif
|
||||
else
|
||||
FixPath = \
|
||||
$1
|
||||
|
@ -1049,7 +1049,7 @@ define SetupNativeCompilationBody
|
||||
endif
|
||||
|
||||
ifeq ($$($1_TYPE), STATIC_LIBRARY)
|
||||
$1_VARDEPS := $$($1_AR) $$($1_ARFLAGS) $$($1_LIBS) \
|
||||
$1_VARDEPS := $$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $$($1_LIBS) \
|
||||
$$($1_EXTRA_LIBS)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
|
||||
@ -1067,7 +1067,7 @@ define SetupNativeCompilationBody
|
||||
$$(call LogInfo, Building static library $$($1_BASENAME))
|
||||
$$(call MakeDir, $$($1_OUTPUT_DIR) $$($1_SYMBOLS_DIR))
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
|
||||
$$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
|
||||
$$($1_RES))
|
||||
ifeq ($(STATIC_BUILD), true)
|
||||
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
|
||||
|
@ -998,9 +998,11 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
: input.target_platform);
|
||||
|
||||
var devkit_cross_prefix = "";
|
||||
if (input.build_platform != input.target_platform
|
||||
&& input.build_platform != devkit_platform) {
|
||||
devkit_cross_prefix = input.build_platform + "-to-";
|
||||
if (!(input.target_os == "windows" && isWsl(input))) {
|
||||
if (input.build_platform != input.target_platform
|
||||
&& input.build_platform != devkit_platform) {
|
||||
devkit_cross_prefix = input.build_platform + "-to-";
|
||||
}
|
||||
}
|
||||
|
||||
var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
|
||||
|
Loading…
x
Reference in New Issue
Block a user