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

8276672: Cannot build hsdis on WSL #6269

Closed
wants to merge 5 commits into from
Closed
Changes from all 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
@@ -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