4

I am doinng an Operating Systems course where we need to compile a program on Ubuntu 9.10. This program is not running as expected on laterer releases of Ubuntu (such as 12.04)

My question is, how can I compile a C program using the kernel of 9.10 on Ubuntu 12.04 (the newest release)

I've installed an Ubuntu 9.10 partition on my computer so I can use the libraries from there. but, nevertheless, I would like to work from my 12.04 partition.

Maybe this manual could help?

1 Answer 1

4

You'd be best off creating a "chroot" for Ubuntu 9.10, and compiling within that chroot.

There's some detail about this in my answer to Building multiple packages for deployment on different Ubuntu versions, but the basic procedure is:

  • Use mk-sbuild --name=my-karmic-chroot karmic to create a new chroot for Ubuntu 9.10 (the codename for 9.10 is "karmic")
  • Use schroot -c my-karmic-chroot to enter the new chroot, and do your compiling

If you're compiling Ubuntu packages, the sbuild tool can be used to automate this.

Note that this does not use the kernel of 9.10, only the userspace components (including libc and C runtime libraries). You'll still be running the 12.04 kernel. However, do you specifically need the 9.10 kernel?

If you really do need the 9.10 kernel, you can use virt-manager to setup a 9.10 virtual machine on your 12.04 install. You can then log into this like it's a real 9.10 machine.

2
  • but I will like to follow the instructions found in the link Ive shown earlier. even simpler, I can replace the gcc option -nostdinc explained in the link with --sysroot=my_ubuntu_9.10_partition then I hope it would compile with the 9.10 glibc libraries\includes
    – jokop
    Mar 14, 2012 at 9:43
  • You could do that, but a chroot is "cleaner"; for more complex projects, there may be other system dependencies that aren't controlled by gcc's sysroot configuration. eg, stuff that uses pkg-config. Mar 14, 2012 at 9:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .