Build TigerVNC project under Windows platform


VNC is a remote graphical desktop protocol, and TigerVNC (Tiger Virtual Network Computing) is an implementation of the VNC protocol. Through the TigerVNC application, we can realize cross-platform remote desktop control. The TigerVNC project address is as follows:
https://github.com/TigerVNC/tigervnc.

One thing to note, since the Windows side of TigerVNC is no longer maintained, there may be problems during use.

Here's how to build a TigerVNC project under the Windows platform:

Building under the Windows platform requires the use of the mingw compiler, and it is recommended to use MSYS2 to provide a mingw-like compilation environment.
After installing MSYS2, enter the MSYS2-MINGW64 / MSYS2-MINGW32 terminal to configure the development environment.

Configure the development environment

1. Configure mirror source

Since Mingw needs to download some software packages when configuring the development environment, we need to update the corresponding mirror source in order to improve the download speed.

The address information of the update source is in the InstallDir\msys64\etc\pacman.d directory, and the file list is: mirrorlist.mingw32, mirrorlist.mingw64 and mirrorlist.msys.

Add the following mirror address at the top of the mirrorlist.msys file:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch

Add the following mirror address at the top of the mirrorlist.mingw32 file:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686

Add the following mirror address at the top of the mirrorlist.mingw64 file:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64

2. Update source information

After the source address is updated, execute the update command on the corresponding terminal to synchronize the source information

pacman -Syu  

3. Install the corresponding dependent library

pacman -Syu 
pacman -S make yasm diffutils pkg-config
pacman -S mingw-w64-i686-cmake
pacman -S mingw-w64-i686-fltk
pacman -S mingw-w64-i686-gnutls
pacman -S mingw-w64-i686-gcc
pacman -S mingw-w64-i686-make
pacman -S mingw-w64-i686-pixman

4. Modify the compilation dependency library

TigerVNC will report various errors and exceptions during the static compilation process. Sometimes the error is a problem with the dependent library. Here we modify the dependent library file; the file address is: tigervnc\cmake\StaticBuild.cmake. The modification is as follows:

# 第68行
set(GNUTLS_LIBRARIES "-Wl,-Bstatic -lgnutls -lpthread -lzstd -lbrotlienc -lbrotlicommon -lbrotlidec")

# 第184行
if(WIN32)
    set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread")

5. Execute compilation

# 创建构建目录
cd tigerVNC
mkdir build
cd build

# 指定GNUTLS目录地址 构建方式为静态编译
cmake -G "MinGW Makefiles"  -DGNUTLS_INCLUDE_DIR=/mingw64/include -DGNUTLS_LIBRARY=/mingw64/lib/libgnutls.a -DBUILD_STATIC=1 ../

# 进行构建
mingw32-make.exe

run the program

The role of each application generated by tigerVNC:

vncviewer     # 是跨平台的TigerVNC客户端 使用FLTK编写  
winvnc        # 是Windows系统下的tigerVNC的服务端  
vncconfig     # 用来配置和控制正在运行的VNC  

Start winvcn on the controlled end and wait for the controlled end, then start vncviewer on the control end and enter the IP address of the controlled end to realize remote control.

Guess you like

Origin blog.csdn.net/yang1fei2/article/details/132068936