天天看點

編譯OpenJDK11:fatal error LNK1104: cannot open file ‘kernel32.lib‘

  • 報錯
checking resolved symbolic links for CC... no symlink
configure: Using microsoft C compiler version 18.00.31101 [Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x64]
checking whether the C compiler works... no
configure: error: in `/cygdrive/d/Office-3.5-project/tsjdk11-project/ts-jdk11':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure exiting with result code 77      
  • 檢查config.log

忽略cl --version/cl -V/cl -qversion之類的錯誤,定位:

configure:36611: checking whether the C compiler works
configure:36633: /cygdrive/c/progra~2/micros~1.0/vc/bin/amd64/cl        conftest.c  >&5
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

conftest.c
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:conftest.exe 
conftest.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
configure:36637: $? = 2
configure:36675: result: no
configure: failed program was:      
  • VS解決辦法

原因目前的lib路徑中,找不到kernel32.lib。

搜尋了一下,說是給VS項目加上路徑,項目屬性->配置屬性->VC++目錄->庫目錄,添加二選一:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64

  • JDK11編譯解決辦法1

修改了toolchain_windows.m4,484處增加了一句:

  • JDK11編譯解決辦法2

繼續閱讀