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
This commit is contained in:
parent
55b36c6f3b
commit
38ec3a16d7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user