Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Looking for a good resource on how to compile software in Linux

Options
  • 05-12-2013 5:21pm
    #1
    Registered Users Posts: 37


    Hi, are there any good resources that goes into detail on how to compile software under Linux? There are a few projects that I follow and try to help out with testing, etc, so this is my reason for wanting to learn more. I already compile some programmes but I would like to understand it all a bit better. There's waf, cmake, etc. I want to understand the differences and how to deal with compile errors. This is the biggest problem for me and my reason for asking. If i come across a compile error, due to my current knowledge, i probably give up :P So i'd like to understand the process a bit better and how to deal with any issues along the way. Are there any good resources that would cover that?

    Also, understanding arguements and reasons for installing in different locations than the default, etc are something that i'm curious to understand aswell.


Comments

  • Moderators, Technology & Internet Moderators Posts: 37,485 Mod ✭✭✭✭Khannie


    If you're giving up because of compile errors, you're in the early days of your Linux development experience. :)

    I'm not aware of any good resources because each of these errors will typically be caused by something new. The first thing I would do though, is check that I have the correct development libraries installed that are required to build the tool you want. For example if you get an error along the lines of "can't find blah.h" then google blah.h, find out what it belongs to from the list of requirements of the project and install the blah-dev package from your package manager.

    Others will be along to help you shortly.


  • Registered Users Posts: 37 Walnutcracker


    Khannie wrote: »
    If you're giving up because of compile errors, you're in the early days of your Linux development experience. :)

    I'm not aware of any good resources because each of these errors will typically be caused by something new. The first thing I would do though, is check that I have the correct development libraries installed that are required to build the tool you want. For example if you get an error along the lines of "can't find blah.h" then google blah.h, find out what it belongs to from the list of requirements of the project and install the blah-dev package from your package manager.

    Others will be along to help you shortly.

    Thanks, i'm not referring to library errors. I can compile software, compile updated libraries if required, etc. If anything in that process doesn't go to plan, then i'm stuck. I do often google these errors, and sometimes get past them, but i don't really get a proper understanding of things that way. I would like to learn more so that when i see these errors, i can have a better idea of what's going wrong. I don't want to just be doing it, i want to understand it aswell :)


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    Hi, are there any good resources that goes into detail on how to compile software under Linux? There are a few projects that I follow and try to help out with testing, etc, so this is my reason for wanting to learn more. I already compile some programmes but I would like to understand it all a bit better. There's waf, cmake, etc. I want to understand the differences and how to deal with compile errors. This is the biggest problem for me and my reason for asking. If i come across a compile error, due to my current knowledge, i probably give up :P So i'd like to understand the process a bit better and how to deal with any issues along the way. Are there any good resources that would cover that?

    Also, understanding arguements and reasons for installing in different locations than the default, etc are something that i'm curious to understand aswell.

    A long time ago someone told me that Unix was written in C, and the cryptic error messages it puts out are usually C-based errors, so to understand them, you need to know C.

    It was good advice.

    Nowadays, Linux is not just C. There is C++ and other languages as well. To learn about the compiling bit, learn the languages. You don't need to become a guru, just write some programs and compile them and debug them when they dont work, which they won't the first time.


  • Registered Users Posts: 4,972 ✭✭✭opus


    Khannie wrote: »
    If you're giving up because of compile errors, you're in the early days of your Linux development experience. :)

    I'm not aware of any good resources because each of these errors will typically be caused by something new. The first thing I would do though, is check that I have the correct development libraries installed that are required to build the tool you want. For example if you get an error along the lines of "can't find blah.h" then google blah.h, find out what it belongs to from the list of requirements of the project and install the blah-dev package from your package manager.

    Others will be along to help you shortly.

    Exactly all of the above as well for me. Don't program myself but often have these compile problems dropped in my lap :) Luckily we've some commercial compilers in-house (PGI & Intel) so I can actually get some support when totally stuck.

    No magic bullet I can offer unfortunately.


  • Registered Users Posts: 37 Walnutcracker


    I'd like to add 2 questions to this. Where does software install to by default? And what reasons would you have for changing this location?

    Also, i have seen some guides that include compile flags. How do you know which flags are available and what options there are?


  • Advertisement
  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    I'd like to add 2 questions to this. Where does software install to by default? And what reasons would you have for changing this location?

    Also, i have seen some guides that include compile flags. How do you know which flags are available and what options there are?

    the location can vary quite a bit depending on distribution. A quick way to see where your stuff is getting installed is by running the which command. So if you recently installed firefox, run which firefox and it will print the path to firefox.

    I let my package manager install stuff where ever it wants and anything I have to install manually, i stick it into /opt.


  • Registered Users Posts: 37 Walnutcracker


    syklops wrote: »
    the location can vary quite a bit depending on distribution. A quick way to see where your stuff is getting installed is by running the which command. So if you recently installed firefox, run which firefox and it will print the path to firefox.

    I let my package manager install stuff where ever it wants and anything I have to install manually, i stick it into /opt.

    Thank you for the which tip. If i install a package via the package manager and then compile the same software, are they installed to different paths by default? I suppose this depends on the distro but i'm just curious. I understand it's best practice to uninstall a package before compiling your own version but i have a few programmes that i have both versions of and i'm wondering how this works.


  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    Many, many years ago, I got my hands on a Solaris server on which I wanted to put Apache, PHP and MySQL. The binaries for these were not available for Solaris at that time, so I had to compile them all from scratch.

    The basic process was step through each error, one at a time. 99.99% of the time, errors were caused by missing libraries, or the incorrect version (older) of libraries.

    To get the three compiled (which I did, eventually), it was a matter of reading and understanding the errors, finding the libraries, installing them with the package manger and recompiling + moving on to the next error.


  • Registered Users Posts: 1,109 ✭✭✭Skrynesaver


    Thank you for the which tip. If i install a package via the package manager and then compile the same software, are they installed to different paths by default? I suppose this depends on the distro but i'm just curious. I understand it's best practice to uninstall a package before compiling your own version but i have a few programmes that i have both versions of and i'm wondering how this works.

    A well behaved source installation will install to /usr/local/ or /opt whereas the release version should be in /usr/...

    There's even a standard for it, the Filesystem Hierarchy Standard, you should definitely read up on this as a way of understanding where things are/should be on the platform.


  • Registered Users Posts: 1,931 ✭✭✭PrzemoF


    I'd like to add 2 questions to this. Where does software install to by default? And what reasons would you have for changing this location?

    Also, i have seen some guides that include compile flags. How do you know which flags are available and what options there are?

    Software is installed all over the system. Part might land in /etc, part in /bin/ part in /lib and so on. However there is a logic behind it. Some info here:
    https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

    Compile flags: if the software you're working on is using autotools just type "./configure --help"


  • Advertisement
  • Registered Users Posts: 37 Walnutcracker


    Skrynesaver and PrzemoF, thank you, this is just the type of info i'm looking for :)


Advertisement