原文地址:Synergy之编译安装(永久地址,保存网址不迷路 🙃)
注意事项
目前(09/28/2020),建议使用 Barrier(forked from symless/synergy-core)的替代 Synergy 产品。
如果坚持使用 Synergy 产品,建议参考 Synergy/Installation 笔记的「使用 二进制包 安装」部分。
源码编译安装(Linux)
虽然官网提供编译好的包,但是要付费购买。
详细的编译细节可以参考 Github 仓库中的 Wiki:https://github.com/symless/synergy-core/wiki/Compiling
编译通过的系统:Kali GNU/Linux Rolling、Max OSX 10.12.6
系统环境:Kali GNU/Linux Rolling
Synergy版本:2.0.0
安装依赖,准备,编译,安装:
# 安装依赖(参照文档中的Debian7/8) apt-get install build-essential cmake libavahi-compat-libdnssd-dev \ libcurl4-openssl-dev libssl-dev lintian python \ qt4-dev-tools xorg-dev fakeroot # 下载源码Github Repo:https://github.com/symless/synergy-core git clone https://github.com/symless/synergy-core.git cd synergy-core # 构建并编译 mkdir build && cd build cmake .. make # 最终编译生成的文件位于build/bin下。
源码编译安装(macOS)
Mac OSX中安装Synergy,依旧是参考Github仓库中的Wiki:https://github.com/symless/synergy-core/wiki/Compiling
系统环境:Max OSX 10.12.6
Synergy版本:2.0.0
安装依赖,准备,编译,安装:
# Install Homebrew # Install XCode (also available via the Mac App Store) # You may need to open XCode, go to Preferences, select Locations, and then make sure an option is selected for Command Line Tools. # Install cmake, Qt, and openssh using Homebrew brew install cmake brew install qt brew install openssh # Find the path for Qt installation - this should be something like "usr/local/Cellar/qt/4.8.7_2/Frameworks" brew info qt # Add the qt installation path from the previous step to the CMAKE_PREFIX_PATH (replace "usr/local/Cellar/qt/4.8.7_2/Frameworks" with the path found in the previous step) export CMAKE_PREFIX_PATH="usr/local/Cellar/qt/4.8.7_2/Frameworks" # 下载源码并进入源码目录 git clone https://github.com/symless/synergy-core.git cd synergy-core mkdir build cd build # 准备 cmake -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_OSX_ARCHITECTURES=x86_64 .. # 编译 make
安装的二进制程序
在 Synergy-v2.0.0 中包含的程序
synergyc
synergy-core
synergys
常见错误汇总
#1 dns_sd.h: No such file or directory
-Itmp/release -I. -o tmp/release/ZeroconfRegister.o src/ZeroconfRegister.cpp
In file included from src/ZeroconfRegister.cpp:18:0:
src/ZeroconfRegister.h:32:20: fatal error: dns_sd.h: No such file or directory
解决:安装libavahi-compat-libdnssd-dev
#2 make: /usr/lib/x86_64-linux-gnu/qt4/bin/uic: Command not found
......
Entering dir: src/gui
make: Entering directory '/mnt/extra320g/pkg/synergy/src/gui'
/usr/lib/x86_64-linux-gnu/qt4/bin/uic res/MainWindowBase.ui -o ui_MainWindowBase.h
make: /usr/lib/x86_64-linux-gnu/qt4/bin/uic: Command not found
Makefile:497: recipe for target 'ui_MainWindowBase.h' failed
make: *** [ui_MainWindowBase.h] Error 127
make: Leaving directory '/mnt/extra320g/pkg/synergy/src/gui'
Going back to: /mnt/extra320g/pkg/synergy
Error: make -w failed with error: 512
解决:安装libqt4-dev-bin。如果你使用的是其他发行版,可能会使别的名字,可以参考另外一篇文章:《如何查找某个文件所属的软件包》
#3 fatal error: QApplication: No such file or directory
de/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -Isrc -I../lib/shared -Itmp/release -I. -o tmp/release/main.o src/main.cpp
In file included from src/main.cpp:22:0:
src/QSynergyApplication.h:23:24: fatal error: QApplication: No such file or directory
compilation terminated.
Makefile:561: recipe for target 'tmp/release/main.o' failed
make: *** [tmp/release/main.o] Error 1
原因:因为缺少相关的头文件。
解决:安装libqt4-dev。如果你使用的是其他发行版,可能会使别的名字,可以参考另外一篇文章:《如何查找某个文件所属的软件包》
#4 ERROR: ipc connection error, connection refused
Windows中启动Synergy以后,总是提示:
[2017-10-03T00:12:44] ERROR: ipc connection error, connection refused
解决方法,在服务管理里面,启动 synergy 服务即可: