Windows 10 Enterprise(1607) 编译 Openjdk 9

由于Windows和Mac的编译流程大同小异,如果需要查阅编译流程请参考我的另一篇博文Mac OSX 10.12.1 编译 Openjdk 9

1.编译配置

./configure --with-target-bits=64 --with-freetype=/cygdrive/d/SoftwareFiles/Win/Freetype/2.7 --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-zip-debug-info --disable-warnings-as-errors --with-debug-level=slowdebug --with-boot-jdk=/cygdrive/d/SoftwareFiles/Win/Oracle/Java/Jdk 2>&1 | tee configure_win_x64.log

2.开始编译

export LANG=C

make all LOG=debug 2>&1 | tee make_win_x64.log

下面是我这里编译完成后的信息

----- Build times -------
Start 2016-11-20 22:40:02
End   2016-11-20 22:45:48

00:05:46 TOTAL
-------------------------
/usr/bin/printf "Finished building target 'all' in configuration 'windows-x86_64-normal-serverANDclient-slowdebug'\n" > >(/usr/bin/tee -a /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/build.log) 2> >(/usr/bin/tee -a /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/build.log >&2) && wait
Finished building target 'all' in configuration 'windows-x86_64-normal-serverANDclient-slowdebug'

编译过程中遇到的问题:

问题1:

/usr/bin/touch /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/headers/_the.java.compact1_headers
( /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/configure-support/bin/fixpath.exe -c /cygdrive/d/softwa~1/win/micros~1/visual~1/12.0/vc/bin/amd64/cl -Fp/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/BUILD_GTEST_LIBJVM.pch -Yuprecompiled.hpp -homeparams -D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_ -nologo -W3 -MD -MP -DVM_LITTLE_ENDIAN -D_LP64=1 -DASSERT -D_NMT_NOINLINE_ -DTARGET_ARCH_x86 -DINCLUDE_SUFFIX_OS=_windows -DINCLUDE_SUFFIX_CPU=_x86 -DTARGET_COMPILER_visCPP -DAMD64 -DHOTSPOT_LIB_ARCH='"amd64"' -DCOMPILER1 -DCOMPILER2 -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/src/share/vm -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/src/os/windows/vm -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/src/cpu/x86/vm -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/src/os_cpu/windows_x86/vm -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/gensrc -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/src/share/vm/precompiled -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/src/share/vm/prims -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/test/fmw/gtest -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/test/fmw/gtest/include -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/test/native -EHsc -EHsc -Z7 -d2Zi+ -I/cygdrive/d/softwa~1/win/micros~1/visual~1/12.0/vc/include -I/cygdrive/d/softwa~1/win/micros~1/visual~1/12.0/vc/atlmfc/include -I/cygdrive/c/progra~2/wi3cf2~1/8.1/include/shared -I/cygdrive/c/progra~2/wi3cf2~1/8.1/include/um -I/cygdrive/c/progra~2/wi3cf2~1/8.1/include/winrt -DTHIS_FILE='"test_json.cpp"' -c -showIncludes -Fd/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/pdb/test_json.pdb -Fo/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.obj /cygdrive/d/DocumentFls/Wor/Java/jdk9/hotspot/test/native/utilities/test_json.cpp > >(/usr/bin/tee /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.obj.log) 2> >(/usr/bin/tee /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.obj.log >&2) || ( exitcode=$? && /usr/bin/cp /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.obj.log /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/make-support/failure-logs/hotspot_variant-server_libjvm_gtest_objs_test_json.obj.log && exit $exitcode ) ) | /usr/bin/grep -v -e "^Note: including file:" -e "^test_json.cpp$" || test "$?" = "1" ; /usr/bin/echo /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.obj: \\ > /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.d ; /usr/bin/sed -e '/^Note: including file:/!d' -e 's|Note: including file: *||' -e 's|\\|/|g' -e 's|^\([a-zA-Z]\):|/cygdrive/\1|g' -e '\|/cygdrive/d/DocumentFls/Wor/Java/jdk9|I !d' -e 's|$| \\|g'  /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.obj.log | /usr/bin/sort -u >> /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.d ; /usr/bin/sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$//' -e 's/^[  ]*//' -e '/^$/ d' -e 's/$/ :/'  /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.d > /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm/gtest/objs/test_json.d.targets
Compiling test_logDecorators.cpp (for jvm.dll)

解决办法,将YourOpenJDK\hotspot\test\native\utilities\test_json.cpp 中的

TEST_VM(utilities, json_key_values_1) {
    JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}

TEST_VM(utilities, json_key_values_2) {
    JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}

TEST_VM(utilities, json_quoted_symbols) {
    JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
            "\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
}

TEST_VM(utilities, json_incorrect_key) {
    JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
            " \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
            false); // first key needs to be quoted since it contains a space
}

修改为

