Compilation

cwoelkers edited this page Jul 25, 2018 · 58 revisions

Compilation

First, you’ll need to get the sources. Everything below assumes you’ll have checked out the FreeRDP sources and you’re now in the source dir:

git clone git://github.com/FreeRDP/FreeRDP.git
cd FreeRDP

Linux Specifics

Install the suggested base dependencies:

debian based

sudo apt-get install ninja-build build-essential git-core debhelper cdbs dpkg-dev autotools-dev cmake pkg-config xmlto libssl-dev docbook-xsl xsltproc libxkbfile-dev libx11-dev libwayland-dev libxrandr-dev libxi-dev libxrender-dev libxext-dev libxinerama-dev libxfixes-dev libxcursor-dev libxv-dev libxdamage-dev libxtst-dev libcups2-dev libpcsclite-dev libasound2-dev libpulse-dev libjpeg-dev libgsm1-dev libusb-1.0-0-dev libudev-dev libdbus-glib-1-dev uuid-dev libxml2-dev libgstreamer1.0-dev libgstreamer0.10-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-base0.10-dev

Building 1.0.1 or master requires:

sudo apt-get install libavutil-dev libavcodec-dev libavresample-dev

rhel based

sudo yum install gcc cmake ninja-build openssl-devel libX11-devel libXext-devel libXinerama-devel libXcursor-devel \
  libXi-devel libXdamage-devel libXv-devel libxkbfile-devel alsa-lib-devel cups-devel ffmpeg-devel glib2-devel

Fedora 28 and close relatives

sudo dnf -y install ninja-build cups-devel dbus-glib-devel dbus-devel systemd-devel libuuid-devel pulseaudio-libs-devel gcc-c++ libXrandr-devel \
  faac faac-devel gcc cmake openssl-devel libX11-devel libXext-devel libXinerama-devel libXcursor-devel \
  libXi-devel libXdamage-devel libXv-devel libxkbfile-devel alsa-lib-devel cups-devel ffmpeg-devel glib2-devel

Optionally, you can install the following dependencies:

debian based

sudo apt-get install libcunit1-dev libdirectfb-dev xmlto doxygen libxtst-dev

where cunit is for the unit tests, directfb is for dfreerdp, xmlto is for man pages, and doxygen for API documentation.

Build a nightly package

ln -s packaging/deb/freerdp-nightly debian
dpkg-buildpackage

Generating makefiles using cmake:

FreeRDP uses cmake to create the Makefiles necessary to build the project. The following cmake command turns on some common options (including USB redirect and various sound subsystems)

cmake -GNinja -DCHANNEL_URBDRC=ON -DWITH_DSP_FFMPEG=ON -DWITH_CUPS=ON -DWITH_PULSE=ON .

Review the output of your cmake command carefully: if you’re hoping to use a feature of FreeRDP, cmake must have that feature turned on (typically with a -DWITH_XXX=ON), and it also must find all the necessary files for that feature to be built. This will often include extra -dev or -devel packages which provide specific header files for the compilers used.
At this point, you can use ccmake . you can check the available options and change them to your liking.

Build:

cmake --build . will compile the project for you

If you are using Eclipse, you can also generate Eclipse project files:

cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DWITH_SSE2=ON .

See Build Options for a list of options.

Install:

cmake --build . --target install will install FreeRDP on your system

with cmake --build . --target package you can create tarballs for deployment.

You should now have xfreerdp installed in /usr/local/bin:

awake@envy:~$ which xfreerdp
/usr/local/bin/xfreerdp

And you should be able to review the build flags actually determined during the compilation:

