LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-01-2019, 07:45 PM   #1
Nick-us
Member
 
Registered: Feb 2019
Distribution: Slackware64-Current
Posts: 65

Rep: Reputation: 8
Question Simple doubt make


I would like to better understand installing from source using the make command

./configure
make
make install

My question is: How to make make install in a folder I choose?
Instead of installing the program on my Linux, I would like to install it in a folder, to always run it from that folder.
 
Old 09-01-2019, 08:02 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Code:
./configure --help
shows options.

where to install
Code:
./configure --prefix=/path/to install it
that requires more knowledge on PATH and such, especially if you're not going to install it in /usr or /usr/local. Reading INSTALL and README , configure --help should help you as well.
Knowing
Code:
sudo make uninstall
in case you mess something up too is worth putting in your toolbox. That requires not getting rid of the source at least until you know for sure it works the way you/it is intended to.

Last edited by BW-userx; 09-01-2019 at 08:15 PM.
 
2 members found this post helpful.
Old 09-01-2019, 08:13 PM   #3
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
Quote:
make uninstall
This is a caveat to be aware. If the option is not supported then removing all files might be a chore.

Usually considered an improvement is using a build script that is actually a wrapper to the make commands. Once a package is created files are more easily removed by the distro package manager without any concern about whether make uninstall is supported.
 
Old 09-01-2019, 08:34 PM   #4
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@Nick-us

AFAIK you need to use the configure directive BW-userx presented:
Code:
./configure --prefix=
- it will define the program destination tree and where the program will look for its dependent files when it will be executed

And to avoid what upnort mentioned, I suggest to always build a package:
https://docs.slackware.com/howtos:sl...ding_a_package
- get used with building packages under Slackware, it's really easy. After you get some more experience you'll end up with the "The "I don't have time" way"
 
1 members found this post helpful.
Old 09-01-2019, 09:06 PM   #5
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
If interested in a build script template, one is available at slackbuilds.org.
 
1 members found this post helpful.
Old 09-01-2019, 10:13 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,263

Rep: Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339Reputation: 5339
There's two parts.

The "--prefix" flag to ./configure

and

The "DESTDIR" argument to make.

The average SlackBuild (Slackware package-building) script uses both.
 
1 members found this post helpful.
Old 09-01-2019, 10:37 PM   #7
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@dugan

With the observation that DESTDIR is only used for a temporary/staged installation which is not the location from where the program will be executed.
https://www.gnu.org/prep/standards/h...e/DESTDIR.html
 
1 members found this post helpful.
Old 09-02-2019, 06:55 AM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
If and when the OP gets more familiarized with the Makefile in the notation for uninstall and the program the OP is installing, that can too be modified to ensure that it uninstalls everything, by adding it in, (fun? For some perhaps).

Things like windowmaker and e16 can be installed in places other than /usr and /usr/local. ie. ones home dir. Perhaps OP might want to take a look at them to see how they do it to get them to work. There are the libs, and other areas of interest to the program as well that one might want to take into consideration when installing a program other than what is considered the 'norm' in location fo rit to be installed in.

Slackbuilds are a good thing to learn how to use and manipulate to curtail them to the users needs between the user and the system.

Last edited by BW-userx; 09-02-2019 at 06:57 AM.
 
Old 09-02-2019, 07:54 AM   #9
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by upnort View Post
This is a caveat to be aware. If the option is not supported then removing all files might be a chore.
one way round this ( ugly )
as an unprivileged user
Code:
make install -k
everything will fail be you see where it tries to put things
if it is a BiG list, redirect stderr to file

if the src is not already compiled, it will compile it first ( not ideal ).


( less ugly )
Really the Makefile is just a shell script, so it wouldn't take much to "reverse engineer" the install target(function)

With this in mind, one could archive the Makefile, remove the Src ( if disk space is a premium )
using the Makefile
A Script could be produced to
  • check files still exist
  • check UID/GID Mode are still the same
  • check sha/md5 sums ( would have to grab them after install )
  • execute an uninstall ( or move to temp location for later deletion )

might not be worth doing
alternative config/make systems seem to be gaining popularity


still, if make uninstall doesn't work, make -k install is worth remembering
 
Old 09-02-2019, 01:47 PM   #10
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by Firerat View Post
one way round this ( ugly )
as an unprivileged user
Code:
make install -k
everything will fail be you see where it tries to put things
if it is a BiG list, redirect stderr to file

if the src is not already compiled, it will compile it first ( not ideal ).


( less ugly )
Really the Makefile is just a shell script, so it wouldn't take much to "reverse engineer" the install target(function)

With this in mind, one could archive the Makefile, remove the Src ( if disk space is a premium )
using the Makefile
A Script could be produced to
  • check files still exist
  • check UID/GID Mode are still the same
  • check sha/md5 sums ( would have to grab them after install )
  • execute an uninstall ( or move to temp location for later deletion )

might not be worth doing
alternative config/make systems seem to be gaining popularity


