2018年的时候参考Telegram桌面端(tdesktop)编译方法成功编译过tdesktop,后来比较忙,就没管它了
这段时间正好在研究IM,就把当年的Telegram工程找出来,依然能正常编译,但是无法登录了,提示需要升级
为了调试方便,只能参考官编译方指导用最新的源码再编译一遍,编译工具已经换成了VS2022,可以确定的是,参考官方编译指导可以编译成功(前提是能科学上网)
因为工作用得是VS2017,so,为了稳妥起见,还是在虚拟机里试试VS2022吧
在VMware® Workstation 16 Pro里安装Windows 10有个地方要注意,在创建虚拟机时不要指定ISO映像文件,等虚拟机创建完成后,需要在“虚拟机设置”的“选项”页里“固件类型”中选择“BIOS”,然后再加载ISO映像,否则ISO映像无法识别


一.编译

Prepare folder

The build is done in Visual Studio 2022 with 10.0.22000.0 SDK version.
注释:安装的VS2012的时候选择10.0.22000.0 SDK
Choose an empty folder for the future build, for example D:\TBuild. It will be named BuildPath in the rest of this document. Create two folders there, BuildPath\ThirdParty and BuildPath\Libraries.
All commands (if not stated otherwise) will be launched from x86 Native Tools Command Prompt for VS 2022.bat (should be in Start Menu > Visual Studio 2022 menu folder). Pay attention not to use any other Command Prompt.

Install third party software

1.Download Strawberry Perl installer from http://strawberryperl.com/ and install to BuildPath\ThirdParty\Strawberry
2.Download NASM installer from http://www.nasm.us and install to BuildPath\ThirdParty\NASM
3.Download Yasm executable from http://yasm.tortall.net/Download.html, rename to yasm.exe and put to BuildPath\ThirdParty\yasm
4.Download MSYS2 installer from http://www.msys2.org/ and install to BuildPath\ThirdParty\msys64
5.Download jom archive from http://download.qt.io/official_releases/jom/jom.zip and unpack to BuildPath\ThirdParty\jom
6.Download Python 3.9 installer from https://www.python.org/downloads/ and install to BuildPath\ThirdParty\Python39
7.Download CMake 3.21 or later installer from https://cmake.org/download/ and install to BuildPath\ThirdParty\cmake
8.Download Ninja executable from https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip and unpack to BuildPath\ThirdParty\Ninja
9.Download Git installer from https://git-scm.com/download/win and install it.
10.Download NuGet executable from https://dist.nuget.org/win-x86-commandline/latest/nuget.exe and put to BuildPath\ThirdParty\NuGet
Add Python 3.9 and NuGet to your PATH:
1.Open Control Panel -> System -> Advanced system settings.
2.Press Environment Variables....
3.Select Path.
4.Press Edit.
5.Add BuildPath\ThirdParty\Python39 value.
6.Add BuildPath\ThirdParty\NuGet value.
Open x86 Native Tools Command Prompt for VS 2022.bat, go to BuildPath and run
注释:我编译的是32位,所以打开的是 x86 Native Tools Command Prompt for VS 2022.bat
python -m pip install pywin32
注释:安装python的时一定要勾选pip

Clone source code and prepare libraries

Open x86 Native Tools Command Prompt for VS 2022.bat, go to BuildPath and run
git clone --recursive https://github.com/telegramdesktop/tdesktop.git
注释:这时如果你发现网速慢,不要在github上直接下载源码,再解压。因为它是一个递归clone。--recursive,除了telegram以外,它会clone一些telegram以外的仓库,即子仓库。
实操过程中,clone子创库时会出现443 timeout错误,此时需要用命令行设置代理(设置到环境变量中也行)
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890
这里的端口号7890需根据自己的**工具修改
印象中还有个OpenSSL SSL_read: Connection was reset, errno 10054的错误,参考下列文章一顿操作猛如虎,也不知是哪条指令起了作用
https://blog.csdn.net/m0_51269961/article/details/123709195
继续拉取子模块:git submodule update
tdesktop\Telegram\build\prepare\win.bat

Build the project

Go to BuildPath\tdesktop\Telegram and run
configure.bat -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH -D DESKTOP_APP_USE_PACKAGED=OFF -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF
注释:这里的YOUR_API_ID和YOUR_API_HASH 要替换成自己的api id和api hash,通过https://my.telegram.org/auth获取,手机号前要加+86

如果自己不是调用Telegram API来开发第三方应用,只是想测试玩玩,可以用官方提供的测试api id和api hash。
api_id: 17349 
api_hash: 344583e45741c457fe1862106095a5eb
服务器对该测试api id和api hash用很多限制,但是实测自己的桌面端给移动端发消息没问题,上面的指令变为(我用得就是这个)

configure.bat -D TDESKTOP_API_ID=17349 -D TDESKTOP_API_HASH=344583e45741c457fe1862106095a5eb -D DESKTOP_APP_USE_PACKAGED=OFF -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF

Open BuildPath\tdesktop\out\Telegram.sln in Visual Studio 2022
Select Telegram project and press Build > Build Telegram (Debug and Release configurations)
The result Telegram.exe will be located in D:\TBuild\tdesktop\out\Debug (and Release)

二.运行

