Search code examples
linuxdebiancross-compilingchrootbinary-compatibility

How to target Debian stable but develop on testing?


We have some C++ applications which are developed specifically and only for Debian stable (x86).

Currently, development of these application is also done using a Debian stable (x86) system so the developer has all the same library versions as on the target system.
Occasionally, I also need to work on these components and it keeps bugging me that I'm stuck with a very outdated version of KDevelop (4.0.1 vs. the latest 4.4.1). I'd like to use a more up-to-date system for development (like the latest Ubuntu or Debian testing) but how can I create binaries suitable for the target system?
Is there some simple way I can tell the compiler/linker to use the library versions which are available on the target platform only?
I looked at Emdebian and their cross-compiling packages but I don't think this would work for me. They seem to have only packages for targetting other architectures like ARM.


Solution

  • I recommend using schroot.

    $ sudo apt-get install schroot debootstrap
    
    $ sudo debootstrap squeeze /opt/squeeze
    

    Then in /etc/schroot/schroot.conf add and entry like this:

    [squeeze]
    type=directory
    description=Debian squeeze
    directory=/opt/squeeze
    users=myusername
    root-users=myusername
    

    After that you are ready to install packages in the chroot:

    $ schroot -c squeeze -u root
    (squeeze)# aptitude
    

    After you install all the packages you need, you can enter the chroot as a normal user (as long as you are listed in the schroot.conf file):

    $ schroot -c squeeze
    

    The schroot program is also useful for running newer X11 applications on older desktops, and you only need to pass the environment along as well:

    $ schroot -c squeeze -p