Search code examples
gccdebianapt-getdeb

How to build gcc-4.9/libgcc1_4.9.2-10_amd64.deb


I am in need to build gcc-4.9/libgcc1_4.9.2-10_amd64.deb locally so that I can copy this deb file to another host for installation.

I am aware that we can build .deb & install file using below steps:

# apt-get source gcc version 4.9
# dpkg-checkbuilddeps
# apt-get install <for all packages listed in above command>
# dpkg-buildpackage -uc -us
# dpkg -i <package.deb>

Please confirm on step and let me know how can I download gcc-4.9/libgcc1_4.9.2-10_amd64.deb package cource code to build .deb file? But I am getting below error at first step itself:

# apt-get source gcc version 4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'gcc-defaults' as source package instead of 'gcc'
NOTICE: 'gcc-defaults' packaging is maintained in the 'Svn' version control system at:
svn://svn.debian.org/svn/gcccvs/branches/sid/gcc-defaults
E: Unable to find a source package for version

Solution

  • Install required package :

    sudo apt-get install build-essential fakeroot devscripts
    

    configure apt

    Open your /etc/apt/sources.list ,Uncomment the lines that start with deb-src

    Add the following line:

    deb-src http://httpredir.debian.org/debian unstable main
    

    NB : If you use stable distribution, getting source from unstable won't affect it.

    Update

    sudo apt-get update
    

    Use the command apt-get source to download the source code :

    apt-get source gcc 
    

    Once the package is downloaded (gcc-defaults-1.136 gcc-defaults_1.136.dsc and gcc-defaults_1.136.tar.gz) , you can check the directory where you are (typing ls), and you'll find that apart from the 3 files that were downloaded you also have a directory, called gcc-defaults-1.136. This is the unpacked source of the Debian package.

    Get the build dependencies

     sudo apt-get build-dep gcc
    

    build the package

       debuild -b -uc -us