Skip to content

Building on OSX (not official)

zeilenschubser edited this page Nov 15, 2024 · 15 revisions

Disclaimer

xrdp on macOS is not officially supported by the xrdp team so far, but we welcome your contributions and volunteers. This document is brought by contributors. Feel free to edit this document but we xrdp team are not involved xrdp on macOS.

To whom want to use xrdp on macOS, SHARE YOUR KNOWLEDGE WITH EACH OTHER.

There's also a gitter chatroom to have talk with xrdp on Mac users.

Tested Versions

MacOS xRDP XorgxRDP
10.14.3 0.9.9 ?
11.0.1 0.9.15 ?
12.2.1 0.9.19 0.2.18

Building xrdp on OSX

Work in progress.

Since Mac OS 10.10, the OpenSSL headers are not included with the Xcode command line tools. The libraries are available, but they are obsolete (0.9.8). Linking xrdp against those old libraries will fail. You'll need OpenSSL from MacPorts or Homebrew.

Prerequisites

  • Install Xcode command line tools: xcode-select --install
  • Install Homebrew: http://brew.sh/
  • Install OpenSSL from Homebrew: brew install openssl
  • Install Automake + Autoconf: brew install automake
  • Install Libtool: brew install libtool
  • Install pkgconfig: brew install pkgconfig
  • Install nasm: brew install nasm (needed by librfxcodec)
  • Install XQuartz: brew install xquartz
  • Install libx1ll: brew install libx11
  • Install libxfixes: brew install libxfixes
  • Install libxrandr: brew install libxrandr

Build xrdp

Get the release tarball xrdp-0.9.19.tar.gz and unpack it.

Intel versions of Mac utilize /usr/local, while Apple Silicon versions of Mac use /opt/homebrew as noted here. This should be returned by brew --prefix

./bootstrap
./configure PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl/lib/pkgconfig CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ --host=arm-linux --with-cflags="-mfpu=neon"
make LIBTOOL="glibtool"
sudo make install LIBTOOL="glibtool"

Build xorgxrdp

Get the release tarball xorgrdp-0.2.18.tar.gz and unpack it.

On Big Sur and later, you may need to use the following configure command instead of the one noted below:

./configure PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:$(brew --prefix)/opt/openssl/lib/pkgconfig

Maybe you have to remove the line PKG_CHECK_MODULES([XRDP], [xrdp >= 0.1]) in configure.ac

./bootstrap
./configure PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
make
sudo make install

Wrong include path like below occurs when run make on xorgxrdp

/opt/X11/include/xorg/misc.h:74:10: fatal error: 'X11/Xosdefs.h' file not found
#include <X11/Xosdefs.h>

I just copied X11(/opt/X11/include/X11) folder into xorg(/opt/X11/include/xorg/X11). sudo cp -R /opt/X11/include/X11 /opt/X11/include/xorg/X11

Ok, whats next?

  • The remaining work is to be able to start X with the xrdpxorg module. This is the actual stopper.

  • service is in ...

❯ which xrdp
/usr/local/sbin/xrdp

If you get an empty output from the which xrdp command, you need to add /usr/local/sbin to your path. You can do this from your BASH or ZSH profile by export PATH=$PATH:/usr/local/sbin to the bottom of your profile. From there, source the profile or restart your terminal and verify you get the proper output from the which xrdp command.

  • a launchDaemon will be responsible to start the service (not needed for the moment)

  • can run sudo /usr/local/sbin/xrdp and connect via client.. but produces black screen why? (Perhaps no window manager?)

  • I don't know if this is related but on Debian it is a common issue that you only get a black screen when connecting if you are still logged in on the host. I will compile this and try this myself, the solution I see would be running xrdp via daemon and logging out before connecting.

  • [Update: April 2022] With regards to the above, using the commands to compile and build, I was successfully able to RDP into a Mac laptop from a Windows machine while getting the proper screen, without having to log out. YMMV.

Common Troubleshooting Notes

Unknown Type Error

Error: Compiling xrdp fails and the console spits out a bunch of unknown type errors

Example: /usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t' uint64_t ri_system_time; ^

Fix: The local libraries in /usr/local/include directory are outdated despite updated libraries being installed on the system as part of the OSX commandline tools. As a workaround to tell g++/clang to ignore the outdated libaries in this directory, change the directory name:

# mv /usr/local/include /usr/local/include_old

Make sure you re-run the configuration generation before compiling again:

./bootstrap
./configure PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

Tested Versions: MacOS 10.14.3 with XRDP v0.9.9

'X11/fonts/libxfont2.h' file not found

Error Message:

/Library/Developer/CommandLineTools/usr/bin/make all-recursive
Making all in module
CC rdpDraw.lo
In file included from rdpDraw.c:44:
/opt/X11/include/xorg/dixfontstr.h:30:10: fatal error: 'X11/fonts/libxfont2.h' file not found
#include <X11/fonts/libxfont2.h>
^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [rdpDraw.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Fix: Modify the file /opt/X11/include/xorg/dixfontstr.h. Change the include statement into:

#include "../X11/fonts/libxfont2.h"

Tested Versions: MacOS 11.0.1 with XRDP v0.9.15

Possible Source of Insight

Has anyone looked into the changes made by this user on MacRumors? https://forums.macrumors.com/threads/how-to-control-your-mac-using-win-rdp-client-xrdp-compiling-guide-on-osx.1770325/

He or she packaged everything up with version 0.6.0 (ancient, yes), but it just works on MacOS Mojave, as long as you disable SIP before installing (haven't tested on Catalina).

(I apologize if this is the wrong place to put this. I couldn't find any open issues that seemed fitting. Feel free to delete/move this where appropriate...)

Clone this wiki locally