awake@envy:~$ xfreerdp /buildconfig
This is FreeRDP version 2.0.0-dev3 (4d0876fcc)
Build configuration: BUILD_TESTING=OFF BUILTIN_CHANNELS=ON HAVE_AIO_H=1 HAVE_EXECINFO_H=1 HAVE_FCNTL_H=1 HAVE_INTTYPES_H=1 HAVE_JOURNALD_H=TRUE HAVE_MATH_C99_LONG_DOUBLE=1 HAVE_POLL_H=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK=ON HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL= HAVE_SYSLOG_H=1 HAVE_SYS_EVENTFD_H=1 HAVE_SYS_FILIO_H= HAVE_SYS_MODEM_H= HAVE_SYS_SELECT_H=1 HAVE_SYS_SOCKIO_H= HAVE_SYS_STRTIO_H= HAVE_SYS_TIMERFD_H=1 HAVE_TM_GMTOFF=1 HAVE_UNISTD_H=1 HAVE_XI_TOUCH_CLASS=1 WITH_ALSA=ON WITH_CCACHE=ON WITH_CHANNELS=ON WITH_CLIENT=ON WITH_CLIENT_AVAILABLE=1 WITH_CLIENT_CHANNELS=ON WITH_CLIENT_CHANNELS_AVAILABLE=1 WITH_CLIENT_COMMON=ON WITH_CLIENT_INTERFACE=OFF WITH_CUPS=OFF WITH_DEBUG_ALL=OFF WITH_DEBUG_CAPABILITIES=OFF WITH_DEBUG_CERTIFICATE=OFF WITH_DEBUG_CHANNELS=OFF WITH_DEBUG_CLIPRDR=OFF WITH_DEBUG_DVC=OFF WITH_DEBUG_KBD=OFF WITH_DEBUG_LICENSE=OFF WITH_DEBUG_MUTEX=OFF WITH_DEBUG_NEGO=OFF WITH_DEBUG_NLA=OFF WITH_DEBUG_NTLM=OFF WITH_DEBUG_RAIL=OFF WITH_DEBUG_RDP=OFF WITH_DEBUG_RDPDR=OFF WITH_DEBUG_RDPEI=OFF WITH_DEBUG_REDIR=OFF WITH_DEBUG_RFX=OFF WITH_DEBUG_RINGBUFFER=OFF WITH_DEBUG_SCARD=OFF WITH_DEBUG_SND=OFF WITH_DEBUG_SVC=OFF WITH_DEBUG_SYMBOLS=OFF WITH_DEBUG_THREADS=OFF WITH_DEBUG_TIMEZONE=OFF WITH_DEBUG_TRANSPORT=OFF WITH_DEBUG_TSG=OFF WITH_DEBUG_TSMF=OFF WITH_DEBUG_WND=OFF WITH_DEBUG_X11=OFF WITH_DEBUG_X11_CLIPRDR=OFF WITH_DEBUG_X11_LOCAL_MOVESIZE=OFF WITH_DEBUG_XV=OFF WITH_DIRECTFB=OFF WITH_DSP_EXPERIMENTAL=OFF WITH_DSP_FFMPEG=ON WITH_EVENTFD_READ_WRITE=1 WITH_FAAC=ON WITH_FAAD2=OFF WITH_FFMPEG=TRUE WITH_FFMPEG=TRUE WITH_GFX_H264=ON WITH_GPROF=OFF WITH_GSM=OFF WITH_GSSAPI=OFF WITH_GSTREAMER_0_10=OFF WITH_GSTREAMER_1_0=OFF WITH_ICU=OFF WITH_IPP=OFF WITH_JPEG=OFF WITH_LAME=OFF WITH_LIBRARY_VERSIONING=ON WITH_LIBSYSTEMD=ON WITH_MACAUDIO=OFF WITH_MACAUDIO=OFF WITH_MACAUDIO_AVAILABLE=0 WITH_MANPAGES=ON WITH_MBEDTLS=OFF WITH_OPENH264=OFF WITH_OPENSLES=OFF WITH_OPENSSL=ON WITH_OSS=ON WITH_PCSC=OFF WITH_PROFILER=OFF WITH_PULSE=ON WITH_SAMPLE=OFF WITH_SANITIZE_ADDRESS=OFF WITH_SANITIZE_ADDRESS_AVAILABLE=1 WITH_SANITIZE_MEMORY=OFF WITH_SANITIZE_MEMORY_AVAILABLE=1 WITH_SANITIZE_THREAD=OFF WITH_SANITIZE_THREAD_AVAILABLE=1 WITH_SERVER=OFF WITH_SERVER_INTERFACE=ON WITH_SMARTCARD_INSPECT=OFF WITH_SSE2=ON WITH_THIRD_PARTY=OFF WITH_URBDRC_CLIENT=ON WITH_VALGRIND_MEMCHECK=OFF WITH_VALGRIND_MEMCHECK_AVAILABLE=1 WITH_WAYLAND=OFF WITH_X11=ON WITH_X264=OFF WITH_XCURSOR=ON WITH_XEXT=ON WITH_XFIXES=ON WITH_XI=ON WITH_XINERAMA=ON WITH_XKBFILE=ON WITH_XRANDR=OFF WITH_XRENDER=ON WITH_XSHM=ON WITH_XV=ON WITH_ZLIB=ON
Build type:          Debug
CFLAGS:               -fPIC -Wall -Wno-unused-result -Wno-unused-but-set-variable -Wno-deprecated-declarations -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -g
Compiler:            GNU, 8.1.1
Target architecture: x64

Plugins are installed in /usr/local/lib(64)/freerdp:

awake@envy:/usr/local/lib64/freerdp$ ls
ibaudin-client-alsa.so  libdisp-client.so   libgeometry-client.so  librdpgfx-client.so       librdpsnd-client-oss.so       libtsmf-client-ffmpeg-decoder.so  libvideo-client.so
libaudin-client-oss.so   libdrive-client.so  libparallel-client.so  librdpsnd-client-alsa.so  libserial-client.so           libtsmf-client-oss-audio.so
libaudin-client.so       libecho-client.so   librdpei-client.so     librdpsnd-client-fake.so  libtsmf-client-alsa-audio.so  libtsmf-client.so