//错误修正参考:http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/dba0765d2b6d
TEST_VM(utilities, json_key_values_1) {
    JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}

TEST_VM(utilities, json_key_values_2) {
    JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}

TEST_VM(utilities, json_quoted_symbols) {
    JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
            "\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
}

TEST_VM(utilities, json_incorrect_key) {
    JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
            " \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
            false); // first key needs to be quoted since it contains a space
}

问题2

( /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/configure-support/bin/fixpath.exe -c /cygdrive/d/softwa~1/win/micros~1/visual~1/12.0/vc/bin/amd64/cl -nologo -MD -Zc:wchar_t- -W3 -wd4800 -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -DWIN32 -DIAL -D_AMD64_ -Damd64 -D_LITTLE_ENDIAN -DWINDOWS -DARCH='"amd64"' -Damd64 -DDEBUG -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/modules_include/java.base -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/share/native/include -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/windows/native/include -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/windows/native/include -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/share/native/libjava -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/windows/native/libjava -Zi -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.desktop/share/native/libjavajpeg -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/windows/native/libjava -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.base/share/native/libjava -I/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/headers/java.desktop -Zi -I/cygdrive/d/softwa~1/win/micros~1/visual~1/12.0/vc/include -I/cygdrive/d/softwa~1/win/micros~1/visual~1/12.0/vc/atlmfc/include -I/cygdrive/c/progra~2/wi3cf2~1/8.1/include/shared -I/cygdrive/c/progra~2/wi3cf2~1/8.1/include/um -I/cygdrive/c/progra~2/wi3cf2~1/8.1/include/winrt -Od -DTHIS_FILE='"jdhuff.c"' -c -showIncludes -Fd/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/pdb/jdhuff.pdb -Fo/cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.obj /cygdrive/d/DocumentFls/Wor/Java/jdk9/jdk/src/java.desktop/share/native/libjavajpeg/jdhuff.c > >(/usr/bin/tee /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.obj.log) 2> >(/usr/bin/tee /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.obj.log >&2) || ( exitcode=$? && /usr/bin/cp /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.obj.log /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/make-support/failure-logs/support_native_java.desktop_libjavajpeg_jdhuff.obj.log && exit $exitcode ) ) | /usr/bin/grep -v -e "^Note: including file:" -e "^jdhuff.c$" || test "$?" = "1" ; /usr/bin/echo /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.obj: \\ > /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.d ; /usr/bin/sed -e '/^Note: including file:/!d' -e 's|Note: including file: *||' -e 's|\\|/|g' -e 's|^\([a-zA-Z]\):|/cygdrive/\1|g' -e '\|/cygdrive/d/DocumentFls/Wor/Java/jdk9|I !d' -e 's|$| \\|g'  /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.obj.log | /usr/bin/sort -u >> /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.d ; /usr/bin/sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$//' -e 's/^[  ]*//' -e '/^$/ d' -e 's/$/ :/'  /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.d > /cygdrive/d/DocumentFls/Wor/Java/jdk9/build/windows-x86_64-normal-serverANDclient-slowdebug/support/native/java.desktop/libjavajpeg/jdhuff.d.targets
Compiling jdinput.c (for javajpeg.dll)

解决办法,将YourOpenJDK\jdk\src\java.desktop\share\native\libjavajpeg\jdhuff.c中的

static const unsigned int MINUS_ONE = 0Xffffffff; 
static const int extend_test[16] =   /* entry n is 2**(n-1) */
  { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
    0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };

static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
  { 0, (MINUS_ONE<<1) + 1, (MINUS_ONE<<2) + 1, (MINUS_ONE<<3) + 1, (MINUS_ONE<<4) + 1,
    (MINUS_ONE<<5) + 1, (MINUS_ONE<<6) + 1, (MINUS_ONE<<7) + 1, (MINUS_ONE<<8) + 1,
    (MINUS_ONE<<9) + 1, (MINUS_ONE<<10) + 1, (MINUS_ONE<<11) + 1, (MINUS_ONE<<12) + 1,
    (MINUS_ONE<<13) + 1, (MINUS_ONE<<14) + 1, (MINUS_ONE<<15) + 1 };

修改为

static const int extend_test[16] =   /* entry n is 2**(n-1) */
  { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
    0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };

static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };

该问题还会出现在同目录下的jdphuff.c文件中,按照如上的相同的方式修改即可;需要注意的是这两个文件是我在Mac下为了通过编译打过补丁后的文件【Mac OSX 10.12.1 编译 Openjdk 9】,如果你的源码没有打过补丁,那么不需要再修改,OpenJDK官方库克隆下来的源代码里面是没有MINUS_ONE这个定义的,此位置原本默认就是-1,所以不需要修改

你可能感兴趣的:(Windows 10 Enterprise(1607) 编译 Openjdk 9)