View Poll Results: Have you found this information useful

Voters
114. You may not vote on this poll
  • Yes, Very insightful

    66 57.89%
  • No, Confussing as hell

    48 42.11%
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: HOWTO: Compile source code

  1. #1
    Join Date
    Jun 2006
    Location
    Brisbane
    Beans
    1,457
    Distro
    Hardy Heron (Ubuntu Development)

    HOWTO: Compile source code

    Howto Compile Source Code on Ubuntu

    One thing that I have noticed is a lot of new users to Ubuntu have trouble when it comes to compilling source code. Hopefully, after this guide you will see it as the rather simple task that it really is. First thing, make sure that you have the basic compillers, otherwise you won't be able to compile anything. Open up the terminal and type in
    Code:
    sudo aptitude install build-essential
    A few other tools that can come in usefull are automake1.9, libtoolize, subversion, cvs and checkinstall.

    Now we are on to the fun stuff I'll use an example of compilling mplayer (gui) with x264, xvid and ffmpeg support. There are a few ways to download the source and compile it so I will show multiple ways to do each section.

    Part 1 – Compilling XviD
    Firstly, download the source code. There are a few ways to do this.

    1) Using apt
    Code:
    apt-get source xvid
    2)Browsing the website and extracting it
    Code:
    wget http://downloads.xvid.org/downloads/xvidcore-1.1.2.tar.bz2
    tar jxvf xvidcore-1.1.2.tar.bz2
    (note: for a tar.gz archive use tar zxvf <archive>)

    3) Using developer cvs/svn repositories
    Code:
    cvs -d:pserver:anonymous@cvs.xvid.org:/xvid login    #(just type enter)
     cvs -d:pserver:anonymous@cvs.xvid.org:/xvid co xvidcore
    Now make sure that you have all the dependencies needed to compile the code.
    Code:
    sudo apt-get build-dep xvid
    will download everything you need (Make sure that you have the deb-src repo enabled). If you get errors while configureing about a missing library or package, install that package

    Secondly, configure the source code. For cvs it is slightly different (for xvid anyway, normally the readme will give clues). For cvs only run
    Code:
    ./bootstrap.sh
    before ./configure. Now change the directory to where you have extracted the source code to
    Code:
    cd ${xvidcore}/build/generic
    Now the hard part. Picking what options you want to compile the source code with. My recommened way is
    Code:
    ./configure CFLAGS="-march=athlon64 -O2 -pipe -mtune=athlon64” CHOST="x86_64-pc-linux-gnu"  MAKEOPTS="-j2" –prefix=/usr
    This ./configure command will result in optimised code, which should be faster but may make debugging almost impossible. Don't open a new bug report unless if you compile it generically (ie ./configure –prefix=/usr). Here's a list of CFLAGS recommened for different processors. http://gentoo-wiki.com/Safe_Cflags
    For more information on CFLAGS look here http://gcc.gnu.org/onlinedocs/gcc-3....e-Options.html

    Now Compile the source with make
    Code:
    make
    Once that finishes without any errors you will have the program compilled in that directory. You can use it to make sure that it works as expected before installing it. There are a few ways to intall the software. A simple
    Code:
    sudo make install
    will install it as is. Using checkinstall you can make a debian file with
    Code:
    sudo checkinstall -D make install
    sudo dpkg -i <package>.deb
    Also you can make a more generic debian file with
    Code:
    sudo dpkg-buildpackage
    However, it will just compile a generic package without optimisations. Also
    Code:
    sudo apt-get –build source
    will make a generic debian package of the source code. Hopefully there is someone that has found this information useful. Recommendations and constructive cristisms are encouraged.

    TO BE CONTINUED with x264, ffmpeg with enabling features (xvid and x264 support) and mplayer with a gui and codec support.
    Last edited by pay; January 3rd, 2007 at 07:06 AM.

  2. #2
    Join Date
    Jan 2007
    Beans
    84

    Re: HOWTO: Compile source code

    Well I hate to be the one to say this, and I feel like a total jackass, but this isn't helpful at all. Its much too specific.

    It seems like each individual piece of software needs its own configurations at build time. Frankly I need a manual, or a separate piece of software if I'm ever going to figure out how to do this. It would be nice if Linux devs could come up with a standard so that we could skip this compiling crap and start using the damn software.

  3. #3
    Join Date
    Jun 2006
    Location
    Brisbane
    Beans
    1,457
    Distro
    Hardy Heron (Ubuntu Development)

    Re: HOWTO: Compile source code

    Have you tried reading the README that comes with the source code?
    "Total paranoia is just total awareness." - Charles Manson

  4. #4
    Join Date
    Jan 2006
    Location
    Leuven, Belgium
    Beans
    3,414

    Re: HOWTO: Compile source code

    Why a howto? It's as simple as unzip and read the READ_ME and INSTALL files..., all info is in their and if not you should contact the developer.

    And a standard is quite impossible because of the big differences between programs, but that's why there are instructions included in every package.

  5. #5
    Join Date
    Jun 2006
    Location
    Brisbane
    Beans
    1,457
    Distro
    Hardy Heron (Ubuntu Development)

    Re: HOWTO: Compile source code

    The readmes don't have information like where to get the dependencies and they are less specific to Ubuntu. Also, some people look for help here first than elsewhere. And I realise that this is hardly a standard, but I tried to help people that have never compiled anything before to get a general idea of what it is like.
    "Total paranoia is just total awareness." - Charles Manson

  6. #6
    Join Date
    Dec 2006
    Beans
    1,806

    Re: HOWTO: Compile source code

    Quote Originally Posted by pay View Post
    Howto Compile Source Code on Ubuntu

    A few other tools that can come in usefull are automake1.9, libtoolize, subversion, cvs and checkinstall.
    I would recommend that you mention the package is named libtool so that people can find it in the repositories.

  7. #7
    Join Date
    Feb 2007
    Location
    New York
    Beans
    894
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Compile source code

    Quote Originally Posted by pay View Post
    2)Browsing the website and extracting it
    Code:
    wget http://downloads.xvid.org/downloads/xvidcore-1.1.2.tar.bz2
    tar jxvf xvidcore-1.1.2.tar.bz2
    (note: for a tar.gz archive use tar zxvf <archive>)
    You claim that this is "to help people that have never compiled anything before", but if so, it doesn't seem like you put a lot of thought into what those people are familiar with.

    Why do people persist in using the command line for EVERYTHING? This is not helpful at all. A web browser is infinitely more intuitive and familiar than wget. File-roller is much more intuitive than tar, and handles .tar.bz2, .tar.gz, and whatever else, without requiring special command switches for each type.

    Ubuntu is supposed to be a user-friendly OS. Please describe user-friendly tools that people are familiar with and do everything "the Ubuntu way" as much as possible, instead of "the old way".

    Quote Originally Posted by RedSquirrel View Post
    I would recommend that you mention the package is named libtool so that people can find it in the repositories.
    Yes. Another example. I couldn't find this in Synaptic. And you should explain what these tools actually do, instead of just saying "tools that can come in usefull". I know checkinstall creates a package in Synaptic, so that it can more easily be upgraded and uninstalled, but why would you mention subversion in a tutorial like this?

  8. #8
    Join Date
    Jun 2007
    Location
    Hungary
    Beans
    515
    Distro
    Ubuntu 9.10 Karmic Koala

    Talking Re: HOWTO: Compile source code

    I just needed this!

    Thanks!
    Last edited by Amazona aestiva; September 8th, 2007 at 06:48 PM.

  9. #9
    Join Date
    Feb 2007
    Location
    New York
    Beans
    894
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Compile source code


  10. #10
    Join Date
    Aug 2007
    Location
    Saint-Petersburg, Russia
    Beans
    147
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: HOWTO: Compile source code

    I have downloaded the newest version of source code and apt-get build-dep says all dependencies are OK (because it checks for the previous version). But ./configure always finds new missing packages and I have to install those packages and then run ./configure from the beginning and wait before it founds a new error. Can I know all missing packages at one time?
    Xubuntu 12.10 on Lenovo T520

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •