Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vs2019 + Win32 编译错误 #70464

Open
linuxlin365 opened this issue Dec 25, 2024 · 2 comments
Open

vs2019 + Win32 编译错误 #70464

linuxlin365 opened this issue Dec 25, 2024 · 2 comments
Assignees

Comments

@linuxlin365
Copy link

linuxlin365 commented Dec 25, 2024

bug描述 Describe the Bug

编译命令:
cmake .. -G "Visual Studio 16 2019" -A Win32 -T host=x64 -DCMAKE_BUILD_TYPE=Release -DWITH_MKL=ON -DWITH_GPU=OFF -DON_INFER=ON -DWITH_PYTHON=OFF
版本:

Paddle-release-2.6
cmake version 3.31.3
vs2019

编译错误:

RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at cmake/generic.cmake:109 (string):
  string sub-command REGEX, mode REPLACE failed to compile regex
  "^D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/".
Call Stack (most recent call first):
  cmake/generic.cmake:380 (find_fluid_modules)
  paddle/fluid/inference/api/CMakeLists.txt:91 (cc_library)


RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at cmake/generic.cmake:137 (string):
  string sub-command REGEX, mode REPLACE failed to compile regex
  "^D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/".
Call Stack (most recent call first):
  cmake/generic.cmake:381 (find_phi_modules)
  paddle/fluid/inference/api/CMakeLists.txt:91 (cc_library)


RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at cmake/generic.cmake:109 (string):
  string sub-command REGEX, mode REPLACE failed to compile regex
  "^D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/".
Call Stack (most recent call first):
  cmake/generic.cmake:380 (find_fluid_modules)
  paddle/fluid/inference/capi_exp/CMakeLists.txt:18 (cc_library)


RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at cmake/generic.cmake:137 (string):
  string sub-command REGEX, mode REPLACE failed to compile regex
  "^D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/".
Call Stack (most recent call first):
  cmake/generic.cmake:381 (find_phi_modules)
  paddle/fluid/inference/capi_exp/CMakeLists.txt:18 (cc_library)


-- Configuring incomplete, errors occurred!

CMakeErr:

Determining if the include file pthread.h exists failed with the following output:
Change Dir: D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/build/CMakeFiles/CMakeTmp

Run Build Command(s):D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_d263b.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.11.2+f32259642

版权所有(C) Microsoft Corporation。保留所有权利。



  用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版

  版权所有(C) Microsoft Corporation。保留所有权利。

  CheckIncludeFile.c

  cl /c /Zi /W0 /WX- /diagnostics:column /MP8 /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_d263b.dir\Debug\\" /Fd"cmTC_d263b.dir\Debug\vc142.pdb" /external:W0 /Gd /TC /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838 /analyze- /errorReport:queue  /w /bigobj "D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c"

D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: 无法打开包括文件: “pthread.h”: No such file or directory [D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\cmTC_d263b.vcxproj]




Performing C++ SOURCE FILE Test AVX512F_FOUND failed with the following output:
Change Dir: D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/build/CMakeFiles/CMakeTmp

Run Build Command(s):D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_21bec.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.11.2+f32259642

版权所有(C) Microsoft Corporation。保留所有权利。



  用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版

  版权所有(C) Microsoft Corporation。保留所有权利。

  src.cxx

  cl /c /Zi /W0 /WX- /diagnostics:column /MP8 /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D AVX512F_FOUND /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_21bec.dir\Debug\\" /Fd"cmTC_21bec.dir\Debug\vc142.pdb" /external:W0 /Gd /TP /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838 /analyze- /errorReport:queue  /w /arch:AVX512 /bigobj "D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\src.cxx"

  cmTC_21bec.vcxproj -> D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\Debug\cmTC_21bec.exe



...and run output:
Illegal instruction
Return value: FAILED_TO_RUN
Source file was:

#include <immintrin.h>
int main()
{
    __m512i a = _mm512_set_epi32 (-1, 2, -3, 4, -1, 2, -3, 4,
                                  13, -5, 6, -7, 9, 2, -6, 3);
    __m512i result = _mm512_abs_epi32 (a);
    return 0;
}
Determining size of pthread_spinlock_t failed with the following output:
Change Dir: D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/build/CMakeFiles/CMakeTmp