After launching FreeRDP at least once, ~/.freerdp will be created to store known hosts:

awake@envy:~/.freerdp$ ls
cacert  known_hosts

CA certificates can be added to ~/.freerdp/cacert for additional trusted CAs.

Uninstall:

To uninstall by deleting all created files run:

sudo xargs rm < install_manifest.txt

macOS Specifics

Using a package manager

If you’re using MacPorts then just install FreeRDP port:

sudo port install FreeRDP

FreeRDP is now available as a homebrew recipe.

brew tap homebrew/x11
brew install freerdp
sudo brew link freerdp

Compiling from sources

You’ll need cmake in order to build from source.
Install it if you don’t have it already, then to make a universal binary build, use:

cmake -D "CMAKE_OSX_ARCHITECTURES:STRING=i386;x86_64" . && make

To make a 64-bit only binary:

cmake -D "CMAKE_OSX_ARCHITECTURES:STRING=x86_64" . && make

OpenSSL in MacOS

If you’ve got CMake error about OpenSSL

CMake Error at /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindOpenSSL.cmake:333 (find_package_handle_standard_args)

try to setup OpenSSL environment variables while configuring build. For example, using OpenSSL libraries from Homebrew:

export PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl/lib/pkgconfig
cmake .
cmake --build .

If you are interested in trying out multimedia redirection on a Mac, use the following steps:

Install ffmpeg, using MacPorts:

sudo port install ffmpeg-devel

or compiling it from sources by following instructions at http://www.martinlos.com/?p=41 – tested on Mountain Lion.

If attempting to compile for media redirection on Mac, and enabling ffmpeg using cmake, make sure ffmpeg configure is run with —arch=x86_64. For example, the following is a working configuration step before running make for ffmpeg:

./configure --enable-runtime-cpudetect --enable-libxvid --arch=x86_64 --disable-stripping --enable-gpl \
  --enable-nonfree --cc=clang --extra-cflags="-I/sw64/include -m64" --extra-ldflags=-m64 --enable-libmp3lame \
  --enable-libfaac --enable-shared --enable-static

Use the following steps for compiling and installing Pulseaudio:

sudo port install json-c gettext intltool speex libsndfile
sudo ./configure --with-udev-rules-dir=/usr/local/lib/udev/rules.d \
  --with-mac-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk \
  --with-mac-version-min=10.8
sudo make install

Compiling with Visual C++ 2010 Express
See this page and 2012 32/64 bit builds See this page

Cross-Compilation using Mingw-w64

FreeRDP can be compiled for Windows (32/64 Bit) on a Linux system using the Mingw cross-compilers. The following instruction was tested with Mingw-w64 2.0 and gcc-4.7 on Scientific Linux 6.1 (x64) but should work relatively independent of the Mingw/gcc version.

1. Install the Mingw-cross compilers (most Linux distros offer binary packages for Mingw in their repos). On older distros you may need to compile the latest version of Mingw from source. If you want to create 32 Bit binaries only, then Mingw32 is sufficient, otherwise you should install Mingw-w64.

2. Download the latest version of openssl (https://www.openssl.org/), compile it using the Mingw cross-compilers and install it. Instructions how to do this can be found on http://www.blogcompiler.com/.

3. Download FreeRDP and unpack the source archive. Create a subdirectory in the FreeRDP source tree called “mingw_build” where FreeRDP will be build. Open a terminal and goto this directory. Enter the command

cmake -DCMAKE_SYSTEM_NAME="Windows" \
      -DCMAKE_C_COMPILER="/opt/mingw64/bin/x86_64-w64-mingw32-gcc" \
      -DCMAKE_RC_COMPILER="/opt/mingw64/bin/x86_64-w64-mingw32-windres" \
      -DCMAKE_INSTALL_PREFIX="/opt/mingw64" \
      -DBUILD_SHARED_LIBS=OFF \
      -DCMAKE_C_FLAGS="-DFREERDP_EXPORTS -Dsprintf_s=snprintf" \
      -DCMAKE_EXE_LINKER_FLAGS="-L/opt/mingw64/lib" \
      -DWITH_SSE2=OFF \
      -DWITH_SSE2_TARGET=OFF \
      -DOPENSSL_INCLUDE_DIR="/opt/mingw64/include" \
      -DLIB_EAY="/opt/mingw64/lib/libcrypto.a" \
      -DSSL_EAY="/opt/mingw64/lib/libssl.a" \
      ..

This will configure FreeRDP for cross-compilation. Note that you need to adjust the paths according to your installation of Mingw and OpenSSL. Using the command above the wfreerdp.exe binary will be statically linked and can be executed on any Windows machine.

Note: You need a recent version of cmake (I used 2.8.7) as the logic in the FindOpenSSL cmake makro is broken (for cross-compilation) in older versions.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.