Skip to content

An error occurred when compiling portable-snippets with vcpkg #48

@jimwang118

Description

@jimwang118

environment:

windows x64
msvc 14.36.32532

Steps to reproduce:

  1. git clone https://github.com/microsoft/vcpkg.git
  2. Enter the vcpkg directory and execute bootstrap-vcpkg.bat
  3. Run the command ./vcpkg install portable-snippets:x64-windows
    The following error occurs:
[1/5] C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe -IE:\Lily\jasper\buildtrees \portable-snippets\src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cpu.dir\cpu\cpu.c .obj /FdCMakeFiles\cpu.dir\cpu.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\cpu\cpu.c
FAILED: CMakeFiles/cpu.dir/cpu/cpu.c.obj
C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe -IE:\Lily\jasper\buildtrees\portable-snippets\ src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cpu.dir\cpu\cpu.c.obj /FdCMakeFiles\ cpu.dir\cpu.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\cpu\cpu.c
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(101): error C2054: expected '(' to follow '_Noreturn'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(101): error C2085: 'thrd_exit': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(104): error C2085: 'thrd_join': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(105): error C2085: '_thrd_sleep32': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(107): error C2085: '_thrd_sleep64': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(116): error C2085: 'thrd_sleep': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(116): error C2143: syntax error: missing ';' before '{'
[2/5] C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe -IE:\Lily\jasper\buildtrees \portable-snippets\src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\random.dir\random\random.c .obj /FdCMakeFiles\random.dir\random.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c
FAILED: CMakeFiles/random.dir/random/random.c.obj
C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe -IE:\Lily\jasper\buildtrees\portable-snippets\ src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\random.dir\random\random.c.obj /FdCMakeFiles\ random.dir\random.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(101): error C2054: expected '(' to follow '_Noreturn'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(101): error C2085: 'thrd_exit': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(104): error C2085: 'thrd_join': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(105): error C2085: '_thrd_sleep32': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(107): error C2085: '_thrd_sleep64': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(116): error C2085: 'thrd_sleep': not in formal parameter list
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\include\threads.h(116): error C2143: syntax error: missing ';' before '{'
ninja: build stopped: subcommand failed.

Then I added set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std:c11" ) in cmakelists.txt, and recompiled the following problems:

[1/5] C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe    -IE:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP  -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cpu.dir\cpu\cpu.c.obj /FdCMakeFiles\cpu.dir\cpu.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\cpu\cpu.c
[2/5] C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe    -IE:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP  -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\random.dir\random\random.c.obj /FdCMakeFiles\random.dir\random.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c
FAILED: CMakeFiles/random.dir/random/random.c.obj 
C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\cl.exe    -IE:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP  -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 -std:c11 /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\random.dir\random\random.c.obj /FdCMakeFiles\random.dir\random.pdb /FS -c E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.h(30): error C2057: expected constant expression
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.h(30): error C2466: cannot allocate an array of constant size 0
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(34): error C2057: expected constant expression
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(34): error C2466: cannot allocate an array of constant size 0
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(139): error C2057: expected constant expression
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(139): error C2466: cannot allocate an array of constant size 0
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(300): error C2057: expected constant expression
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(300): error C2466: cannot allocate an array of constant size 0
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(372): error C2057: expected constant expression
E:\Lily\jasper\buildtrees\portable-snippets\src\a6955d89c4-b026d6ec08\random\random.c(372): error C2466: cannot allocate an array of constant size 0
[3/5] cmd.exe /C "cd . && C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1436~1.325\bin\HostX64\x64\lib.exe  /machine:x64 /nologo /out:psnip-cpu.lib CMakeFiles\cpu.dir\cpu\cpu.c.obj  && cd ."
ninja: build stopped: subcommand failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions