Tencent / libco

libco is a coroutine library which is widely used in wechat back-end service. It has been running on tens of thousands of machines since 2013.
Other
8.21k stars 2.07k forks source link

在windows平台上使用msvc编译失败. #183

Open qd1332543 opened 2 years ago

qd1332543 commented 2 years ago

Describe the bug

When I used the code compiled by msbuild for unit testing, the test failed. The specific failure is as follows:

"F:\tencent\libco\build_amd64\libco.sln" (Rebuild target) (1) ->
"F:\tencent\libco\build_amd64\colib_shared.vcxproj.metaproj" (Rebuild target) (3) ->
"F:\tencent\libco\build_amd64\colib_shared.vcxproj" (Rebuild target) (14) ->
(ClCompile target) -> 
  F:\tencent\libco\co_epoll.h(31,10): fatal error C1083: Cannot open include file: 'sys/epoll.h': No such file or directory (d:\a01\_work\34\s\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1964) [F:\tencent\libco\build_amd64\colib_shared.vcxproj]
  F:\tencent\libco\co_hook_sys_call.cpp(19,10): fatal error C1083: Cannot open include file: 'sys/socket.h': No such file or directory (d:\a01\_work\34\s\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1964) [F:\tencent\libco\build_amd64\colib_shared.vcxproj]
  F:\tencent\libco\co_routine.h(23,10): fatal error C1083: Cannot open include file: 'sys/poll.h': No such file or directory (d:\a01\_work\34\s\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1964) [F:\tencent\libco\build_amd64\colib_shared.vcxproj]
  F:\tencent\libco\coctx.cpp(86,44): error C2143: syntax error: missing ';' before 'asm' [F:\tencent\libco\build_amd64\colib_shared.vcxproj]
  F:\tencent\libco\coctx.cpp(86,60): error C2290: C++ 'asm' syntax ignored. Use __asm. [F:\tencent\libco\build_amd64\colib_shared.vcxproj]

To Reproduce

Steps to reproduce the behavior:

1. git clone https://github.com/Tencent/libco
   git -C "F:\Tencent\libco" rev-parse --git-dir
   git -C "F:\Tencent\libco" clean -xdf
   git -C "F:\Tencent\libco" fetch --recurse-submodules=no --force
   git -C "F:\Tencent\libco" reset --hard dc6aafc
   git -C "F:\Tencent\libco" remote prune origin
2. set VSCMD_SKIP_SENDTELEMETRY=1 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64
3. cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DCMAKE_BUILD_TYPE=Release ..
4. msbuild /m /p:Platform=x64 /p:Configuration=Release libco.sln /t:Rebuild /p:BuildInParallel=true

Expected behavior Build pass.

Observed Behavior build failed.

Environment What version of VW did you use? What OS or language did you use? OS: Windows Server 2016 1607 CPU: AMD EPYC 7452 32-Core Processor Compiler: MSVC 14.29.30133 Language: ENU

Additional context You can also check build error messages from attached file build.log

staneychan commented 2 years ago

这很明显需要依赖linux下的头文件,sys/epoll.h, 找个代替的。很多开源代码可以找到。 但这样做就可能失去了意义。

qd1332543 commented 2 years ago

好的,谢谢你的回复!