LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-07-2006, 11:12 AM   #1
Saith
LQ Newbie
 
Registered: Jun 2005
Location: Woodbridge, VA, USA
Distribution: Slackware 11.0 on one box, Xandros Deluxe 3.0/Windows XP dual boot on the other
Posts: 21

Rep: Reputation: 15
A question about compiling


I know when you compile a program on linux you are supposed to use the following magical formula:

./configure
make
make install

But can someone point me somewhere that describes what this actually does? As in, does this install the program to the directory that you unpacked the files to? Or does it put files elsewhere on your system? Does it matter where you install a package at all? Basically I just need to understand what's going on a little better.
 
Old 11-07-2006, 11:26 AM   #2
Cyber_Paladin
LQ Newbie
 
Registered: Mar 2006
Location: Hong Kong
Distribution: Debian
Posts: 24

Rep: Reputation: 15
Never been writing C / C++ codes heh ?

When it comes to C or C++ I dare not even say I'm knowledgable cuz there's always those C wizards out there .

Well, back to the point. In general:

./configure:
It is actually a script with looks for things in your system that is related to the program. Then it somehow modifies the C codes and makefiles to cater for your system such as the library paths or enable/disable certain features.

make:
Runs thru the makefile to compile all the C codes into object codes in a sensible order.
Then it links them together to form the desired executable.

make install:
Runs thru the makefile again, but this time its for "installing" the compiled binaries into your system.
Basically it means copying all the binary codes into the right folder.

Hope this helps
 
Old 11-07-2006, 12:42 PM   #3
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
Regarding make install, the default install location is usually /usr/local. Thus, binaries would go in /usr/local/bin, libraries in /usr/local/lib etc. See the FHS for a full explanation of the directory structure.

The problem with a simple make install, is that you don't, generally, know exactly what files have been put on the system, and it is often different to remove them later. It's better to create a package that you can install via package management. Slackware includes checkinstall which can create tgz packages for Slack, and also rpms and deb packages.
 
Old 11-07-2006, 10:51 PM   #4
Saith
LQ Newbie
 
Registered: Jun 2005
Location: Woodbridge, VA, USA
Distribution: Slackware 11.0 on one box, Xandros Deluxe 3.0/Windows XP dual boot on the other
Posts: 21

Original Poster
Rep: Reputation: 15
So it doesn't matter where you compile, it will always put things where it wants to put them?
 
Old 11-07-2006, 11:30 PM   #5
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Use make -n install to know where the files are going to be copied. Depending on the program's makefile, the program can be uninstalled by typing make uninstall although you will have to store the program source code until you are ready to uninstall it.

If you are compiling libraries, you have to run ldconfig to rescan the libraries so the library cache can be updated.

Really, you do not need to run make install. Most people just run the program where they compiled from.

The files you have to worry about are the .pc files. These files are called when ./configure is run. The search path for these files is designated by PKG_CONFIG_PATH environment variable.
 
Old 11-08-2006, 10:40 PM   #6
Saith
LQ Newbie
 
Registered: Jun 2005
Location: Woodbridge, VA, USA
Distribution: Slackware 11.0 on one box, Xandros Deluxe 3.0/Windows XP dual boot on the other
Posts: 21

Original Poster
Rep: Reputation: 15
So you install the library, then run ldconfig -l <library path/name> and it will work?
 
Old 11-09-2006, 04:53 AM   #7
Severus
LQ Newbie
 
Registered: Nov 2006
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by Saith
So it doesn't matter where you compile, it will always put things where it wants to put them?
You can usually change the base directory by adding an option to the configure script.
 
Old 11-09-2006, 02:30 PM   #8
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
I should of said just run ldconfig and not add any additional options. The file that it looks for is /etc/ld.so.conf. This lists directories where the utility will scan through and try to link the libraries to be cached. The utility ldconfig have to run after a library is installed or else programs that require it will not compile or will not contain a certain feature that you want.

For an example, if you compile and install ALSA, you have to run ldconfig after you compile and install its libraries in order for the utilities to work after they have been installed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling Question dudeman41465 Linux - Software 2 09-21-2006 08:44 AM
compiling question phil81 Linux - Software 5 06-02-2004 08:46 AM
g++ Compiling Question ErikJohnson Linux - General 9 04-01-2004 07:48 AM
Compiling Question fotoguy Linux - Software 0 05-24-2003 04:41 AM
Compiling Question Bigun Linux - Software 2 01-03-2003 03:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration