Skip to content

Compiling

ByeongKeon Kim edited this page Jul 12, 2019 · 53 revisions

Important: Follow the Getting Started guide first to get the code. Before you can compile, you'll need the source code. Ensure you checkout the appropriate branch you wish to compile, e.g. if you wish to compile v2.0, git checkout v2-dev.

Also, this guide is for compiling Synergy Core v1.9 and up (including v2.0). If using v1.3.5 to v1.8, follow the Compiling Legacy guide.

Dependencies

Important: Please also reflect changes in the Core Compiling guide.

Windows

  1. Install Git for Windows
  2. Install Visual Studio Professional 2015 with Updates
    1. Select Custom
    2. Deselect all
    3. Within Programming Languages, select Visual C++
    4. Git for Windows should already be installed
  3. Download the Windows 10 SDK Web Installer
    1. Click Download the installer (not the iso)
    2. Use default options for first 2 screens
    3. On the feature screen, untick everything except Debugging Tools for Windows
  4. Install Bonjour
    1. Download: Bonjour SDK for Windows v3.0
  5. Install Qt
    1. Install to C:\Qt
    2. Select Qt 5.9.5
  6. Add 'C:\Qt\Tools\QtCreator\bin' to the system PATH
  7. Install CMake
    1. Add CMake to PATH for all users
  8. Restart Qt
  9. Set CMAKE_PREFIX_PATH environment variable
    1. C:\Qt\5.9.5\msvc2017_64
  10. Now follow the compile steps below

macOS

  1. Install Homebrew
  2. Install XCode (also available via the Mac App Store)
    1. Update the command line tools setting - Preferences -> Locations
    2. In the Command Line Tools drop down, select "Xcode 9.4"
  3. Install the latest version of Qt 5.9 Qt (5.9.6 as of Jun 11/18)
    1. Choose open source option when downloading the installer
    2. Run the installer
    3. At the component selection screen, select "LTS" and refresh. Qt 5.9.x should be visible in the dropdown: select macOS for the latest 5.9.x version (5.9.8 as of 2019-07-01)
    4. At bottom of list ensure Qt Creator is selected under "Tools", it should be selected by default
    5. Select Continue, agree to terms, and install
  4. Install cmake, openssl, libsodium using Homebrew: brew install cmake openssl libsodium
  5. Now follow the compile steps below

Ubuntu 16.04 and up

  1. $ sudo apt install qtcreator qtbase5-dev cmake make g++ xorg-dev libssl-dev libx11-dev libsodium-dev libgl1-mesa-glx libegl1-mesa libcurl4-openssl-dev libavahi-compat-libdnssd-dev qtdeclarative5-dev libqt5svg5-dev libsystemd-dev
  2. Edit the Qt kit "Environment" field under Tools -> Options -> Build & Run -> Kits and add BOOST_ROOT=/home/<user>/boost

CentOS 7

sudo yum groupinstall "Development Tools"
sudo yum -y install epel-release cmake3 boost-static git libXtst-devel qt5-qtbase-devel qt5-qtdeclarative-devel libcurl-devel openssl-devel

Fedora 28 (may work for earlier releases)

sudo yum groupinstall "Development Tools"
sudo yum -y install avahi-compat-libdns_sd-devel avahi-compat-libdns_sd cmake3 boost-static git libXtst-devel qt5-qtbase-devel qt5-qtdeclarative-devel libcurl-devel openssl-devel

SUSE Linux 12 SP3

sudo zypper install avahi-compat-mDNSResponder-devel libavahi-devel libqt5-qtbase-devel cmake libopenssl-devel libcurl-devel libXtst-devel

Compile Steps

Make sure you have completed the steps at Getting Started.

IDE Compile

Compiling from the IDE (e.g. Qt Creator).

macOS Only

Do this first on macOS.

  1. Qt Creator > Preferences > Build & Run > CMake
  2. Click Add, set Path to: /usr/local/bin/cmake
  3. Go to the Kits tab
  4. Set the C compiler to Clang 64-bit
  5. Restart Qt Creator

Note: this may already be pre-configured for you.

All OSes

  1. Open Qt Creator
  2. If macOS, follow macOS Only steps
  3. Open Project
  4. Navigate to the project directory (from git clone)
  5. Open CMakeLists.txt
  6. Untick "Imported Kit"
  7. Expand "Desktop Qt..."
  8. Untick all except Debug and Release
  9. Right-click project and select Run CMake
  10. If macOS, follow macOS Post-CMake steps
  11. Right-click project and select Build

macOS Post-CMake

  1. Open Projects
  2. Select Build
  3. Find CMAKE_OSX_DEPLOYMENT_TARGET
  4. Set value to your version of OSX, e.g. 10.10, 10.13, etc. If you do not match the version of the OS SDK libraries you are linking against, there will be a lot of warnings during the build. By using the correct version, you will only receive deprecation warnings.
  5. Find CMAKE_OSX_SYSROOT
  6. Set value to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/
  7. Click Apply Configuration Changes
  8. Go back to the All OSes steps (above)

Run synergy.exe standalone in Windows

These steps apply to 64-bit compilations.

In release and debug mode:

  1. Copy all contents of synergy-core/ext/openssl/windows/x64/bin/* to {build_folder}/bin/
  2. Copy the following files from {QtInstallDir}/{Version}/MSVC2017_64bit/bin/ to {build_folder}/bin/:
    • Qt5Core.dll
    • Qt5Gui.dll
    • Qt5Network.dll
    • Qt5Widgets.dll

In debug mode only:

  1. Copy all the files requested in release mode
  2. Also from Qt installation directory, copy the following files (pay attention to the letter d in file names):
    • Qt5Cored.dll
    • Qt5Guid.dll
    • Qt5Networkd.dll
    • Qt5Widgetsd.dll

CLI Compile

Compiling from the command line.

Windows

cd Projects\synergy
mkdir build
cd build
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Debug ..
msbuild synergy-core.sln /p:Platform="x64" /p:Configuration=Debug /m
cd ..
copy ext\openssl\windows\x64\bin\* build\

Example

  • QT version is 5.12.3, and is installed at 'C:\Qt\5.12.3'
  • Windows 10 SDK version is 10.0.18362.0
  • Open C:\Program Files (x86)\Windows Kits\10\SDKManifest.xml
  • Find 'PlatformIdentity = "UAP, Version=10.0.18362.0"'
  • Visual studio 2019 community
  • Your source path is "c:<path>\synergy-core"
  • Your host is x64
  • Will build as x64 binary
set CMAKE_PREFIX_PATH=C:\Qt\5.12.3\msvc2017_64
cd "c:\<path>\synergy-core"
mkdir build
cd build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 10.0.18362.0
cmake -G "Visual Studio 16 2019"  -DCMAKE_BUILD_TYPE=Debug ..
msbuild synergy-core.sln /p:Platform="x64" /p:Configuration=Debug /m
cd ..
copy ext\openssl\windows\x64\bin\* build\

macOS

cd Projects/synergy
mkdir build
cd build
QT_PATH=$HOME/Qt/5.9.3/clang_64
export PATH=$PATH:/usr/local/bin:$QT_PATH/bin
#cmake -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DOSX_TARGET_MAJOR=10 -DOSX_TARGET_MINOR=12 -DCMAKE_OSX_ARCHITECTURES=x86_64 ..
cmake  -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_CONFIGURATION_TYPES=$CMAKE_BUILD_TYPE ..
make

Linux

cd Projects/synergy
mkdir build
cd build
cmake ..
make
You can’t perform that action at this time.