LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Compile from source / Slackware (https://www.linuxquestions.org/questions/linux-newbie-8/compile-from-source-slackware-4175591869/)

Auroch 10-20-2016 07:05 PM

Compile from source / Slackware
 
Hey all,

I want to learn to compile from source. My biggest question at the moment is: "after I download a tarball, where should I use tar to extract the contents to before installing?"

For example, I want to try to install the enlightenment wm/de. I got the source tarballs. Should I extract to where I downloaded, or some other directory? I hate to just extract to my downloads directory since it'll fill it up (visually) with a "million" files. Should I create a new directory somewhere for the EFL libraries, then another for the actual app?

Thanks much.

Auroch

allend 10-20-2016 07:24 PM

Welcome to LQ!

For enlightenment, I suggest you look at this thread in the Slackware forum. http://www.linuxquestions.org/questi...re-4175527047/

More generally, in Slackware, it is suggested that you use a Slackbuild script when compiling from source. This will create a package that can be installed, upgraded and removed using Slackware package management tools. See https://slackbuilds.org/ and http://docs.slackware.com/slackware:slackbuild_scripts for further details.

Auroch 10-20-2016 07:30 PM

Thanks. I'll take a look! I searched all over but couldn't find any direction as to WHERE to extract to.

I appreciate the quick response!

Auroch

frankbell 10-20-2016 07:36 PM

Generally, if you extract using

Code:

tar -xvf [Somefile]
a subdirectory named after that file we be created in whatever directory you are in. The output of the tar command as it scrolls across the screen will list the name of the new directory.

Here's a file and the resulting directory plucked at random from my computer:

Code:

$ ls fbreader*
fbreader.tar.gz
fbreader    <-----the resulting directory (I've omitted the listing of the contents of the fbreader directory)


Auroch 10-20-2016 07:40 PM

I see. And it doesn't matter where you do this from or where this new dir is placed? Thanks!

Auroch

frankbell 10-20-2016 07:45 PM

Yes, that is the normal behavior when you extract a tarball unless you instruct tar to do otherwise.

Auroch 10-20-2016 07:51 PM

Frank,

I understand that is what will happen, but is that proper? After make and make install will all of those source files be left wherever I extracted them to initially? I'm sorry if I'm coming across as dense. I'm OCD and try to keep things "clean".

Auroch

frankbell 10-20-2016 08:09 PM

Say you extract foo.tar.gz to the directory foo.

You enter foo and compile from sources. After you perform the make install, the contents of the directory foo will remain unchanged. If you want later to remove that program, you can enter the foo directory and issue the command make uninstall.

When I started with Slackware, there was no Slackbuilds.org. There were a few independent Slackware repositories about, but not many. Almost everything I installed in those early days was by compiling from sources because I was very much a newb and didn't know any other way.

Don't let it intimidate you; it's really not all that complicated. Writing the code--that's the complicated part!

Also, if a make errors out, the first error message is most likely the one that matters; subsequent ones generally result from it.

Enjoy.

Auroch 10-20-2016 08:24 PM

Thanks man. I gotta hit it, but I'll dig in deep tomorrow and report back with my success story....haha! Much appreciated,

Auroch

grail 10-21-2016 05:31 AM

You could even write your own little script so that it performs the extraction and the necessary steps followed by a tidy up to remove the build directory and leave you with only the original tar file :)

hazel 10-21-2016 05:41 AM

When you build software, you should always do it as yourself, not as root. You use root access only for the final install step. This means that you have to unpack the tarball in a directory to which you yourself have write access. It's up to you just where this, but usually it has to be somewhere in your home directory tree.

I would suggest creating a build subdirectory for your experiments. As frankbell said, a tarball is supposed to create its own top-level directory and unpack all the files into that, but if the tarball was incorrectly packaged by the developer, it could spill its files out into the directory you unpacked it in. That happened to me once. Unpacking in a dedicated subdirectory is safer.

allend 10-21-2016 07:18 AM

Quote:

If you want later to remove that program, you can enter the foo directory and issue the command make uninstall.
The annals of history are filled with examples of that technique failing, due to poorly written makefiles. (What software developer thinks that anybody would want to remove their software?)
Quote:

You could even write your own little script so that it performs the extraction and the necessary steps followed by a tidy up to remove the build directory and leave you with only the original tar file
That _is_ a SlackBuild script, except the build directory is left in /tmp for later inspection.
Quote:

When you build software, you should always do it as yourself, not as root. You use root access only for the final install step. This means that you have to unpack the tarball in a directory to which you yourself have write access. It's up to you just where this, but usually it has to be somewhere in your home directory tree.
A properly written SlackBuild script conducts those operations in the /tmp directory. The build can be conducted as a normal user, but the resulting package is installed as root.

@OP - Slackware is often denigrated for being a build from source distribution, rather than having an official repository for pre-built binary packages (although authoritative repositories are available e.g. http://bear.alienbase.nl/mirrors/ and http://rlworkman.net/pkgs/). It is rare for a Slackware user to not be able to find an appropriate SlackBuild script at https://www.slackbuilds.org/ , the officially endorsed location for the installation of third party software. Those scripts have been through a vetting process to ensure that the builds complete successfully on a full Slackware install and that install/documentation/startup file locations comply with Slackware standards.

BW-userx 10-21-2016 09:47 AM

Quote:

Originally Posted by Auroch (Post 5620787)
Hey all,

I want to learn to compile from source. My biggest question at the moment is: "after I download a tarball, where should I use tar to extract the contents to before installing?"

For example, I want to try to install the enlightenment wm/de. I got the source tarballs. Should I extract to where I downloaded, or some other directory? I hate to just extract to my downloads directory since it'll fill it up (visually) with a "million" files. Should I create a new directory somewhere for the EFL libraries, then another for the actual app?

Thanks much.

Auroch

you're going to try Enlightenment on your first try? oooohhhh You got Big Balls...

I'd select a new directory created just for that. subdivided it into each separately then follow the instructions on what needs to be compiled first. keep everything in one main root directory.

and like @allend said it is best to use SlackBuild scripts for everything you install on Slack (not that you have to, on any linux/gnu actually) but it helps your system keep track of what is installed on it, for easier maintenance.

Auroch 10-21-2016 10:07 AM

Quote:

Originally Posted by BW-userx (Post 5620996)
you're going to try Enlightenment on your first try? oooohhhh You got Big Balls...

I'd select a new directory created just for that. subdivided it into each separately then follow the instructions on what needs to be compiled first. keep everything in one main root directory.

and like @allend said it is best to use SlackBuild scripts for everything you install on Slack (not that you have to, on any linux/gnu actually) but it helps your system keep track of what is installed on it, for easier maintenance.

Haha, I hear ya. I guess it's not so much the size of my nuts, but rather that I'm already running a rock-solid slack on my desktop, where I run XFCE as root, and Plasma as my user DE. I'm doing this on a dedicated laptop that I'm using just to learn, so if I break the system, I'll just FDISK and start over. I managed to get E17 installed on a Gentoo system I built a few years ago, so maybe I do have some good luck afterall....haha.

I appreciate the help and comments. I'm gonna jump on this project right after work today, so I'll report back after a case or so of PBR : )

Auroch

BW-userx 10-21-2016 10:49 AM

SlackBuilds Repository 14.2 for enlightenment
https://slackbuilds.org/repository/1...enlightenment/

not sure what version Enlightenment is right now but if the current one is different the the one on that page all you have to do is edit the SLACKBUILD file to reflect the same version on the tar ball

here
Code:


PRGNAM=enlightenment
VERSION=${VERSION:-0.17.6}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

then move down until you find this line and make sure it matches the tail end of your tar ball you may have gotten somewhere else
Code:

tar xvf $CWD/$PRGNAM-$SRC_VERSION.tar.bz2
so everything matches the actual name of the tar ball you're using. then save and run the script.

Code:

./enlightenment.SlackBuild
oh yeah don't forget to do your dependencies first


All times are GMT -5. The time now is 02:26 PM.