Open GitGoliath opened 1 year ago
An additional note, adding set(CMAKE_C_COMPILER_ID "MSVC") did not resolve the issue. So SW seems to need CMAKE_CXX_COMPILER_ID to be set.
Not sure what you are doing but sw build seems to have no problem on the latest windows:
https://github.com/DanBloomberg/leptonica/actions/runs/5292787926/jobs/9580098275
Humm, another question then, does the automatic test build use CMake, or is it using the Visual Studio CMake?
My setup is pretty clean, but I will try on a virtual machine to see if I can see the same issue. Will get back with the result.
Thanks
@GitGoliath : maybe you can give you step-by-step description how did you get error?
@egorpugin: can you give your insight how to use sw?
Hi,
Was able to reproduce from clean Windows 11 VMWare install.
Here is the step-by-step reproduction of the issue on a clean VMWare Virtual Machine (Windows 11 version 22H2, build 22621.1928:
1- From Clean Windows 11 latest update virtual machine, download Visual Studio Community 2- Launch installation package with admin priviledge (VisualStudioSetup) 3- Select the following options:
Here is the output window:
1> CMake generation started for default configuration: 'x64-Debug'.
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Git\Leptonica\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "C:\Git\Leptonica" 2>&1"
1> Working directory: C:\Git\Leptonica\out\build\x64-Debug
1> [CMake] -- Found SW: C:/SW Client/sw.exe
1> [CMake] -- sw: processing dependencies
1> [CMake] CMake Error at C:/Users/VMLoc/.sw/storage/etc/sw/static/SWConfig.cmake:166 (message):
1> [CMake] Compiler is not implemented: 'MSVC' or ''
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:213 (sw_execute)
1> [CMake] -- Configuring incomplete, errors occurred!
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Git\Leptonica\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "C:\Git\Leptonica" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Git\Leptonica\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "C:\Git\Leptonica" 2>&1"' returned with exit code: 1'.
From error window:
Error CMake Error at C:/Users/VMLoc/.sw/storage/etc/sw/static/SWConfig.cmake:166 (message): Compiler is not implemented: 'MSVC' or '' C:/Users/VMLoc/.sw/storage/etc/sw/static/SWConfig.cmake 166
Hi,
Please try to build from command line. Post your command and output.
Hi,
As being not a expert of CMake command line, I tried the following:
1- got into the git copied repository I got for Leptonica in C:\Git\Leptonica 2- created a "build" directory (since starting from inside the repo gave an error (followed error instructions - line 16) 3- then from "c:\git\Leptonica\build", I launch the same command line as in VS, which give the following (below)
Sorry, did not have time today to investigate why cl.exe compiler was not able to compile with this command line.
C:\Git\Leptonica\build>C:\WINDOWS\system32\cmd.exe /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Git\Leptonica\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "C:\Git\Leptonica" 2>&1" -- The C compiler identification is MSVC 19.36.32535.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - broken CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Git/Leptonica/build/CMakeFiles/CMakeScratch/TryCompile-3p2ue2
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe -v cmTC_9ad7b && [1/2] C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_9ad7b.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_9ad7b.dir\ /FS -c C:\Git\Leptonica\build\CMakeFiles\CMakeScratch\TryCompile-3p2ue2\testCCompiler.c
[2/2] cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_9ad7b.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x86\mt.exe --manifests -- C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_9ad7b.dir\testCCompiler.c.obj /out:cmTC_9ad7b.exe /implib:cmTC_9ad7b.lib /pdb:cmTC_9ad7b.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 ."
FAILED: cmTC_9ad7b.exe
cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_9ad7b.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x86\mt.exe --manifests -- C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_9ad7b.dir\testCCompiler.c.obj /out:cmTC_9ad7b.exe /implib:cmTC_9ad7b.lib /pdb:cmTC_9ad7b.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 ."
LINK Pass 1: command "C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_9ad7b.dir\testCCompiler.c.obj /out:cmTC_9ad7b.exe /implib:cmTC_9ad7b.lib /pdb:cmTC_9ad7b.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 /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_9ad7b.dir/intermediate.manifest CMakeFiles\cmTC_9ad7b.dir/manifest.res" failed (exit code 1120) with the following output:
testCCompiler.c.obj : error LNK2001: unresolved external symbol _RTC_InitBase
testCCompiler.c.obj : error LNK2001: unresolved external symbol _RTC_Shutdown
LINK : error LNK2001: unresolved external symbol mainCRTStartup
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\kernel32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\user32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\gdi32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\winspool.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\shell32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\ole32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\oleaut32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\uuid.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\comdlg32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x86\advapi32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x86\MSVCRTD.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
cmTC_9ad7b.exe : fatal error LNK1120: 3 unresolved externals
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:42 (project)
-- Configuring incomplete, errors occurred!
Yes, you should resolve this first. Later you could check with IDE.
Hi,
I am new to Leptonica, I build on Windows 11 (22H2), with Visual Studio (Version 17.6.4), following the instruction. Install SW client, doing the setup, etc.
When running from VS GUI, the CMakeLists.txt, I get the following error in SWConfig.cmake line 166:
I saw in the on git change log that 3 weeks ago the CXX where removed. Could be related...
I had to insert in the CMakeLists.txt the following:
set(CMAKE_CXX_COMPILER_ID "MSVC")
as sw_execute seems to need it, and the current CMake script I have was not setting it. Possibly from the change 3 weeks ago. Note that the SW Client used is from [sw-master-windows_x86_64-client.zip] (https://software-network.org/client/sw-master-windows_x86_64-client.zip) from yesterday 13-Jun-2023 21:33
So the current version does not seems to build from windows directly.