build libwebsockets for vs2010 howto

SF丶STS
  • 119

1.问题

我想要编译libwebsockets for vs2010

2.尝试

参考github warmcat/libwebsockets 解决问题

注:

Install OpenSSL binaries. http://www.openssl.org/related/binaries.html

链接已经失效,通过google可以获得相应的wiki说明以及下载链接

此处附上本人使用的链接

3.疑惑

(NOTE: Preferably in the default location to make it easier for CMake to find them)

4.问题

在执行Cmake的时候出现以下错误
1.cmake-gui console错误如下:

The C compiler identification is MSVC 16.0.30319.1
Check for working C compiler using: Visual Studio 10 2010 Win64
Check for working C compiler using: Visual Studio 10 2010 Win64 -- broken
CMake Error at D:/install/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "D:/install/Microsoft Visual Studio
  10.0/VC/bin/x86_amd64/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeTmp

  

  Run Build
  Command:"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe"
  "cmTC_6d302.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=10.0"

  Microsoft(R) ���������汾 4.6.81.0


  [Microsoft .NET Framework �汾 4.0.30319.42000]


  ��Ȩ���� (C) Microsoft Corporation����������Ȩ����


  


  ��������ʱ��Ϊ 2016/2/24 16:57:22��


  �ڵ� 1
  �ϵ���Ŀ��I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj��(Ĭ��Ŀ��)��



  PrepareForBuild:


    ���ڴ���Ŀ¼��cmTC_6d302.dir\Debug\����

    ���ڴ���Ŀ¼��I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\Debug\����


  InitializeBuildStatus:


    ���ڴ�����cmTC_6d302.dir\Debug\cmTC_6d302.unsuccessfulbuild������Ϊ��ָ����AlwaysCreate����


  ClCompile:


    D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_6d302.dir\Debug\\" /Fd"cmTC_6d302.dir\Debug\vc100.pdb" /Gd /TC /errorReport:queue testCCompiler.c

    Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64

    Copyright (C) Microsoft Corporation.  All rights reserved.

    

    cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_6d302.dir\Debug\\" /Fd"cmTC_6d302.dir\Debug\vc100.pdb" /Gd /TC /errorReport:queue testCCompiler.c

    

    testCCompiler.c


  ManifestResourceCompile:


    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"cmTC_6d302.dir\Debug\cmTC_6d302.exe.embed.manifest.res" cmTC_6d302.dir\Debug\cmTC_6d302_manifest.rc 


  Link:


    D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\Debug\cmTC_6d302.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /ManifestFile:"cmTC_6d302.dir\Debug\cmTC_6d302.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeTmp/Debug/cmTC_6d302.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeTmp/Debug/cmTC_6d302.lib" /MACHINE:X64 cmTC_6d302.dir\Debug\cmTC_6d302.exe.embed.manifest.res

    cmTC_6d302.dir\Debug\testCCompiler.obj  /machine:x64 /debug 


  LINK : fatal error LNK1123: ת���� COFF �ڼ�ʧ��: �ļ���Ч������
  [I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj]



  
  ������������Ŀ��I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj��(Ĭ��Ŀ��)�IJ���
  - ʧ�ܡ�


  


  ����ʧ�ܡ�


  


  
  ��I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj��(Ĭ��Ŀ��)
  (1) ->


  (Link Ŀ��) -> 


    LINK : fatal error LNK1123: ת���� COFF �ڼ�ʧ��: �ļ���Ч������ [I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj]


  


      0 ���

      1 ������


  


  ����ʱ�� 00:00:00.39


  

  

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


Configuring incomplete, errors occurred!
See also "I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeOutput.log".
See also "I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeError.log".

CMakeOutput.log

The system is: Windows - 6.1.7601 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler:  
Build flags: 
Id flags: 

The output was:
0
Microsoft(R) 生成引擎版本 4.6.81.0
[Microsoft .NET Framework 版本 4.0.30319.42000]
版权所有 (C) Microsoft Corporation。保留所有权利。

生成启动时间为 2016/2/24 16:57:22。
节点 1 上的项目“I:\libwebsockets\libwebsockets\build\CMakeFiles\3.4.0\CompilerIdC\CompilerIdC.vcxproj”(默认目标)。
PrepareForBuild:
  正在创建目录“Debug\”。
