LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-04-2012, 09:58 AM   #1
askjoe
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Rep: Reputation: Disabled
How to learn to compile from source with dependencies and libraries needed?


What is the best way to learn how to compile programs from source with dependencies and libraries? Yes, I know the syntax for running configure/make/make install etc. for basic programs but I'm really trying to up my ability and knowledge. For example, I just recently installed Gimp 2.8 from source on Ubuntu 12.04 following a really great tutorial on how to do so from a popular blog - it worked great and Gimp seems to run without issue. During the course of the installation the tutorial had me install several libraries among other things. It's fuzzy to me how this blogger was able to figure out all of the libraries dependencies that was needed to get Gimp to run....how did he detect those? I want to know how to do this.

I really want to learn how to take control of my machine. If a new program(Gimp or otherwise) comes out I don't want to wait for it to show up in the "software center" or install it via a ppa. Is there a really good tutorial or method on this? I'd like to get to the point to where I install everything from source if possible including the latest version of Gimp from scratch.

(I'm just using Gimp as an example...I'm not really looking for instructions on how to install it in particular)
 
Old 10-04-2012, 10:32 AM   #2
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
I don't think there's a general tutorial that says more than you have just said.

Imo it's up to the developer to include documentation (or some hints at least ... for developers that don't like documentation). For the GIMP, for example, http://www.gimp.org/source/ says
Quote:
All requirements below must be met to be able compiling GIMP from source. This list might change depending on the releases being worked on during development of GIMP. Look at the files INSTALL and README in the tarballs for details.
and then lists a bunch of optional packages.

Some packages will need to be installed in a certain order, but most not: you only need them installed before you run the app. Again, the README or INSTALL or other package files should specify this ... or at least errors during make should give you a clue. Other dependencies would spit out errors at runtime.
 
1 members found this post helpful.
Old 10-04-2012, 11:09 AM   #3
askjoe
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Ok, as obvious as that seems I didn't even think to look there in the README and INSTALL documentation! I think what I'll do is set up a machine identical to current one in Virtualbox and test install apps there before I do it on my main version just in case anything breaks.
 
Old 10-04-2012, 11:14 AM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
For ones that are missing documentation, usually the configure or make commands will error out with a suggestion of what you need to install.
 
Old 10-04-2012, 12:53 PM   #5
askjoe
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
For ones that are missing documentation, usually the configure or make commands will error out with a suggestion of what you need to install.
Isn't that risky though? Couldn't just blindly running make commands and having a program partially install break my system? I've always been hesitant to do this because I thought that was the case.....please correct me if I'm wrong.
 
Old 10-04-2012, 12:59 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Nope

The installation procedure for almost any piece of source code usually follows the same three steps:
./configure <args>
make
make install

the configure script will check for MOST dependencies, and error out if you're missing any. Nothing is altered in your system in any way from the configure script, it just prepares the files in the local directory for make.

The make command will build the software IN PLACE, erroring out if anything fails. Again, nothing is altered in your system from this make call, everything it modifies is in the local directory and that's it.

The make install command is used to copy the files created by make to the necessary places in the system. This is the only part of the process in which your system (outside of the local directory) will be altered, and this step will almost never fail assuming "make" went through fine.

You can run ./configure and make at any time you want. They can go through fine, error out, it doesn't matter, nothing outside of the current directory is altered by either of these steps. This is why you can run these commands as your regular user, you don't need to be root. You only need to be root for the make install, which is only run AFTER make was successful, which means your dependencies have been resolved.

Last edited by suicidaleggroll; 10-04-2012 at 01:04 PM.
 
2 members found this post helpful.
Old 10-04-2012, 01:44 PM   #7
askjoe
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Nope

The installation procedure for almost any piece of source code usually follows the same three steps:
./configure <args>
make
make install

the configure script will check for MOST dependencies, and error out if you're missing any. Nothing is altered in your system in any way from the configure script, it just prepares the files in the local directory for make.

The make command will build the software IN PLACE, erroring out if anything fails. Again, nothing is altered in your system from this make call, everything it modifies is in the local directory and that's it.

The make install command is used to copy the files created by make to the necessary places in the system. This is the only part of the process in which your system (outside of the local directory) will be altered, and this step will almost never fail assuming "make" went through fine.

You can run ./configure and make at any time you want. They can go through fine, error out, it doesn't matter, nothing outside of the current directory is altered by either of these steps. This is why you can run these commands as your regular user, you don't need to be root. You only need to be root for the make install, which is only run AFTER make was successful, which means your dependencies have been resolved.
Thank you so much for that clarification. There's so many tutorials out there but none of them will actually tell you the consequences of what you're doing - especially if you run into problems. Many times.....I've followed a tutorial(not installing apps, but with other things) only to be led astray and ultimately ended up with a broken system.

I appreciate your help.

Last edited by askjoe; 10-04-2012 at 01:46 PM.
 
Old 10-05-2012, 12:56 PM   #8
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,161

Rep: Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223
A couple of extra tips.

1. If "make" fails because something is missing, run "make clean". That will remove all the object files that have been created so far, so that next time it doesn't keep saying that it's done this bit already and should it do it again.

2. Keep the package. Most make-files have an uninstall section, so "make uninstall" will cleanly remove the program for you, saving you from tracing the various bits. Even if it doesn't have this, the install section will at least show you where it put everything.
 
Old 10-05-2012, 04:02 PM   #9
linux_BSD
Member
 
Registered: Sep 2012
Posts: 47

Rep: Reputation: 4
@ askjoe

You already know the fundamentals of compiling from source, but if you really want to know more about compiling from source and resolving those unexpected issues and managing your system try slackware. You will learn a lot about compiling from source with slackware.

There are slackbuild scripts found at http://slackbuilds.org/ for many packages and their dependencies. After more experience you can create your own slackbuild scripts for yourself or share with the slackware community.

Last edited by linux_BSD; 10-05-2012 at 04:05 PM.
 
  


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
Compile from source as limited user - how do I tell configure where dependencies are? versaulis Linux - Software 9 09-15-2009 11:32 AM
How would you know all dependencies needed for source installations? chutsu Linux - General 1 01-16-2009 07:57 PM
Libraries and dependencies 200mg Linux - Newbie 2 12-08-2006 12:12 PM
Using SCONS to make libraries, check for dependencies and compile an executable. Sslaxx Programming 0 03-07-2006 06:57 AM
Libraries and Dependencies mawarsha Linux - General 3 03-03-2003 12:01 AM


All times are GMT -5. The time now is 12:25 PM.

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