Take the 2-minute tour ×

Is there any way to link against RedHat static libraries while building on Ubuntu and using GCC?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Copy over the RedHat library and header files to a directory preserving directory structure and give GCC the --sysroot directive to tell it to look in that directory as prefix for searching libs and headers

share|improve this answer

I see two obvious solutions:

  1. Copy /usr/lib, /lib and /usr/include from a Red Hat system into a subtree and point -I and -L to this subtree.
  2. Install a minimal RedHat into a chroot and compile there.

The first solution is the easiest, but you might run into libc version issues. The second solution is guaranteed to work, but not far from running a complete RedHat for compilation.

share|improve this answer
Using --sysroot instead of -I and -L is much better as it eliminates the risk of "host system leakage" –  gby Dec 7 '11 at 10:23

Your Answer


