LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   The most newbie question (https://www.linuxquestions.org/questions/slackware-14/the-most-newbie-question-537228/)

Linux_n00b_57 03-13-2007 06:58 PM

The most newbie question
 
Ok, I've looked around to try and find the answer first, nothing.
So this may be the easiest question to answer or maybe not, but i have determined that is important enough for me to ask.
How do you do basic compiling? For example, i've downloaded an emulator, or maybe just a random program, but I can't compile it because I don't know how.
Sooooo if you could answer it for me, or maybe point me in the right direction, i would be most greatful :)

erklaerbaer 03-13-2007 07:02 PM

you will have to untar the package, usually run configure(after reading README and INSTALL) and then make; make install.

do you know linuxpackages.net ?
...
man tar
man gcc
man make
more /usr/doc/Linux-HOWTOs/*

EDIT: man man

the-yikes 03-13-2007 07:16 PM

It can be a mine field
 
Hi Linux_n00b_57, nice to meet you and it's a pleasure to see someone other then myself willing to ask a question, thats the thing i find about linuxquestions, no body here has to ask questions they all seem to be programmed at birth with the answeres (wish i was them)

Anyway in response, if you have downloaded a package off the net they quite often end with a different identifier ie windows would be .exe, redhat would be .rpm and so on and so on. Slackware precompiled packages ten to end with .tgz where as source packages often end with .tar.gz

Assuming now you have a source package (.tar.gz) you will have to unpack it first so place it in a folder of your choosing and open a konsole and (in my experience) using the cd command change into the directory your package is stored in.

Now type in tar -zxvf yourfilename.tar.gz

once youve done this type in

./configure

now type in

make

and finally type in

makeinstall

If your downloaded package ends with .tgz then simply open a console and again using the cd command change to the directory your package is in and type in the following

installpkg yourpackagename.tgz


and press enter.

I may be slightly wrong as i tend to follow erklaerbaer's advice and download the pre built package from www.linuxpackages.net or packages.slackware.it is also a viable option


Let us know how you get on.

Linux_n00b_57 03-13-2007 07:28 PM

It's a .tar.bz2

erklaerbaer 03-13-2007 07:38 PM

don't want to be arrogant, but...
Read The Fine Manual

Linux_n00b_57 03-13-2007 07:39 PM

Where is it? because I can't find it.

Linux_n00b_57 03-13-2007 07:49 PM

nvm i found it, thank you, sorry for being difficult

GrapefruiTgirl 03-13-2007 08:46 PM

Hiya ;), not sure which manual you've found, but there's the 'man' manual, the 'info' manual, and the docs, which are in that order (for me anyways) the places to look in your own computer (as opposed to on the internet) for information about anything.
So in a console, 'man tar' or 'info tar' will return whatever MANual pages there might be for the tar command.
The docs that come with Slackware (I think) are located in /var/doc or /var/docs but there may be other locations for stuff too.
If you happen to be using a desktop environment, it is quite easy if you have ARK or a similar archive program available. Then you can just navigate to the bz2 or zip file or whatever it is, right click it, and select 'Extract Here...'. Most times it will extract into a new folder of its own, where you would then go into, and then follow The-Yikes' instructions above from in a terminal/console window.

H_TeXMeX_H 03-13-2007 10:27 PM

Remember to read the README and INSTALL and compile if they exist.

Usually it's just "./configure; make; make install"

J.W. 03-13-2007 10:53 PM

To try to summarize, compiling the source is often a 5 step dance
Code:

tar zxvf <package>
cd <directory that was created by untarring>
./configure
make
make install


hottdogg 03-13-2007 11:59 PM

if it's a tar.bz2 package.
you can do tar -xjvf <package name>. And...
Quote:

Remember to read the README and INSTALL and compile if they exist.
this is so true.

bioe007 03-14-2007 01:53 AM

am I the only one who adds the step:

su

before make install?

I thought everything was to be compiled as user, and install as root?

mattydee 03-14-2007 03:00 AM

Quote:

Originally Posted by bioe007
am I the only one who adds the step:

su

before make install?

I thought everything was to be compiled as user, and install as root?

Are you being sarcastic? I can't tell... anyways, yes you are correct. Most programs will have to be installed as root.

I would also recommend using Checkinstall (in the extras folder). It makes package maintenance sooooooo much easier:

Code:

./configure
make
su
checkinstall  (this makes a tgz binary for you)
installpkg whatever.tgz


GrapefruiTgirl 03-14-2007 07:55 AM

LOL :D forgot the su part.. Though to be truthful:
A) I often try as a user first to see what happens, and
B) most of the time, I open my console from an already-su'd konqueror, because I need su-konqueror to move the package into its resting place, so the console winds up su too :)

onebuck 03-14-2007 09:06 AM

Quote:

Originally Posted by GrapefruiTgirl
LOL :D forgot the su part.. Though to be truthful:
A) I often try as a user first to see what happens, and
B) most of the time, I open my console from an already-su'd konqueror, because I need su-konqueror to move the package into its resting place, so the console winds up su too :)

Hi,

To expand on the 'su'. If the package/program is system wide then the 'su' would be used. If the install package/program is user specific then the user can install in his/her environment.

gnashley 03-14-2007 09:26 AM

I've written a tool which makes compiling and packaging a real breeze most of the time.

http://distro.ibiblio.org/pub/linux/...1.0-i486-1.tgz

Login as root, install the above package.
Then just type `src2pkg tarballname`. Can't get much easier than that. If it turns out that you need to pass extra options to configure you can do that and much more by using the src2pkg options.

GrapefruiTgirl 03-14-2007 11:21 AM

Thanks for that, Gnashley :) I will be checkng into it shortly. Already downloaded it, and it looks very handy; nice work!

bioe007 03-14-2007 04:53 PM

Quote:

Originally Posted by mattydee
Are you being sarcastic? I can't tell... anyways, yes you are correct. Most programs will have to be installed as root.

well, I wasn't but if it gets a laugh out of anyone - then i was :D

the clarification by onebuck is really what I was looking to elicit. + sometimes when I am trying to compile on my own and working in different terminal windows I'll accidentally ./configure as root, which forces me to make as root, etc

if it wasn't necessary to 'su' to make install then I'd be aggravating myself for no reason.

I too liberally apply checkinstall.

? how do you tell if its a user package? also does it still go to /var/log/packages? can someone point me to the 'M' in rtfm about this?

(and no, that wasn't sarcasm ;D )

@gnashley- yes thanks for the tool. I am d/ling it now.

another ? should I feel kind of lame for relying on all these package tools to install stuff? I use whatever I can find at linuxpackages, slackbuilds and the CD extras of course. But should I endeavor to learn the intricacies of this stuff myself? Whats the benefit (besides satisfying my abnormal geek curiosity)?

adriv 03-14-2007 05:06 PM

Even more simple:
Rightclick the tar.* --> Extract --> click on the new folder --> press F4 --> ./configure --> make --> (as root) checkinstall --> installpkg. ;)
Of course always read the README and/or INSTALL in advance.

src2pkg is also a fine tool (maybe even more handy).
Lets you install .deb and .rpm files as well!

gnashley 03-15-2007 03:03 AM

"how do you tell if its a user package?" Do you mean if it should be installed to /usr? If so, i think that nearly anything you package for use with installpkg should be installed to /usr (except for stuff like KDE or anything that *needs* to be installed to another prefix. If you are compiling and installing with 'make install', then the program shouild go to prefix /usr/local.

Learning the ins and outs of compiling is fun and can also be quite challenging. I've spent the last two years working on src2pkg and teaching it what I learn. It can now compile, on it's own, many programs that I couldn't compile even manually two years ago. Having a look through the src2pkg the configure_source function may provide some tips for configuring difficult sources. For instance, a few months ago I discovered the 'nearly magic' command 'autoreconf -if' which will update all the config files and stop *lots* of errors. src2pkg uses autoreconf when it finds autoconf sources without an executable configure script -like CVS sources.

Most sources can be configured and compiled as user and then installed as root, but there are programs which must be compiled as root in order to work correctly -there are others which must be compiled as user, but this is less common. When this is the case, you can still use the src2pkg tools by untarring and compiling as user, then su to root and make the package using trackinstall instead of src2pkg.
src2pkg and trackinstall can also write the script for you, if you need or want to keep a record the build for repeatability.


All times are GMT -5. The time now is 06:58 AM.