Skip to content
Permalink
Browse files
8276672: Cannot build hsdis on WSL
Co-authored-by: Magnus Ihse Bursie <ihse@openjdk.org>
Co-authored-by: Yasumasa Suenaga <ysuenaga@openjdk.org>
Reviewed-by: ihse, erikj
  • Loading branch information
YaSuenag and magicus committed Nov 10, 2021
1 parent 55b36c6 commit 38ec3a16d722d740d0b2128c6f6c2d1eab7a7c08
Showing 1 changed file with 33 additions and 5 deletions.
@@ -44,15 +44,44 @@ ifeq ($(call isTargetOs, windows), true)

MINGW_BASE := x86_64-w64-mingw32

MINGW_SYSROOT = $(shell $(MINGW_BASE)-gcc -print-sysroot)
ifeq ($(wildcard $(MINGW_SYSROOT)), )
# Use fallback path
MINGW_SYSROOT := /usr/$(MINGW_BASE)
ifeq ($(wildcard $(MINGW_SYSROOT)), )
$(error mingw sysroot not found)
endif
endif

$(eval $(call DefineNativeToolchain, TOOLCHAIN_MINGW, \
CC := $(MINGW_BASE)-gcc, \
LD := $(MINGW_BASE)-ld, \
OBJCOPY := $(MINGW_BASE)-objcopy, \
RC := $(RC), \
SYSROOT_CFLAGS := --sysroot=/usr/$(MINGW_BASE)/sys-root, \
SYSROOT_LDFLAGS := --sysroot=/usr/$(MINGW_BASE)/sys-root, \
SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT), \
SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT), \
))

MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/mingw/lib
ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), )
# Try without mingw
MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/lib
ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), )
$(error mingw sysroot lib path not found)
endif
endif

MINGW_VERSION = $(shell $(MINGW_BASE)-gcc -v 2>&1 | $(GREP) "gcc version" | $(CUT) -d " " -f 3)
MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION)
ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), )
# Try using only major version number
MINGW_VERSION_MAJOR := $(firstword $(subst ., , $(MINGW_VERSION)))
MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION_MAJOR)
ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), )
$(error mingw gcc lib path not found)
endif
endif

TOOLCHAIN_TYPE := gcc
OPENJDK_TARGET_OS := linux
CC_OUT_OPTION := -o$(SPACE)
@@ -66,9 +95,8 @@ ifeq ($(call isTargetOs, windows), true)

HSDIS_TOOLCHAIN := TOOLCHAIN_MINGW
HSDIS_TOOLCHAIN_CFLAGS :=
HSDIS_TOOLCHAIN_LDFLAGS := -L/usr/lib/gcc/$(MINGW_BASE)/9.2.0 \
-L/usr/$(MINGW_BASE)/sys-root/mingw/lib
MINGW_DLLCRT := /usr/$(MINGW_BASE)/sys-root/mingw/lib/dllcrt2.o
HSDIS_TOOLCHAIN_LDFLAGS := -L$(MINGW_GCC_LIB_PATH) -L$(MINGW_SYSROOT_LIB_PATH)
MINGW_DLLCRT := $(MINGW_SYSROOT_LIB_PATH)/dllcrt2.o
HSDIS_TOOLCHAIN_LIBS := $(MINGW_DLLCRT) -lmingw32 -lgcc -lgcc_eh -lmoldname \
-lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32
else

1 comment on commit 38ec3a1

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 38ec3a1 Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.