aseprite / aseprite

Animated sprite editor & pixel art tool (Windows, macOS, Linux)
https://www.aseprite.org
28.29k stars 5.45k forks source link

LNK1104: cannot open file 'kernel32.lib' #1638

Open artifex-enim opened 6 years ago

artifex-enim commented 6 years ago

Hello,

I've been having this issue for hours where when I try to compile Aseprite after successfully compiling skia and adding depot_tools, it tells me it cannot open kernel32.lib.

I have (I will also include this information in the convenient location at the end of the post) Visual Studio Community 2017 version 15.5.2 with SDK 10.0.16299.0 for desktop development and 10.0.15063 for universal development.

With that being said, I am running windows 10: 64-bit on an Intel i5-7200U, I have installed CMake's latest version, and I think I have set all my environment variables correctly.

This is all for the latest version of Aseprite as of December 24th, 2017 (which I believe is v1.2.6).

Below should be all the information needed for debugging. I have tried checking environment variables, searching for kernel32.lib elsewhere and putting it in the specified directory, trying to find rc.exe with its corresponding dll file and putting it in the x86 directory within the VC dir. I may have done other stuff that I cannot remember. It's been a long frustrating journey that I'm probably goofing up by overlooking something simple.

CMakeError.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x86/cl.exe 
Build flags: 
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCCompilerId.exe 
CMakeCCompilerId.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x86/cl.exe 
Build flags: 
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Determining if the C compiler works failed with the following output:
Change Dir: C:/Users/Rn Avacado/Desktop/aseprite/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/deps/depot_tools/ninja.exe" "cmTC_18052"
[1/2] Building C object CMakeFiles\cmTC_18052.dir\testCCompiler.c.obj

[2/2] Linking C executable cmTC_18052.exe

FAILED: cmTC_18052.exe 

cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_18052.dir --manifests  -- C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\Hostx86\x86\link.exe /nologo CMakeFiles\cmTC_18052.dir\testCCompiler.c.obj  /out:cmTC_18052.exe /implib:cmTC_18052.lib /pdb:cmTC_18052.pdb /version:0.0  /machine:X86  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."

RC Pass 1: command "rc /foCMakeFiles\cmTC_18052.dir/manifest.res CMakeFiles\cmTC_18052.dir/manifest.rc" failed (exit code 0) with the following output:
This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher

ninja: build stopped: subcommand failed.

CMakeOutput.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x86/cl.exe 
Build flags: 
Id flags: -c 

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj"

The C compiler identification is MSVC, found in "C:/Users/Rn Avacado/Desktop/aseprite/build/CMakeFiles/3.10.1/CompilerIdC/CMakeCCompilerId.obj"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x86/cl.exe 
Build flags: 
Id flags: -c 

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCXXCompilerId.cpp

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/Rn Avacado/Desktop/aseprite/build/CMakeFiles/3.10.1/CompilerIdCXX/CMakeCXXCompilerId.obj"

Environment PATH and Path variables:

User:
Path:
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Heroku\bin;C:\Users\Rn Avacado\AppData\Roaming\npm;%PY_HOME%;%PY_HOME%\Lib;%PY_HOME%\DLLs;%PY_HOME%\Lib\lib-tk;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;

system:
PATH:
C:\Users\Rn Avacado\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Heroku\bin;C:\Users\Rn Avacado\AppData\Roaming\npm;C:\Program Files (x86)\Git\cmd;C:\deps\depot_tools;%PY_HOME%;C:\Program Files\CMake\bin;C:\Program Files (x84)\Windows Kits\10\Lib;C:\Program Files\dotnet\

Thanks in advance for any help. I'd really love to figure this out.

Aseprite and System version

dacap commented 6 years ago

It looks like you are using the x86 compiler on a x64 machine. You should start the command line with the proper compiler (for a host 64 bit). I'm not in a Windows machine right now. Some info:

https://docs.microsoft.com/en-us/cpp/build/how-to-enable-a-64-bit-visual-cpp-toolset-on-the-command-line https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line#developer_command_prompt_shortcuts

artifex-enim commented 6 years ago

@dacap Thanks for responding. I tried compiling using the x64 native developer console for VS 2017, but I'm still getting the same errors. (LNK1104: cannot open 'kernel32.lib'.

CMakeError.log

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCCompilerId.exe 
CMakeCCompilerId.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Determining if the C compiler works failed with the following output:
Change Dir: C:/Users/Rn Avacado/Desktop/aseprite/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/deps/depot_tools/ninja.exe" "cmTC_f5635"
[1/2] Building C object CMakeFiles\cmTC_f5635.dir\testCCompiler.c.obj

[2/2] Linking C executable cmTC_f5635.exe

FAILED: cmTC_f5635.exe 

cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_f5635.dir --manifests  -- C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_f5635.dir\testCCompiler.c.obj  /out:cmTC_f5635.exe /implib:cmTC_f5635.lib /pdb:cmTC_f5635.pdb /version:0.0  /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."

RC Pass 1: command "rc /foCMakeFiles\cmTC_f5635.dir/manifest.res CMakeFiles\cmTC_f5635.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified

ninja: build stopped: subcommand failed.

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe 
Build flags: /DWIN32;/D_WINDOWS;/W3
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCCompilerId.exe 
CMakeCCompilerId.obj 
LINK : error LNK2001: unresolved external symbol mainCRTStartup
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x86\LIBCMT.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
CMakeCCompilerId.exe : fatal error LNK1120: 1 unresolved externals

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 
LINK : error LNK2001: unresolved external symbol mainCRTStartup
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\lib\x86\LIBCMT.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
CMakeCXXCompilerId.exe : fatal error LNK1120: 1 unresolved externals

Determining if the C compiler works failed with the following output:
Change Dir: C:/Users/Rn Avacado/Desktop/aseprite/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/deps/depot_tools/ninja.exe" "cmTC_bbd07"
[1/2] Building C object CMakeFiles\cmTC_bbd07.dir\testCCompiler.c.obj

[2/2] Linking C executable cmTC_bbd07.exe

FAILED: cmTC_bbd07.exe 

cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_bbd07.dir --manifests  -- C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_bbd07.dir\testCCompiler.c.obj  /out:cmTC_bbd07.exe /implib:cmTC_bbd07.lib /pdb:cmTC_bbd07.pdb /version:0.0  /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."

RC Pass 1: command "rc /foCMakeFiles\cmTC_bbd07.dir/manifest.res CMakeFiles\cmTC_bbd07.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified

ninja: build stopped: subcommand failed.

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe 
Build flags: /DWIN32;/D_WINDOWS;/W3
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCCompilerId.exe 
CMakeCCompilerId.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
2
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.12.25831.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Determining if the C compiler works failed with the following output:
Change Dir: C:/Users/Rn Avacado/Desktop/aseprite/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/deps/depot_tools/ninja.exe" "cmTC_c3791"
[1/2] Building C object CMakeFiles\cmTC_c3791.dir\testCCompiler.c.obj

[2/2] Linking C executable cmTC_c3791.exe

FAILED: cmTC_c3791.exe 

cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_c3791.dir --manifests  -- C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_c3791.dir\testCCompiler.c.obj  /out:cmTC_c3791.exe /implib:cmTC_c3791.lib /pdb:cmTC_c3791.pdb /version:0.0  /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."

RC Pass 1: command "rc /foCMakeFiles\cmTC_c3791.dir/manifest.res CMakeFiles\cmTC_c3791.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified

ninja: build stopped: subcommand failed.
viccP commented 2 years ago

it seems you need dowgraded your Ninja version,use v1.10.2 this version may solve your promblem