LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MAKE, installing source packages, etc...can someone explain this or at least... (https://www.linuxquestions.org/questions/linux-newbie-8/make-installing-source-packages-etc-can-someone-explain-this-or-at-least-192344/)

squirrels 06-11-2004 10:31 AM

MAKE, installing source packages, etc...can someone explain this or at least...
 
lead me to a link that explains it?

Installing Linux wasn't that hard at all...it's when I started installing stuff on top of Linux that I really started getting lost. It seems like when I download these source packages, there's always a "configure" and a bunch of "make"s going on, but I have no understanding of what's going on behind the scenes.

I know that this is somehow looking at the "Makefile" in the package and compiling the source according to the specs, but I find myself asking questions like, "Did I unzip the .tar into the right directory before installing? Is this supposed to go here? Is MAKE going to put everything where it needs to go or do I need to move/link stuff? How does it know what libraries to search for this/that on my system? etc etc"

Can someone please break the whole open-source and make deal down for me? Or at least direct me to some documentation that describes it in layman's terms? I'm usually pretty quick with stuff like this, I've programmed before and understand the concept, but honestly, websites that package stuff like this usually just have a really simple install guide like:

"Unzip this file into the proper directory." Which is WHAT??
"Run ./configure" Which does what?
"Run make" Huh?? OK
"Run make install" OK uhh...am I 'done'? What now? And what did I just do?

I'm used to the Windows way of run the file, answer "Yes", and watch the scrollbar move. Even DOS programs installed simpler than this. :p But I DO want to learn...I just need a direction to look.

Thanks in advance. :) :study:

verzonnen 06-11-2004 10:48 AM

>"Unzip this file into the proper directory." Which is WHAT??
just create a directory somewhere and cd into that directory for excample
mkdir /tmp/software
cd /tmp/software

Depending on the extension you can "unpack the file"
for .tgz use the command tar -xvzf filename
tar will usualy create a subdirectory so you will have to "cd" into that.

>"Run ./configure" Which does what?
This will optimize the configuration for you particular machine/cpu

>"Run make" Huh?? OK
make will "compile" the prgram(s) for you, this can take a long time even hours..

>"Run make install" OK uhh...am I 'done'? What now? And what did I just do?
make install will install the program(s) for you, only run this if the privious make did complete sucsesfully.

Hope this helps...

320mb 06-11-2004 10:57 AM

you really should have a reference book at hand to help you learn.........

here is a link to Rute User's Tutorial and Exposition
http://www.icon.co.za/~psheer/book/index.html.gz

Nis 06-11-2004 11:04 AM

For Slackware, if you cannot find a package on LinuxPackages then compiling is the way to go. verzonnen laid it out really nicely. The only other things you could add are these:
Code:

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
This is what most official Slack packages use and it keeps everything in a nice order on your filesystem. Not necessary but useful.

Also check out checkinstall. You run checkinstall instead of 'make install' and it will create a Slackware package and install it for you. This makes it easy to remove software later using pkgtool and makes a nice entry in /var/log/packages. checkinstall is in the extras/ directory on the Slackware CD.

penguin4 06-11-2004 12:39 PM

squirrels; oh got depenedant on W, just like me but i,m letting go of all of
windows forever! like the challenge of learning linux and its whole open-source being. even programming and development. squirrels just give it up
come with us and linux.

rustynailz 06-11-2004 12:52 PM

The programming thing is a neat angle - I do a lot of development, and I find that once you understand the different parts of a program and how they're put together (compiling, linking, etc) you get a really good feel for what's going on in each stage.

Another really great reference is the manpages and info. Try "info make" and it'll show you how a makefile works. This is really good to know - sometimes you can edit makefiles to work better (though passing options to configure usually takes care of it nicely).

This is a good link too (for Mandrake, but applies pretty much everywhere):
http://doc.mandrakelinux.com/Mandrak...e-chapter.html

Dark_Helmet 06-11-2004 02:02 PM

Just to expand on verzonnen said...

