Closed zxzyoutlook closed 2 years ago
目前的项目稍稍有些问题但编译是可以正常编译的,确保您安装了vs2017以及其他所需要的一切组件。
可以使用vs2017或安装正确工具集的vs2019打开分支8.3下的sln文件生成解决方案,注意资源管理器设置demo为启动项,可能会遇到堆栈内存不够的问题,修改为zm600,有空会把我之前下载过来的8.2版本新建仓库,个人使用中完美,极少数情况报错。
另当前主分支上的项目在cmake正常生成后用vsdebug依然会遇得到一个rc文件的git问题,需要在文件中删除一些内容才能正常debug。
我编译过的正常版本应当是release包中的8.2.0版本。
8.4.0包cmake生成后vs调试
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 RC2104 undefined keyword or key name: GIT nim_demo C:\Users\yipye\Desktop\NIM_PC_Demo-8.4.0\build\nim.rc 51
这是当前版本用正确工具编译遇到的一个报错。
删去
FILEVERSION 8,4,0,GIT-TAG-NOTFOUND
PRODUCTVERSION 8,4,0,GIT-TAG-NOTFOUND
编译成功运行提示无dll
依然是问题多多,建议使用8.2.0包vs打开sln文件编译较为顺畅。
留下我打包的源码。
https://drive.google.com/file/d/1dUNYVmaLBZLXe6DXUQXyZsbUQVGBtyZk/view?usp=sharing
8.4.0包cmake生成后vs调试 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 RC2104 undefined keyword or key name: GIT nim_demo C:\Users\yipye\Desktop\NIM_PC_Demo-8.4.0\build\nim.rc 51 这是当前版本用正确工具编译遇到的一个报错。 删去 FILEVERSION 8,4,0,GIT-TAG-NOTFOUND PRODUCTVERSION 8,4,0,GIT-TAG-NOTFOUND 编译成功运行提示无dll 依然是问题多多,建议使用8.2.0包vs打开sln文件编译较为顺畅。 留下我打包的源码。 https://drive.google.com/file/d/1dUNYVmaLBZLXe6DXUQXyZsbUQVGBtyZk/view?usp=sharing
undefined keyword or key name: GIT
错误很可能是您没有使用 git clone 的方式去克隆代码,而是下载了代码的 zip 压缩包。使用 sln 固然是方便,但是要考虑二进制文件的下载时间,git 仓库用来管理代码非常好用,但是二进制文件如果上传到 git 仓库中会导致仓库体积变的异常的大。而且二进制文件是无法实现增量的提交的,也就是每当你修改一次二进制文件,仓库的体积会以二进制文件一倍的体积增加。这对代码仓库的维护、CI、团队协作都不是好事情。
我们希望通过 CMake 来管理的重要原因就是可以前置一些二进制文件的下载流程,将二进制文件放到有 CDN 加速的下载地址中,这样首先可以避免克隆代码速度慢,其次可以实现代码和二进制文件分离。当然修改为 CMake 的方案后会带来一些新的问题,遇到问题解决问题,而不是回归到已知有问题的工程管理方案上面去。
至于学习成本我想不必多言,开发者需要掌握一些必要的技能。
学习成本是没什么啦,git cmake build 三次命令行就好,编译时候思路比较混乱,我重新走下流程。/dog
错误 RC2104 undefined keyword or key name: GIT nim_demo C:\Users\yipye\Desktop\NIM_PC_Demo-8.4.0\build\nim.rc 51 似乎在使用git clone https://github.com/netease-im/NIM_PC_Demo.git --depth 1后编译任然会出现。
错误 RC2104 undefined keyword or key name: GIT nim_demo C:\Users\yipye\Desktop\NIM_PC_Demo-8.4.0\build\nim.rc 51 似乎在使用git clone https://github.com/netease-im/NIM_PC_Demo.git --depth 1后编译任然会出现。
可以先了解一下 WIKI 地址中 CMake 的工作流程,我这边没有办法重现你提到的问题,希望您能提供更详细的环境信息帮助我们来解决这个问题。我在首次克隆代码后执行初始化和编译均正常执行。
$ cmake -Bbuild -G"Visual Studio 15 2017" -T"v141_xp" -DCMAKE_BUILD_TYPE=Debug
############# nim_win_demo ##############
-- The C compiler identification is MSVC 19.16.27045.0
-- The CXX compiler identification is MSVC 19.16.27045.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading third party libraries from http://yx-web.nos.netease.com/package/1619605746/NIM_Windows_Demo_Build_Binaries_Debug.zip
-- Downloading NeRTC-SDK from http://yx-web.nos.netease.com/package/1618217725/NERtc_Windows_SDK_v4.1.1.zip
-- Downloading NIM cross-platform SDK from https://yx-web-nosdn.netease.im/package/1629860104/NIM_CrossPlatform_SDK_v8.7.0.zip?download=NIM_CrossPlatform_SDK_v8.7.0.zip
-- ================== wrapper ==================
+ -- Current git tag: 8.7.0, commit count: 1, describe: 8.7.0
############# core #############
############# base #############
############# duilib #############
############# shared #############
############# db #############
############# transfer file P2P #############
############# av_kit #############
############# rtc_kit #############
############# capture_image #############
############# image_view #############
############# nim_service #############
############# ui_kit #############
############# cef_module #############
############# cef_render #############
############# libcef_dll_wrapper #############
############# app_sdk #############
############# nim_demo #############
############# nim demo uninstaller #############
-- Configuring done
-- Generating done
-- Build files have been written to: E:/Documents/Repositories/demos/NIM_PC_Demo/build
我用的是Visual Studio 2022,打开项目自动初始化是正常的,编译的时候报错
目前脚本仅支持生成 Visual Studio 2017 32位 Debug/Release 的解决方案。如果您只安装了 Visual Studio 2019 则无法满足需求,您必须安装 Visual Studio 2017 IDE 并在生成工程时明确使用 -G 参数指定生成的解决方案版本 -G"Visual Studio 15 2017"。
vs 2017 cmake --build build --config Debug --target INSTALL build虚拟机中磁盘空间满了 XD 重新来
如果是第一次使用vs2017编译除了默认的C++开发套件可能还需要一个工具,cmake编译不知道会不会提示出来,可以先调试sln看报错找下需要下载的项目
git clone https://github.com/netease-im/NIM_PC_Demo.git --depth 1 cmake -Bbuild -G"Visual Studio 15 2017" -T"v141_xp" -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug --target INSTALL 编译成功但是运行有一个报错。 Debug Assertion Failed!
Program: ...ipye\Desktop\cccc\NIM_PC_Demogit\NIM_PC_Demo\bin\nim_demo.exe File: C:\Users\yipye\Desktop\cccc\NIM_PC_Demogit\NIM_PC_Demo\nim_win_demo\module\config\config_helper.cpp Line: 108
Expression: false
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
git clone https://github.com/netease-im/NIM_PC_Demo.git --depth 1 cmake -Bbuild -G"Visual Studio 15 2017" -T"v141_xp" -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug --target INSTALL 编译成功但是运行有一个报错。 Debug Assertion Failed!
Program: ...ipye\Desktop\cccc\NIM_PC_Demogit\NIM_PC_Demo\bin\nim_demo.exe File: C:\Users\yipye\Desktop\cccc\NIM_PC_Demogit\NIM_PC_Demo\nim_win_demo\module\config\config_helper.cpp Line: 108
Expression: false
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
这是断言失败,在 108 行代码检查如果写入私有化配置失败,则该断言会被触发。https://github.com/netease-kit/NIM_PC_Demo/blob/master/nim_win_demo/module/config/config_helper.cpp#L108
尝试调试代码查看因为什么原因写入失败,是否使用了旧的数据库导致新的数据写入失败?
XD 我注释掉了108行 //狗头保命
执行cmake --build build --config Debug --target INSTALL 报错ninja: error: unknown target 'INSTALL'