Hi Everyone,
I've been working on getting the OpenJDK to build on WSL (Windows Subsystem for
Linux). Currently, our Windows build uses Cygwin. Given that WSL is provided
with newer versions of the OS (and doesn't suffer from many of the issues that
Cygwin does, given that it is built into the Windows kernel), I think it would
be great if OpenJDK would support building on WSL. I've attached a patch with
my proposed changes.
One important thing to note is that the WSL build targets Windows. It is also
possible to use WSL to target itself (a WSL Linux binary) or even other
distributions of Linux. I have not implemented that yet, but I think I could
do that as a next step if you guys think it would be useful (at least I think
it would be useful, then you can test your changes for both Windows and Linux
on one system...).
Steps in case you want to try this out:
1. Due to autotools not handling spaces well, you have to create symlinks
in Windows that will allow you to access Windows Kits and the VC++ compiler
without spaces in the path:
mklink /D C:\VS "C:\Program Files (x86)\Microsoft Visual Studio"
mklink /D C:\WindowsKits "C:\Program Files (x86)\Windows Kits"
2. wsl must be started from a Windows Developer command prompt. To
ensure the correct environment variables are propagated from Windows to WSL,
you can run the following commands:
set WSLENV=INCLUDE/l:LIBPATH/l
3. Start wsl (bash):
wsl
4. After starting bash you must set your compiler variables to explicitly
point to the correct tools:
export
AR=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/lib.exe
export
CC=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
export
CXX=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
export
LD=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/link.exe
export RC=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/rc.exe
export MT=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/mt.exe
export
DUMPBIN=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/dumpbin.exe
5. Run configure:
./configure
--with-boot-jdk=/mnt/c/Users/Andrew/Downloads/openjdk-11.0.1_windows-x64_bin/jdk-11.0.1
--with-tools-dir="C:\VS\2017\Enterprise\VC\Auxiliary"
--with-ucrt-dll-dir="/mnt/c/WindowsKits/10/Redist/ucrt/DLLs/x64"
6. Run make
I've tested make with the default target as well as "make images"
Let me know if you have any feedback/comments.
Thanks,
-Andrew
ÿþd i f f - - g i t a / m a k e / I m a g e s . g m k
b / m a k e / I m a g e s . g m k
- - - a / m a k e / I m a g e s . g m k
+ + + b / m a k e / I m a g e s . g m k
@ @ - 9 9 , 7 + 9 9 , 7 @ @
)
i f e q ( $ ( B U I L D _ C D S _ A R C H I V E ) ,
t r u e )
$ ( c a l l L o g W a r n , C r e a t i n g C D S
a r c h i v e f o r j d k i m a g e )
- $ ( J D K _ I M A G E _ D I R ) / b i n / j a v a
- X s h a r e : d u m p - X m x 1 2 8 M - X m s 1 2 8 M
$ ( L O G _ I N F O )
+
$ ( J D K _ I M A G E _ D I R ) / b i n / j a v a $ ( E X E _ S U F F I X )
- X s h a r e : d u m p - X m x 1 2 8 M - X m s 1 2 8 M
$ ( L O G _ I N F O )
e n d i f
$ ( T O U C H ) $ @
@ @ - 1 1 4 , 7 + 1 1 4 , 7 @ @
)
i f e q ( $ ( B U I L D _ C D S _ A R C H I V E ) ,
t r u e )
$ ( c a l l L o g W a r n , C r e a t i n g C D S
a r c h i v e f o r j r e i m a g e )
- $ ( J R E _ I M A G E _ D I R ) / b i n / j a v a
- X s h a r e : d u m p - X m x 1 2 8 M - X m s 1 2 8 M
$ ( L O G _ I N F O )
+
$ ( J R E _ I M A G E _ D I R ) / b i n / j a v a $ ( E X E _ S U F F I X )
- X s h a r e : d u m p - X m x 1 2 8 M - X m s 1 2 8 M
$ ( L O G _ I N F O )
e n d i f
$ ( T O U C H ) $ @
d i f f - - g i t a / m a k e / a u t o c o n f / b a s i c s . m 4
b / m a k e / a u t o c o n f / b a s i c s . m 4
- - - a / m a k e / a u t o c o n f / b a s i c s . m 4
+ + + b / m a k e / a u t o c o n f / b a s i c s . m 4
@ @ - 6 0 7 , 6 + 6 0 7 , 7 @ @
# T h e s e a r e n o t r e q u i r e d o n a l l
p l a t f o r m s
B A S I C _ P A T H _ P R O G S ( C Y G P A T H , c y g p a t h )
+ B A S I C _ P A T H _ P R O G S ( W S L P A T H , w s l p a t h )
B A S I C _ P A T H _ P R O G S ( D F , d f )
B A S I C _ P A T H _ P R O G S ( C P I O , [ c p i o
b s d c p i o ] )
B A S I C _ P A T H _ P R O G S ( N I C E , n i c e )
@ @ - 6 3 4 , 8 + 6 3 5 , 1 0 @ @
B A S I C _ C H E C K _ P A T H S _ W I N D O W S
e l s e
P A T H _ S E P = "