LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   When compiling from source... (https://www.linuxquestions.org/questions/linux-newbie-8/when-compiling-from-source-196696/)

subaruwrx 06-23-2004 02:55 AM

When compiling from source...
 
How do I know which directories the program install the files to? By checking the Makefile?

druuna 06-23-2004 03:45 AM

In general:

1) An INSTALL and/or README file is included. Especially the INSTALL file is important, contains a lot of interesting stuff.

2) run ./configure --help

Gives you all the options and shows the default settings.
For directory and file placement look for: --prefix=, this option can be used to manipulate the place the program will be installed. It also has a default, which should be shown when running ./configure --help.

Hope this helps.

subaruwrx 06-23-2004 04:09 AM

Quote:

Originally posted by druuna
In general:

1) An INSTALL and/or README file is included. Especially the INSTALL file is important, contains a lot of interesting stuff.

2) run ./configure --help

Gives you all the options and shows the default settings.
For directory and file placement look for: --prefix=, this option can be used to manipulate the place the program will be installed. It also has a default, which should be shown when running ./configure --help.

Hope this helps.

So the INSTALL file will contain the directories the files will be installed to?

Also, will the uninstall instruction be included in the INSTALL/README file as well?

druuna 06-23-2004 04:25 AM

The INSTALL file will mention, most of the time, what the default install location will be. This is 'just' a textfile with information for you and is _not_ used during the actual configure/make/make check/make install process.

If you want to change the default install location you need to tell configure. Using the --prefix=<dir> will accomplish this. I.e:

./configure --prefix=/usr/local

Will force the target location to /usr/local/<name-prog>

After you run ./configure (with or without extra options) a newly created Makefile is present, which holds the parameters/settings that make (make install) needs. Path settings can be found in this file too. If at all possible, do not edit the Makefile file but give the options to ./configure and let configure generate the Makefile.

Not all (source)packages have an uninstall option. If they do it will be mentioned in either the INSTALL and/or README file. Most uninstall options do not check if other programs depend on the one you are about to uninstall.

subaruwrx 06-23-2004 04:29 AM

Quote:

Originally posted by druuna
The INSTALL file will mention, most of the time, what the default install location will be. This is 'just' a textfile with information for you and is _not_ used during the actual configure/make/make check/make install process.

If you want to change the default install location you need to tell configure. Using the --prefix=<dir> will accomplish this. I.e:

./configure --prefix=/usr/local

Will force the target location to /usr/local/<name-prog>

After you run ./configure (with or without extra options) a newly created Makefile is present, which holds the parameters/settings that make (make install) needs. Path settings can be found in this file too. If at all possible, do not edit the Makefile file but give the options to ./configure and let configure generate the Makefile.

Not all (source)packages have an uninstall option. If they do it will be mentioned in either the INSTALL and/or README file. Most uninstall options do not check if other programs depend on the one you are about to uninstall.

So if a source package do not have a uninstall option. How do we uninstall the program?

druuna 06-23-2004 04:51 AM

It's not always possible to remove all the files that belong to one package.........
Just blindly removing all the files that were created during install might be dangerous. Other packages (installed later) might depend on them.

You need to know where the files are placed. Sometimes a seperate directory structure is present for the package, deleting this directory (and all its subdirs) will do the trick.

But, some packages also put files in /etc (global configuration), ~/.<package> (local configuration), /lib etc etc.

Especially when libraries are installed you need to check (remember) if any packages installed afterwards need these. If this is the case it is sometimes sufficiant to leave the libs and remove the rest.

subaruwrx 06-23-2004 06:43 AM

Quote:

Originally posted by druuna
It's not always possible to remove all the files that belong to one package.........
Just blindly removing all the files that were created during install might be dangerous. Other packages (installed later) might depend on them.

How about when the 1st time I installed it, but seems to have problem, I deleted the directory. Then I reinstall the same program again. Will it be installed nicely?

Cause currently, I think I have messed up my wine and samba. Thought of just deleting the directory, then reinstall it back again. Will the new install overwrite the previous one nicely?

The problem for samba is after I compile from source and installed, I typed samba at terminal, it say command not found. So I guessed I might not have installed it correctly.

druuna 06-23-2004 07:04 AM

If it's a first time install you could do that.

Most problems arrise during the compile and/or make step. As long as you solve these before you run the 'make install' step there should be little to no need to reinstall (yes I know, sometimes you have to).

You might already know the following (simplefied) info, it's here just to make sure:

1) ./configure => create Makefile
2) make => compile
3) make check / make test => check if everything is well (optional, not always possible)

The above 3 steps take place in the sourcedir. No files are placed outside this dir (there are a few exceptions. But those exceptions create a seperate 'build' directory).

4) make install => place copiled files in appropriate location(s)

subaruwrx 06-23-2004 07:54 AM

I kept hearing people saying installing from source better because you can configure what you want and don't want.

My question is, what, how and when exactly are we going to configure?

Thanks.

druuna 06-23-2004 08:59 AM

These are the steps that I usually take:

1) tar xf dummy-1.0.tar (or bunzip2/gunzip etc)

2) cd dummy-1.0

3) Read the README file (and/or README.linux)

4) Read the INSTALL file

5) ./configure --help => Show all the options, write down(remember) the options you want to enable/disable (if any).

6) ./configure (--option1 --option2) => This step will create the Makefile. Check to see if anything went wrong/couldn't be found/wrong version etc. If so:
Fix problem, retry (yeah, I know that's a bit short. Too many different things could go wrong to give a short fix-compile-problem howto).

NOTE: If it takes a few tries to make the ./configure --option step work, be sure to run a 'fresh' /configure --option before you do the next (make) step. If you ran a few ./configure's with different settings, there's a chance that there are 'leftovers' from previous options hanging around. You want to make sure that your sourcetree is clean. There are a few ways to do this.

I like to be (too?) save and completely remove the sourcetree, re-unpack and run ./configure --option.

Running make clean is supposed to do a cleanup too.

7) make

8) make check (or make test) => not always available.

9) make install

Done.

Steps 3,4,5 and 6 are related to configuring. Steps 3,4 and 5 can give you info about what is possible (and what is not). Step 6 does the actual configuring (creates a file with all the options: Makefile).

It is not always necessary to supply options: A bare ./configure might be enough for the average needs. Good sources 'autodetect' a lot of the options. You can always run ./configure and check the output to see if all that you want/need is autodetected and also check to see if all dependencies are met. I often do (between steps 5 and 6).

The above answers the 'how' and 'when' questions.

The 'what' questions is kinda personal.
An understanding of what is installed on your system, what hardware is present etc makes the 'what' step a lot easier. For example: Why enable xinerama if you do have a capable graphics card (probably autodetected) but no second monitor (assumed, not detected).

I always check these and change them to my liking:
--prefix=PREFIX (--prefix=/usr/local)
--mandir=DIR (--mandir=/usr/share/man)

Hope this clears things up a bit.

subaruwrx 06-23-2004 09:17 AM

Thanks for the detail. :)

I suppose /use/share/man stores the man pages which are also available to the all the users right?

druuna 06-23-2004 09:21 AM

Yep. Manpages are sometimes placed in a subdir of the program installed. I like them in the 'default' location where 'all' manpages are.


All times are GMT -5. The time now is 06:40 PM.