A source "tarball" is simply the collection of source code used to compile a program (including directory structure). They're typically named with an extension of ".tgz", ".tar.gz", or ".tar.bz2". The "gz" versions of the extensions means that the gzip utility was used to compress the file. The "bz2" means that the bzip2 utility was used for compression. When you unzip/untar the tarball you downloaded, the source code directory structure is created and the appropriate source code files are placed in each subdirectory. You then cd into the directory the tar command created to compile the source code.

The configure script is pretty much exactly what it sounds like. Keep in mind Linux runs on a wide variety of hardware including processors. When you run configure, essentially, the script analyzes your system to detect what is present or missing. There are explicit tests to find what the size of integers are (in bytes) or other computer-architecture-dependent things. That could make a difference on how the code should be compiled. Similarly, the script will test to make sure necessary libraries are installed to support the software you will compile. The configure script will croak if it encounters something it can't adjust for. It simply customizes the way the source code is compiled to make sure it will work with your system.

Running "make" is when you actually compile the software. The configure script modified the "Makefile" that you said you are familiar with. Essentially, a Makefile contains instructions regarding how to compile the software. It specifies the commands to run, the options for those commands, the files to include. Depending on the complexity of the software package, there may be a vast number of things that need compiling. When the make command finishes successfully, then you have a working executable, but it's not in the right place yet; it's not "installed" on the system.

Issuing the "make install" command is what will put the software you compiled into the proper place on your machine. Since a Makefile contains sequences of commands to execute, it can be used for things other than compiling. In this case, it's used to copy the executable, any man pages, libraries, or other files to the appropriate spot.. Once make install completes, the software has been installed on your machine. You should be able to run the new program just like any other.

One last thing to add... The configure script usually accepts a number of optional arguments. These arguments can specify anything from where to put the program when you run "make install" to completely disabling certain features in the source code. Each configure script can be different. So it's imperative to read any INSTALL file that omes with the tarball.

Dobie 06-12-2004 06:08 AM

Thanks Dark_Helmet.
Like squirrels, i'm new to *nix, and must say that I've found your post very informative.

Tanks
Dobie.

Stevetgn 06-12-2004 09:25 AM

Quote:

Originally posted by Dobie
Thanks Dark_Helmet.
Like squirrels, i'm new to *nix, and must say that I've found your post very informative.

Tanks
Dobie.

Me too, cheers! :newbie:

linmix 06-12-2004 12:51 PM

rustynailz : the link you provided is for MDK 9.2 I suppose changes are minimal, but could you supply a link for MDK 10? Thanx in advance

hct224 06-12-2004 06:05 PM

Nice posts.

Now I have a question, how am I going to build a RPM package from source package? I need to do all the above steps and then build RPM or just can build directly RPM package from the source? What command should I use to build RPM package?

:newbie: :Pengy: :scratch:

rustynailz 06-12-2004 08:24 PM

Don't think there's official 10.0 documentation out yet - either that or it's on the CDs.

linmix 06-13-2004 09:35 AM

[B] rustynailz[/]: been reading the Reference Guide and it mentions a Starter Guide. I'm sort of impatient to get going so do you know if there's a link to that one as well

(if it's on the CDs I'll get it eventually, but I've been waiting, like, a whole day (!) and I want more!!!:cool: )

penguin4 06-13-2004 11:49 AM

linmix; slow down impatience broods mistakes! patience is a virtue, practice
it. and you are right evetually you will run across any information either on cd or online even written. so slow down its there. welcome to linux we all
go through anxiousness but get through some how with patience!

rustynailz 06-13-2004 12:21 PM

Yeah, just go to www.mandrakelinux.com and click on the Doc link on the top - it's got a starter guide, a reference, and a command line link (plus you can get PDFs if you want).

Another really good reference is the alt.os.linux.* newsgroups, but be careful about what you post - there are some extremely knowledgeable Linux folks there, but there are also a lot of people who take pleasure in nitpicking. I'd strongly recommend just reading (lurking) for at least a week or two before you post. Make sure you find and read the FAQ for the groups as well - they've got some excellent answers to commonly asked questions, and the etiquette suggestions will avoid you getting flamed right out of the gate.


All times are GMT -5. The time now is 08:07 AM.