Run Build Command(s):D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_469eb.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.11.2+f32259642

版权所有(C) Microsoft Corporation。保留所有权利。



  用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版

  版权所有(C) Microsoft Corporation。保留所有权利。

  SPINLOCK_FOUND.c

  cl /c /Zi /W0 /WX- /diagnostics:column /MP8 /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_469eb.dir\Debug\\" /Fd"cmTC_469eb.dir\Debug\vc142.pdb" /external:W0 /Gd /TC /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838 /analyze- /errorReport:queue  /w /bigobj "D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CheckTypeSize\SPINLOCK_FOUND.c"

D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CheckTypeSize\SPINLOCK_FOUND.c(4,10): fatal error C1083: 无法打开包括文件: “pthread.h”: No such file or directory [D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\cmTC_469eb.vcxproj]



D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/build/CMakeFiles/CheckTypeSize/SPINLOCK_FOUND.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#include "pthread.h"


#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#elif defined(__aarch64__)
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
#elif defined(__ARM_ARCH_7A__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
#elif defined(__ARM_ARCH_7S__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
#endif

#define SIZE (sizeof(pthread_spinlock_t))
static char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
  ('0' + ((SIZE / 10000)%10)),
  ('0' + ((SIZE / 1000)%10)),
  ('0' + ((SIZE / 100)%10)),
  ('0' + ((SIZE / 10)%10)),
  ('0' +  (SIZE    % 10)),
  ']',
#ifdef KEY
  ' ','k','e','y','[', KEY, ']',
#endif
  '\0'};

#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
  int require = 0;
  require += info_size[argc];
  (void)argv;
  return require;
}


Determining size of pthread_barrier_t failed with the following output:
Change Dir: D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/build/CMakeFiles/CMakeTmp

Run Build Command(s):D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_29f6f.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.11.2+f32259642

版权所有(C) Microsoft Corporation。保留所有权利。



  用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版

  版权所有(C) Microsoft Corporation。保留所有权利。

  BARRIER_FOUND.c

  cl /c /Zi /W0 /WX- /diagnostics:column /MP8 /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_29f6f.dir\Debug\\" /Fd"cmTC_29f6f.dir\Debug\vc142.pdb" /external:W0 /Gd /TC /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838 /analyze- /errorReport:queue  /w /bigobj "D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CheckTypeSize\BARRIER_FOUND.c"

D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CheckTypeSize\BARRIER_FOUND.c(4,10): fatal error C1083: 无法打开包括文件: “pthread.h”: No such file or directory [D:\qt_project\PaddleC++\Paddle-release-2.6\Paddle\build\CMakeFiles\CMakeTmp\cmTC_29f6f.vcxproj]



D:/qt_project/PaddleC++/Paddle-release-2.6/Paddle/build/CMakeFiles/CheckTypeSize/BARRIER_FOUND.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#include "pthread.h"


#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#elif defined(__aarch64__)
# define KEY '_','_','a','a','r','c','h','6','4','_','_'
#elif defined(__ARM_ARCH_7A__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
#elif defined(__ARM_ARCH_7S__)
# define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
#endif

#define SIZE (sizeof(pthread_barrier_t))
static char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
  ('0' + ((SIZE / 10000)%10)),
  ('0' + ((SIZE / 1000)%10)),
  ('0' + ((SIZE / 100)%10)),
  ('0' + ((SIZE / 10)%10)),
  ('0' +  (SIZE    % 10)),
  ']',
#ifdef KEY
  ' ','k','e','y','[', KEY, ']',
#endif
  '\0'};

#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
  int require = 0;
  require += info_size[argc];
  (void)argv;
  return require;
}



No response

@TingquanGao
Copy link

@xuxinyi389
Copy link
Contributor

windows的cmake指令麻烦使用ninja。cmake .. -GNinja -DWITH_GPU=ON -DWITH_UNITY_BUILD=ON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants