Dec 15, 2019

X11 on iOS

Please read

While the content below may be useful to some, the Cydia repository is no longer available due to the maintaince overhead and my loss of interest. If you still want X11 on iOS/iPadOS, check out the Procursus project.

I'm excited to announce that X11 is coming soon to iOS. Most (see below) packages and dependencies for a fully functioning X11 desktop system have been compiled and are available on Cydia for iOS 11+. All packages have been compiled for arm64 and have been tested on iOS 12.4 and iOS 13.1. This requires a jailbroken device.

Image of X11 on iOS

Image of programs running on device.

This site will serve largely as documentation for building yourself. You can add the Cydia repo below for the deb packages. Please let me know if you run across any issues with the debs; it's likely I messed up including a library or something like that. (These aren't done just yet.)

How it works

At the moment, a virtual screen is accessed via a VNC client to an Xvnc instance running on the iDevice. If you're unfamiliar, Xvnc is an X server with a virtual screen that can be accessed via VNC. The best part of this is no drivers are required: it's all handled by Xvnc.

Why

Largely just because I can. Also, I want to turn my iPad into a proper development environment, and a windowing system helps with that. It's a powerful machine with a Unix-like OS, so X11 seemed like a reasonable project. X11 allows running arbirtary applications like browsers and IDEs, assuming you can make them compile.

Current Features

  • X11 on iOS via Xvnc
  • Working window managers (jwm / twm / fluxbox)
  • Text editor (adie)
  • Image editor (azpainter)
  • OpenGL (via Mesa)
  • Loads of other libraries, tools, and applications.

Building instructions

Before you start, be sure to have an iOS SDK located at /usr/share/iPhoneOS.sdk for sbingner's llvm-10 to function. You can get the SDKs from theos.

The following tools/libraries are required to build the packages (unless you choose to build these yourself):

From MCApollo's repository:

  • Gettext
  • Glib
  • libffi
  • libxml2
  • m4
  • OpenSSL
  • perl
  • PkgConfig
  • libiconv
  • Python @ 3.7
  • readline
  • zlib
  • clang-10
  • Darwin CC Tools
  • Bison
  • Flex
  • libstdc++ (C++ Standard Library symlink)
  • automake
  • autoconf
  • ninja
  • libpng
  • gperf

In general, you can follow the instructions from Beyond LinuxFromScratch. This project is based on 9.0, with version differences or code modications marked with ⚠️ below. Applications and libs marked with ❗️ means unavailable on iOS or I was unable to build them. Empty notes means compiles and works as-is from BLFS. Additionally, all of the packages are available (generally as dylibs) on the Cydia repo linked above.

NameVersionNotes
util-macros1.19.2
xorgproto2019.2
libXau1.0.9
libXdmcp1.1.3
xcb-proto1.13
libxcb1.13.1
Freetype2.10.1
Fontconfig2.13.1 ⚠️Requires modifying stdlib.h in SDK to allow system calls. Bug with patch available here.
xtrans1.4.0
libX111.6.9
libFS1.0.8 ⚠️Need to remove some code from the libtool file. The enviroment variables aren't populated on iOS so a generated bash command is wrong. Check the output of ./configure to pinpoint the line number.
libICE1.0.1
libSM1.2.3
libXScrnSaver1.2.3
libXt1.2.0
libXmu1.1.3
libXpm3.5.13
libXaw1.0.13
libXfixes5.0.3
libXcomposite0.4.5
libXrender0.9.10
libXcursor1.2.0
libXdamage1.1.5
libfontenc1.1.4
libXfont22.0.4
libXft2.3.3
libXi1.7.10
libXinerama1.1.4
libXrandr1.5.2
libXres1.2.0
libXtst1.2.3
libXv1.0.11
libXvMC1.0.12
libXxf86dga1.1.5
libXxf86vm1.1.4
libpciaccess1.0.12 ❗️Unsupported OS
libdmx1.1.4
libxkbfile1.1.0
xcb-util0.4.0
xcb-util-image0.4.0
xcb-util-keysyms0.4.0
xcb-util-keysyms0.4.0
xcb-util-renderutil0.3.9
xcb-util-wm0.4.1
xcb-util-cursor0.1.3
Mako1.1.0If you can't build yourself, try using pip
Mesa0.52.1 ⚠️Set DRI drivers to swrast and set gallium drivers to empty. I manually modifed meson_options.txt. Also symlink m4 to /opt/local/bin/gm4. I had to remove an APPLE check in /src/mesa/main/texcompress_s3tc_tmp.h so it used the GL library instead of the macOS OpenGL one. Also, be sure to specify a minimum iOS version so thread-local support works with something like -miphoneos-version-min=11.2.
xbitmaps1.1.2
iceauth1.0.8
luit1.1.1Run sed -i -e "/D_XOPEN/s/5/6/" configure
mkfontdir1.0.7
mkfontscale1.2.1
sessreg1.1.2
setxkbmap1.3.2
smproxy1.0.6
x11perf1.6.1
xcursorgen1.0.7
xdpyinfo1.3.2
xev1.2.3
xhost1.0.8
xinput1.6.3
xkbcomp1.4.2
xkbevd1.1.4
xkbutils1.0.4
xkill1.0.5
xlsatoms1.1.3
xlsclients1.1.4
xmessage1.0.5
xmodmap1.0.10
xpr1.0.5
xprop1.2.4
xrandr1.5.1
xrdb1.2.0
xrefresh1.0.6
xset1.2.4
xsetroot1.1.2
xvinfo1.1.4
xwd1.0.7
xwininfo1.1.5
xwud1.0.5
startup-notifcation.12
xterm351
FLTK1.3.5 ⚠️Need to remove some -U__APPLE__ calls. Disable tests in Makefile.
tigervnc1.10.1 ⚠️No vncviewer. Disable it via CMake. Remove the if(NOT APPLE) check above the add_subdirectory(unix). Also remove the find_package(FLTK) check and remove the line add_subdirectory(tests) (as some tests require FLTK). It's important to build tigervnc before building Xvnc.
Xvnc1.10.1 ⚠️Add a fake Xplugin.h to fool /unix/xserver/miext/rootless. Modify rootlessWindow.c to check for "Xplugin.h" instead of <Xplugin.h>. Also, remove the -z, now characters from /unix/xserver/hw/vnc/Makefile.in, where it's assigning libvnc_la_LDFLAGS.
Glib2.62.4 ⚠️Disable cocoa and carbon support in build.meson. Had to fake crt_externs.h. Remove the if host_system == 'darwin' check in glib/meson.build.
LuaJIT2.1.0https://github.com/rweichler/luajit-ios
OpenJPG2.3.1
poppler0.84.0
check0.11.0
pangoworking on it
EFL1.23.3working on it
comptongit v0.1 beta g316eac0
FOX toolkit1.7.67Contains Adie (text editor), a calculator, and Shutterbug (screenshots)
azpainter4bf18c8

*This post was originally written on the old maxleiter.com, and formatting has slightly adjusted


Thanks for reading! If you want to see future content, you can follow me on Twitter or subscribe to my RSS feed.