Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For a university project I want to test a C++11 program on a 32-core machine. Unfortunately the machine has Ubuntu 12.04 with GCC 4.6 installed (we need GCC 4.7 because of some C++11 threading features). In such an environment I would normally run a chroot with a custom linux (say a debootstrap with Ubuntu 12.10). Since we don't get root access on the machine we can't use chroot.

So far I have prepared a run-time environment using debootstrap for our code, I compiled it in the debootstrap environemnt. Then copied it onto the server (using rsync). In order to run our C++ code I set the LD_LIBRARY_PATH to

export LD_LIBRARY_PATH=~/debootstrap/usr/lib/:~/debootstrap/lib64/:~/debootstrap/usr/lib/x86_64-linux-gnu/:~/debootstrap/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH

and so far our code seems to run. I'm however stuck with our python code. It doesn't seem to be sufficient to set the paths manually.

export PYTHONPATH=~/debootstrap/usr/lib/python2.7/dist-packages:~/debootstrap/usr/lib/python2.7:~/debootstrap/usr/lib/python2.7/plat-linux2:~/debootstrap/usr/lib/python2.7/lib-tk:~/debootstrap/usr/lib/python2.7/lib-dynload:~/debootstrap/usr/local/lib/python2.7/dist-packages:~/debootstrap/usr/lib/pymodules/python2.7:~/debootstrap/usr/lib/python2.7/dist-packages/PIL:~/debootstrap/usr/lib/python2.7/dist-packages/gtk-2.0:~/debootstrap/usr/lib/python2.7

Executing our script results in

ImportError: No module named _path

Is there an easier way to accomplish a "fake"-chroot than just overriding and creating environment variables?

Note I need python since we created a custom C++-Python module in order to run our tests. Maybe I should create two questions from this.

share|improve this question
What about downloading the newer version of gcc (or the source) and installing it as a use in your home directory (if you have one)? Well, how big is this program? – Nick Dec 10 '12 at 22:01
Did you also try to set PYTHONHOME? – Cedric Dec 10 '12 at 22:18
What's the standard location for PYTHONHOME? Is it /usr/lib/python2.7? – Pascal Dec 10 '12 at 22:27
Nick: it's easier to create a sandboxed environment because replacing gcc requires also the replacement of glibc (or a recompilation) which then also has very broad side effects. – Pascal Dec 10 '12 at 22:35
Have you tried fakeroot or fakeroot-ng? You might be able to coerce a chroot under fakeroot-ng... – allquixotic Dec 10 '12 at 22:51

Your Answer


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

Browse other questions tagged or ask your own question.