如题 主要核心是安装 ming-w64
先安装依赖
apt install -y cmake ffmpeg libavcodec-dev libavformat-dev libavutil-dev libevent-pthreads-2.1-6 libgnutls28-dev libjpeg-dev liblzo2-dev libpng-dev libsdl2-dev libswscale-dev libsystemd-dev mingw-w64
git clone源码 https://github.com/LibVNC/libvncserver.git
修改CmakeLists.txt
CMAKE_C_COMPILER
CMAKE_CXX_COMPILER
需要指定交叉编译器
/usr/bin/x86_64-w64-mingw32-gcc-win32
/usr/bin/x86_64-w64-mingw32-g++-win32
添加修改
set(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc-win32)
set(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++-win32)
option (BUILD_SHARED_LIBS ON) //默认是编译.a 静态库 这个选项是构建 dll
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-mingw32-linux.cmake ..
cmake --build .