I've tried to compile https://unix.stackexchange.com/a/228674 under Ubuntu.

Unfortunately ending up with following error:

/tmp/find-cursor$ make
cc find-cursor.c -o find-cursor -lX11
find-cursor.c:19:39: fatal error: X11/extensions/Xcomposite.h: No such file or directory
 #include <X11/extensions/Xcomposite.h>
compilation terminated.
make: *** [all] Error 1

I've tried with following suspects:

$ sudo apt-get install libxtst-dev libxss-dev libxtst6-dbg libxext6-dbg libxss1-dbg

but still no luck in compiling. Here is snippet for your convenience:

sudo apt-get install mercurial
cd /tmp
hg clone https://bitbucket.org/Carpetsmoker/find-cursor
cd find-cursor


FTR: to compile above code I had to : sudo apt-get install libxcomposite-dev libxdamage-dev libxrender-dev and add -std=gnu99 flag to cc in Makefile


Whenever a compile fails with a missing file simply leverage the infrastructure to search for the missing ubuntu package

apt-file search   X11/extensions/Xcomposite.h   #  cmd 1

which returns with

libxcomposite-dev: /usr/include/X11/extensions/Xcomposite.h

so solution is to install that missing package

sudo apt install libxcomposite-dev              #  cmd 2

this technique works across any missing file

On a fresh OS if you issue

apt-file search   X11/extensions/Xcomposite.h  

it will fail with error

The program 'apt-file' is currently not installed. To run 'apt-file' please ask your administrator to install the package 'apt-file'

which just means you need to do a one time setup of the local search cache so just run

sudo apt install apt-file -y
sudo apt-file update

now re-issue the search shown above (cmd 1) then install package (cmd 2)

  • 1
    This is a fantastic answer. I feel unblocked for future issues. – Joe Heyming Sep 22 '18 at 17:03

On http://packages.ubuntu.com/ you can search for packages containing a file.

For X11/extensions/Xcomposite.h that finds libxcomposite-dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.