Re: Source Code Installation
- From: Spamless <Spamless@xxxxxxx>
- Date: 29 Apr 2006 00:21:41 GMT
On 2006-04-28, Greg <ravioli@xxxxxxxxxx> wrote:
Hi, I'm fairly new to Linux and I was hoping that someone could explain
to me, as one would to a complete layman, how I would go about
installing a program from the source code.
What I do after 'untarring' or 'unzipping' it, and what I need to do in
order to succesfully install the program, and where I will be installing
it. I'm running FC 4 on i386.
First, I assume you have installed the various "development" packages in
Fedora. One can install Fedora as a "workstation" which assumes precompiled
programmes will be installed and which will not have the necessary files for
compiling source code.
I assume the tarball is the usual. Check to see if, inside, there is a
"*.spec" file. If so you can (probably) build an RPM from it and use RPM to
install it and keep track of it.
But in general, assuming you have the necessary programmes and files for
compiling ...
when you untar, you shuld get a source directory. Enter it.
If there is a README or INSTALL file, read it ("less [thefilename]").
Assuming this is a c or c++ programme, there will be an executable
"configure" here (or in a subdirectory) (some programmes don't do
this - for example, cdrecord has a subdirectory of Makefiles one
edits by hand instead of using a configure script).
Run it with the help option and see what you can do:
./configure --help | less
there may be options you want to change (such as the "--prefix"
specifying the part of the diretory tree in which it installs).
Then just
./configure
(or
./configure [with extra options you want to set])
(for perl programmes, one would use "perl Makefile.PL"
instead of "./configure" and for python, "python setup.py build"
- see the INSTALL or README files in case there is something different).
This will create a Makefile in the directory. That is a set of commands
interpreted by "make" which tells it how to compile and install the
programme.
To compile the programme just use:
make
If all is well to install it, as root (su to root) use
make install
(NOTE: You could change the prefix to your home directory
and use ~/bin, ~/lib, etc. and install in your home
directory - the default it to install for system wide
use and the directories in which the files will be
installed require root privileges in order to write to
them.)
Almost surely (unless you changed the location for installation)
the programme will wind up in /usr/local/bin, its man pages
in /usr/loca/man/[somewhere], if it is a library, the library
files in /usr/local/lib and the header files (used by othe programmes
for information on how to use the library) in /usr/local/include and
the *pc files (if any) (package configuration files) in
/usr/local/lib/pkgconfig/.
One thing to watch for. The package configuration script/programme
by default only looks in /usr/lib/pckgconfig/ for configuration files.
You may want to add /usr/local/lib/pkgconfig/ to your environment
variable for the location of such files (I don't but have a script
to clean and set symbolic links in /usr/lib/pckgconfig/ to the
files in /usr/local/lib/pckgconfig/). If this is a library and other
programmes have to find it, its version, etc., they may assume it
uses *pc files. The package configuration script has to be able
to find those files for other programmes to use them.
You may have to run "ldconfig" for shared libraries to be registered
if they are now going to be used (I remember once installing a new
version of curl, trying to run it and getting "cannot file library"!).
It is not always the case that the files will be in the above locations.
The /opt directory is/was supposed to be used for extra programmes
(rather than /usr/local) though very few use it. cdrecord does.
Perl programmes will go into your perl directory tree and python in
your python directory tree (and ruby and forth and rexx ...).
Xprogrammes may go in /usr/X11R6/bin. Gnome or KDE may go elsewhere.
The above is for standrad c or c++ programmes.
/bin, /usr/bin and /usr/local/bin are surely on your "path" so
once installed you can run the programme simply by giving its
name on the command line
myprogramme
(exception: If you use the (t)cshell programme it uses a hash table,
array, pointing to the locations of programmes so it does not have
to search for them each time. You can turn off using the hash table
and have it search each time or first give the command
rehash
to have it reset that table so it can find the programme.
I believe bash also uses a hash table, but if it cannot find the
programme listed in that array, will automatically search for it
rather than simply say that "the programme cannot be found" as
the tcshell will.)
So, the "standard" is:
./configure
make
make install (as root)
if you want the defaults (you can find options
with "./configure --help") with programmes in bin/, libraries
in lib/, header files in include/ all subdirectories of /usr/local/,
Special programmes (for the gnome system, kde, perl, python, etc.)
are treated "specially".
.
- Follow-Ups:
- Re: Source Code Installation
- From: raam
- Re: Source Code Installation
- References:
- Source Code Installation
- From: Greg
- Source Code Installation
- Prev by Date: Source Code Installation
- Next by Date: Re: yum and kernel upgrades
- Previous by thread: Source Code Installation
- Next by thread: Re: Source Code Installation
- Index(es):
Relevant Pages
|