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,所以不需要修改

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,324评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,303评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,192评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,555评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,569评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,566评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,927评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,583评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,827评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,590评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,669评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,365评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,941评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,928评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,159评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,880评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,399评论 2 342

推荐阅读更多精彩内容