[CentOS] Guidance: compile education

Thu Dec 4 23:42:04 UTC 2014
Les Mikesell <lesmikesell at gmail.com>

On Thu, Dec 4, 2014 at 4:16 PM, Stan Cruise <stancruise at me.com> wrote:
> This question may not belong in the Centos.org list, but I do want to
> compile against this distro. Please advise.
>
>
> The question:
>
> Can I be pointed at methods to learn to compile source against a distro. I
> have software development background (but too long ago to be specifically
> useful; however I have the concepts). Typically I can find some fairly
> decent step-by-steps for some apps, but it never works out. Which means I am
> missing the basics.
>
> I have been working with Centos and Fedora through many VM and metal
> installs, so that part is OK. I am getting tired of constantly trying to
> find the app I want in the distro, or an applicable rpm. It's time to
> compile.

The best approach depends very much on the target application and how
you intend to mange it. Most sources will have a generic configure
script and makefile that will build and maybe install in /usr/local.
For a quick test, that might be enough, but you have to note where
things land and clean up after yourself.

Note that 'most' things worth building have already been packaged as
RPMs, so finding them is still going to be your easiest solution.   If
they are for a 'slightly' wrong disto, you can often grab the source
rpm instead of the binary and 'rpmbuild --rebuild ...' to get locally
configured binary rpms.   The somewhat higher level approach to this
is to install the 'mock' package from epel and then 'mock -r
some_version --rebuild  some_src.rpm'.     This will download all of
the required library support and build the binary rpm for some
fedora/centos other than the running system.  There are lots of
variations, but these may get something working without a lot of
specific programming knowledge.

One other thing to know about would be 'software collections' that
have updated versions of applications that can co-exist with the stock
versions.   This might come into play if you run across source that
uses c++11 and you want to compile it on Centos 6 (thus needing a
newer gcc, etc.).


-- 
   Les Mikesell
     lesmikesell at gmail.com