still, if make uninstall doesn't work, make -k install is worth remembering
If you're going to do a bunch of scripting/bookkeeping to make sure all the files are tracked, it would be better to just create a Slackware package instead.
 
1 members found this post helpful.
Old 09-02-2019, 01:59 PM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by montagdude View Post
If you're going to do a bunch of scripting/bookkeeping to make sure all the files are tracked, it would be better to just create a Slackware package instead.
If I were were going to do a bunch of scripting/bookkeeping to make sure all the files are tracked.

I would do it.
 
Old 10-15-2019, 02:59 PM   #12
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by upnort View Post
This is a caveat to be aware. If the option is not supported then removing all files might be a chore.
It is actually not that bad these days. With modern `find` you can easily locate all files associated with a package, if you know just one file provided by the package. The following is a shell script that will automate finding files that are likely to be related to your reference file, based on common install time. Just run it as root providing a single argument, that being the path to the chosen reference file.

Code:
#!/bin/sh -eu
c=$(stat -c%Z "$1")
r=${2:-10}
find /etc /opt /usr -newerct @$(($c-$r)) ! -newerct @$(($c+$r)) ! -type d
The result will be all files that were "changed" (installed from this perspective) 10 ten seconds before and 10 seconds after the reference file, in common install locations, which would almost certainly be everything related to the install and only that. This is a reasonable range as the file install step for most packages is usually less than a couple of seconds on modern hardware, for even large packages. 10 seconds is also short enough it that is unlikely anything else changed within that time (at least for software you are compiling and installing back to back). However with a second argument you can also tweak the time window (just supply a number representing how many seconds before and after).

P.S. More detail of how this works and related tricks can be found here.
 
7 members found this post helpful.
Old 10-15-2019, 06:08 PM   #13
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,489
Blog Entries: 7

Rep: Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580Reputation: 2580
Just to add to all of the excellent information above, anything you compile using
Code:
./configure && make && make install
should install itself under /usr/local by default. This location contains only a few empty directories on a standard slackware installation, and is provided specifically for the purpose of accepting locally compiled software without breaking the package management system.

If you want to know more about the options you have when compiling & installing anything from source, you can use:
Code:
./configure --help
This will give you a list and brief explanation of all of the switches available to you for that particular piece of software.

Once the software is compiled (i.e. after 'make', but before 'make install'), you can use the DESTDIR variable to install it wherever you like, regardless of the options chosen at the 'configure' stage:
Code:
DESTDIR=/path/to/specific/folder make install
 
3 members found this post helpful.
Old 10-15-2019, 06:16 PM   #14
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by rkelsen View Post
should install itself under /usr/local by default.
This is what I've been doing for more than 2 decades on Slackware, /usr/local is my "parallel world" where I put my own compilations. Never managed to break something, nor failed to clean something.

...slackin' since 1996...
 
2 members found this post helpful.
Old 10-16-2019, 02:58 AM   #15
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by rkelsen View Post
Just to add to all of the excellent information above, anything you compile using
Code:
./configure && make && make install
should install itself under /usr/local by default. This location contains only a few empty directories on a standard slackware installation, and is provided specifically for the purpose of accepting locally compiled software without breaking the package management system.
Indeed and you can normally just delete the entire contents of “/usr/local” (and subdirectories) if you feel that things have gotten too messy or out of hand. Then just issue the following as root (this assumes `bash` as your shell) to recreate the entire “/usr/local” sub-directory structure as it exists in Slackware 14.2.

Code:
mkdir -vp /usr/local/{bin,etc,games,include,info,lib{,64}/perl5,man/{cat,man}/{1,2,3,4,5,6,7,8,9,n},sbin,share/perl5,src}
I got the above from looking at the contents of the “aaa_base-14.2-x86_64-2” and “perl-5.22.2-*-1” packages (or `bzgrep usr/local MANIFEST.bz2` also works).

Alternatively, you could refer to “/usr/local : Local hierarchy” section from FHS 3.0 to see what sub-directories are considered standard or expected. Using that as a guide, you could probably get away with this as a bare minimum:

Code:
mkdir -vp /usr/local/{bin,etc,games,include,lib{,64},man,sbin,share/{man,misc},src}
Most reasonable software you would install should create any further directories that they actually needed.

Last edited by ruario; 10-16-2019 at 05:41 AM. Reason: Added an example guide for the minimum needed by FHS 3.0; added -v
 
1 members found this post helpful.
  


Reply

Tags
configure, installation, makefile, package, programs



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
Doubt regarding mysql or postg for a very simple application g_paschoal Programming 12 04-15-2014 09:40 AM
Simple Slackware vs simple Arch vs simple Frugalware punchy71 Linux - Distributions 2 08-28-2012 02:30 PM
[SOLVED] simple curl syntax doubt sl33p Linux - General 1 07-06-2009 04:18 PM
Doubt in a simple basic C program.... thefountainhead100 Programming 9 03-15-2008 01:01 AM
doubt with "make check" of gcc in chapter 6 lfs_rocks Linux From Scratch 1 02-13-2008 12:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:07 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
Open Source Consulting | Domain Registration