Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in the process of porting some applications from Maverick 10.10 to Precise 12.04. Some of the system headers do not seem to be in the same place. This is giving me some headaches since it doesn't seem to matter that i add the include paths.

In particular, on Maverick, there was a file in /usr/include/sys/ucontext.h, and this file defines the constant REG_EIP. Now, on Precise, this file has moved to /usr/include/x86_64-linux-gnu/sys/ucontext.h, but g++ 4.6 nor 4.7 have that include path:

`gcc -print-prog-name=cc1plus` -v
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.

the consequence of this is that when including #include <ucontext.h>, REG_EIP is not defined

I've tried adding #include <sys/ucontext.h> but i still get the error:

error: 'REG_EIP' was not declared in this scope

Any idea how to fix this?

share|improve this question

You can create a symbolic link using this on a terminal:

$ sudo ln -s /usr/include/x86_64-linux-gnu/sys/ucontext.h /usr/include/sys/ucontext.h

If /usr/include/sys/ucontext.h already existed, you may want to rename it before:

$ sudo mv /usr/include/sys/ucontext.h /usr/include/sys/ucontext.h.backup

If anything went wrong, you can remove the symlink and restore the backup:

$ sudo rm /usr/include/sys/ucontext.h
$ sudo mv /usr/include/sys.ucontext.h.backup /usr/include/sys/ucontext.h
share|improve this answer
This is such an awfully bad solution, that i would most likely downvote it, if it wasn't for the small fact that it is, with great likelihood, also the best possible solution available, given the known constraints of poor architectural and engineering decisions happening at ubuntu. I wouldn't go as far as upvoting it either. I will leave it sit a while, i will catch my breath tomorrow, or probably the day after, probably kick and punch some stuff at the gym, and after i get my morning coffee, i will accept this answer, unless a better one shows up. Also will ponder on other lines of work. – lurscher Dec 21 '12 at 2:11
and of course, this situation carries on exactly the same to other distros based on Precise and Quantal, such as Linux Mint 13 and 14. – lurscher Dec 21 '12 at 18:54
failure, for some reason this is not working, i've softlinked the whole /usr/include/x86_64-linux-gnu/sys folder to /usr/include/sys, but still getting the same error... no idea what is going on – lurscher Dec 23 '12 at 20:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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