编译OpenJDK11:fatal error LNK1104: cannot open file ‘kernel32.lib‘

Posted 柳鲲鹏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译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处增加了一句:

VS_LIB="$VS_LIB;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\Lib\\x64"

  • JDK11编译解决办法2

能不能修改什么变量,让其自动读取到?

以上是关于编译OpenJDK11:fatal error LNK1104: cannot open file ‘kernel32.lib‘的主要内容,如果未能解决你的问题,请参考以下文章

编译出现 fatal error: openssl/bio.h: 没有那个文件或目录

编译OpenJDK11:configure: error: Target CPU mismatch. We are building for x86_64 but CL is for “版“; exp

WINDOWS编译ffmpeg:LINK : fatal error LNK1104: 无法打开文件“LIBCMT.lib”

collect2:fatal error: ld terminated with signal 11 [Segmentation fault] 问题的解决

collect2:fatal error: ld terminated with signal 11 [Segmentation fault] 问题的解决

MatConvNet编译报错:Error using mex nvcc fatal : ‘-DNDEBUG’: expected a number 解决办法