InitializeBuildStatus:
  正在创建“Debug\CompilerIdC.unsuccessfulbuild”,因为已指定“AlwaysCreate”。
ClCompile:
  D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\CompilerIdC.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"I:\libwebsockets\libwebsockets\build\CMakeFiles\3.4.0\CompilerIdC\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X64 Debug\CMakeCCompilerId.obj
  CompilerIdC.vcxproj -> I:\libwebsockets\libwebsockets\build\CMakeFiles\3.4.0\CompilerIdC\.\CompilerIdC.exe
Manifest:
  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:".\CompilerIdC.exe;#1" /manifest Debug\CompilerIdC.exe.intermediate.manifest
PostBuildEvent:
  for %%i in (cl.exe) do @echo CMAKE_C_COMPILER=%%~$PATH:i
  :VCEnd
  CMAKE_C_COMPILER=D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\cl.exe
FinalizeBuildStatus:
  正在删除文件“Debug\CompilerIdC.unsuccessfulbuild”。
  正在对“Debug\CompilerIdC.lastbuildstate”执行 Touch 任务。
已完成生成项目“I:\libwebsockets\libwebsockets\build\CMakeFiles\3.4.0\CompilerIdC\CompilerIdC.vcxproj”(默认目标)的操作。

已成功生成。
    0 个警告
    0 个错误

已用时间 00:00:00.42


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.exe"

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.vcxproj"

The C compiler identification is MSVC, found in "I:/libwebsockets/libwebsockets/build/CMakeFiles/3.4.0/CompilerIdC/CompilerIdC.exe"

CMakeError.log

Determining if the C compiler works failed with the following output:
Change Dir: I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe" "cmTC_6d302.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=10.0"
Microsoft(R) 生成引擎版本 4.6.81.0

[Microsoft .NET Framework 版本 4.0.30319.42000]

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



生成启动时间为 2016/2/24 16:57:22。

节点 1 上的项目“I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj”(默认目标)。

PrepareForBuild:

  正在创建目录“cmTC_6d302.dir\Debug\”。

  正在创建目录“I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\Debug\”。

InitializeBuildStatus:

  正在创建“cmTC_6d302.dir\Debug\cmTC_6d302.unsuccessfulbuild”,因为已指定“AlwaysCreate”。

ClCompile:

  D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_6d302.dir\Debug\\" /Fd"cmTC_6d302.dir\Debug\vc100.pdb" /Gd /TC /errorReport:queue testCCompiler.c

  Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64

  Copyright (C) Microsoft Corporation.  All rights reserved.

  

  cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_6d302.dir\Debug\\" /Fd"cmTC_6d302.dir\Debug\vc100.pdb" /Gd /TC /errorReport:queue testCCompiler.c

  

  testCCompiler.c

ManifestResourceCompile:

  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"cmTC_6d302.dir\Debug\cmTC_6d302.exe.embed.manifest.res" cmTC_6d302.dir\Debug\cmTC_6d302_manifest.rc 

Link:

  D:\install\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\Debug\cmTC_6d302.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /ManifestFile:"cmTC_6d302.dir\Debug\cmTC_6d302.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeTmp/Debug/cmTC_6d302.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"I:/libwebsockets/libwebsockets/build/CMakeFiles/CMakeTmp/Debug/cmTC_6d302.lib" /MACHINE:X64 cmTC_6d302.dir\Debug\cmTC_6d302.exe.embed.manifest.res

  cmTC_6d302.dir\Debug\testCCompiler.obj  /machine:x64 /debug 

LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 [I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj]

已完成生成项目“I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj”(默认目标)的操作 - 失败。



生成失败。



“I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj”(默认目标) (1) ->

(Link 目标) -> 

  LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 [I:\libwebsockets\libwebsockets\build\CMakeFiles\CMakeTmp\cmTC_6d302.vcxproj]



    0 个警告

    1 个错误



已用时间 00:00:00.39

尝试

在google多个解决发现几乎接近的办法与官方手册雷同
其中的一个方法并为出现该链接出现的高级选项,应该是libwebsockets的版本问题

环境

win32_x86_64 win7
cMake version 3.4.0
visual studio 2010
回复
阅读 6.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