最新的telegram桌面端得用移动端扫码登录,类似微信。移动端注册很方便,当然前提也是需要梯子。下图是二维码界面,详细说明了如何用移动端telegram扫码。

如果桌面端登录不上,可以设置代理后再试试,点击右上角“SETTINGS”,在弹窗中选择“use custom proxy”

代理设置成功后,左下角的小盾牌会点亮,该小盾牌是与服务器的连接状态

原文链接:https://blog.csdn.net/caoshangpa/article/details/125382685

使用VS2022编译Telegram桌面端(tdesktop)相关推荐

  1. Telegram桌面端(tdesktop)编译方法

    Telegram桌面端(tdesktop)编译方法 Telegram作为一款开源的即时聊天软件,在国外应用的非常广泛. 桌面端采用C++语言编写,界面使用Qt框架进行开发. 作为一款非常成熟的桌面客户 ...

  2. 技术干货 | 基于 Qt Quick Plugin 快速构建桌面端跨平台组件

    导读:桌面端的 UI 开发框架对比移动端.Web 端的成熟方案,一直处于不温不火的状态.随着疫情掀起的风波,桌面端在线教育.视频会议等需求不断涌现.本文将围绕 Qt Quick 的优势来介绍如何快速创 ...

  3. android studio 编译Telegram源码

    编译Telegram代码,群语音版本 Telegram github地址 编译环境 准备工作 开始编译 拉取代码 检出7.6.1 Android studio打开telegram项目 去除一些代码 运 ...

  4. Flutter 2.0 发布 | 针对 Web,移动端和桌面端构建的下一代 Flutter

    Flutter 2.0 发布 | 针对 Web,移动端和桌面端构建的下一代 Flutter 英文原文地址:https://developers.googleblog.com/2021/03/annou ...

  5. 跨桌面端之组件化实践

    本文主要介绍了千牛PC跨端框架中,我们关于组件化部分的思考.方案选择.遇到的一些问题和解法. 此文为本系列文章第三篇, 第一篇:跨全端SDK技术演进 第二篇:跨桌面端之Web容器演进 本文:跨桌面端之 ...

  6. adb懒人工具(支持所有桌面端)

    MobileTool 最近没事学习了一波flutter,移动端没想到写啥.就写了一个桌面端应用.也是之前项目的一个衍生.之前用c#写过一个使用adb操作Android手机的windows应用,主要就是 ...

  7. 使用ComposeDesktop开发一款桌面端多功能APK工具

    前言 终于算是忙完了一个阶段!!!从4月份开始,工作内容以及职务上都进行了较大的变动,最直接的就是从海外项目组调到了国内项目组.国内项目组目前有两个应用在同时跑着,而且还有几个马甲包也要维护,不知道大 ...

  8. electron 桌面端业务中的小结(坑)

    文章目录 简介 安装electron依赖 本地数据库选择 indexedDB 封装的库 SQLite Lowdb electron-store electron-json-storage-alt.el ...

  9. MAUI桌面端标题栏设置和窗口调整

    本文由网友投稿. 作者:智州Ryan 原文标题:MAUI桌面端标题栏设置和窗口调整 原文链接:https://blog.csdn.net/Sir_aligaduo/article/details/12 ...

最新文章

  1. RHEL7 timedatectl命令
  2. 〖Linux〗Ubuntu13.10中使用虚拟机对MTK手机进行线刷
  3. Boost Asio总结(9)数据缓冲区class mutable_buffer和const_buffer
  4. 解决无法将自己github上的代码clone到/usr目录下的问题
  5. ToastUtil【简单的Toast封装类】【未自定义Toast的显示风格】
  6. 使用@host获得宿主元素注入器里注入的内容
  7. 关于爬虫的一些工具。
  8. TortoiseSVN 1.9.5安装 与 Eclipse4.4.2中安装SVN插件 图解详解
  9. [新功能]查看好友最新随笔
  10. 数据产品-数据可视化工具Excel之数据透视表
  11. SCOM2012SP1环境准备和安装
  12. ORA-00054 resource busy and acquire with NOWAIT specified Cause 错误解决方法
  13. python遇到‘\u’开头的unicode编码
  14. 医院耗材管理系统开发_7
  15. TeeChart基础使用手册
  16. 为什么我用腾讯会议录屏没声音?教你一招搞定!
  17. android axis2 webservice实例,Axis2创建WebService实例.doc
  18. Android实现选择题答题(包括单选、多选和答题卡)
  19. 《C陷阱与缺陷》 阅读总结
  20. OpenKG开源系列|首个多模态开放知识图谱OpenRichpedia (东南大学)

热门文章

  1. 如何批量将多个 PPT 文档快速合并成一个文档
  2. c语言实现定积分运算
  3. HTML的无序(ul)、有序(ol)、定义(dl)列表标签
  4. Cisco设备的启动以及交换机的介绍
  5. 如何核对两个表格的“数据”是否一致?
  6. C语言学习笔记—链表(四)链表的删除
  7. [SLAM]激光SLAM初学者代码及论文推荐【转】
  8. 英语修辞手法( rhetorical devices)
  9. 中专计算机学数学,科学计算器在中职数学教学中的意义
  10. 干货:怎么样才能提升版式平面设计的大方美观?