paullouisageneau / libjuice

JUICE is a UDP Interactive Connectivity Establishment library
Mozilla Public License 2.0
432 stars 82 forks source link

Windows11, Visual Studio 2022 can't build #268

Closed javametro closed 2 months ago

javametro commented 3 months ago

I want to build the library on my personal machine OS: Windows 11 22631 Visual Studio 2022 CMake 3.28

but the below error shows:

-- The C compiler identification is MSVC 19.40.33813.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'D:/webrtcStack/libjuice/build/CMakeFiles/CMakeScratch/TryCompile-h5mt3l'

    Run Build Command(s): "C:/Program Files/CMake/bin/cmake.exe" -E env VERBOSE=1 nmake -f Makefile /nologo cmTC_4073d\fast
        "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\nmake.exe"  -f CMakeFiles\cmTC_4073d.dir\build.make /nologo -L                  CMakeFiles\cmTC_4073d.dir\build
    Building C object CMakeFiles/cmTC_4073d.dir/testCCompiler.c.obj
        "C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_4073d.dir\testCCompiler.c.obj.d --working-dir=D:\webrtcStack\libjuice\build\CMakeFiles\CMakeScratch\TryCompile-h5mt3l --filter-prefix="Note: including file: " -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\cl.exe @C:\Users\WANGPE~1\AppData\Local\Temp\nm48C3.tmp
    testCCompiler.c
    Linking C executable cmTC_4073d.exe
        "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_4073d.dir --rc=C:\signtool\rc.exe --mt=C:\signtool\mt.exe --manifests -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_4073d.dir\objects1.rsp @C:\Users\WANGPE~1\AppData\Local\Temp\nm49FC.tmp
    Visual Studio Incremental Link with embedded manifests
    Create CMakeFiles\cmTC_4073d.dir/manifest.rc
    Create empty: CMakeFiles\cmTC_4073d.dir/embed.manifest
    RC Pass 1:
    C:\signtool\rc.exe /fo CMakeFiles\cmTC_4073d.dir/manifest.res CMakeFiles\cmTC_4073d.dir/manifest.rc
    LINK Pass 1:
    C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_4073d.dir\objects1.rsp /out:cmTC_4073d.exe /implib:cmTC_4073d.lib /pdb:D:\webrtcStack\libjuice\build\CMakeFiles\CMakeScratch\TryCompile-h5mt3l\cmTC_4073d.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_4073d.dir/intermediate.manifest CMakeFiles\cmTC_4073d.dir/manifest.res
    LINK Pass 1: command "C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_4073d.dir\objects1.rsp /out:cmTC_4073d.exe /implib:cmTC_4073d.lib /pdb:D:\webrtcStack\libjuice\build\CMakeFiles\CMakeScratch\TryCompile-h5mt3l\cmTC_4073d.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_4073d.dir/intermediate.manifest CMakeFiles\cmTC_4073d.dir/manifest.res" failed (exit code 1104) with the following output:
    LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
    NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_4073d.dir --rc=C:\signtool\rc.exe --mt=C:\signtool\mt.exe --manifests -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_4073d.dir\objects1.rsp @C:\Users\WANGPE~1\AppData\Local\Temp\nm49FC.tmp' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\nmake.exe"  -f CMakeFiles\cmTC_4073d.dir\build.make /nologo -L                  CMakeFiles\cmTC_4073d.dir\build' : return code '0x2'
    Stop.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!
paullouisageneau commented 2 months ago

As the error explicitly indicates, the compiler is not able to compile a simple test program. The underlying issue is "fatal error LNK1104: cannot open file 'kernel32.lib'", which suggests that environment variables are not set correctly. This is an issue with your build environment, it is not related to libjuice.