0

I'm wondering what are good practices about compilation and manual installation of software on Linux systems. I mean getting, building and installing code by this usual way :

git clone https://a-repo/foo.git
cd foo/
./configure
make
make install
  • Should that be avoided ? Or is it recommended ? Maybe it is better to make a package for the distribution in use ?
  • Are there some tricks to manage versions and updates ?
  • Does good practices exists when doing ./configure, particularly with --prefix= ?
  • How can I install / uninstall properly ? Should I always keep the sources to do make uninstall ?
  • I have seen some tools like stow, but this seems to be a controversial solution... Maybe an other one ?

I prefer solutions that are independents of distro, but all suggestions and advices are welcome !
Thank you !

EDIT: It seems that people don't understand my question. I'm not opening a debate, I just want an answer as clear as possible for the various points above. I really think this could be helpful for some people. Thank you for your contribution.

asked Oct 14, 2022 at 17:21
5
  • TLDR Use --prefix=/opt/something or even --prefix=/opt/something-VERSION. No issues with deinstalling, installing, keeping track of versions, etc. Don't wanna write an answer - there's just too much to talk about. Commented Oct 14, 2022 at 18:48
  • Thanks for this advice. I know there is a lot to say about, I would just like to have an overview and different opinions on this topic ;-) Commented Oct 14, 2022 at 19:58
  • This question isn't really suitable for a stackexchange site: the answers are going to be a matter of discussion and opinion. There are probably some reddits that would be a good fit. But as long as I'm here, I really like stow for managing source-installed software. Commented Oct 19, 2022 at 12:09
  • Thank you for your tips, I didn't think about Reddit. I'm looking for a kind of checklist, so I tought that SE was good for that... I'll try a bit more stow, I like the concept of this minimalistic software. The problems I encountered with stow were about some symlinks not working, mainly for systemd services. Commented Oct 19, 2022 at 12:21
  • 1
    Three words: document, Document, DOCUMENT. When I was a telephone support tech for a company with Unix/Linux products, I spoke with many, many engineers who joined a company and had to puzzle out the software and configs left behind by a previous engineer. Among those were programs installed from source rather than from the package manager. Write down in a wiki or Google Docs the general steps you use to build your programs and where you install them. The engineer you help with this will even be you -- in a year when you need to update things and can't remember the details. Commented Oct 19, 2022 at 12:31

1 Answer 1

1

The problem with your method is figuring out what files have to be deleted when you want to uninstall the software.

The best practice is to build a package for the distribution. This has several advantages. It allows you to easily install, upgrade, & remove packages. It allows you to compile the software on a seperate machine avoiding putting compilers on every machine. It allows you to easily upgrade the package when the upstream goes to another version/release. And, it allows you to build the software without being root.

A quick & dirty work around I used before I learned how to use rpmbuild & spec files was to:

./configure
make
make DESTDIR=/tmp/build install

This puts all the "installed" files with the correct installation tree under the /tmp/build directory. Then change the owner/group for all the files in the directory. Then:

tar cvfj <filename> -C /tmp/build/

To install them: tar xvf <filename> -C / To uninstall them: tar tf <filename> | xargs rm

answered Nov 2, 2022 at 13:35
4
  • Thanks for this tip, I think this is something like that I want ! I tried this bash tar cvjf ed.tar.bz2 -C /tmp/build/ tar: Cowardly refusing to create an empty archive Try 'tar --help' or 'tar --usage' for more information.` But I got this error as you can see. So tried tar cvjf ed.tar.bz2 -C /tmp/build/ ., but this creates a problem when uninstalling: bash rm: impossible de supprimer './usr/local/': Aucun fichier ou dossier de ce type Commented Nov 3, 2022 at 8:31
  • I did this but it is a little dirty ;-) tar tf ed.tar.bz2 | sed -e 's/^.//' | xargs rm Commented Nov 3, 2022 at 8:37
  • @thiblcr Whatever works. However, if you are going to be doing a lot of these, you should take the time to learn how to build packages. Another resource is "pkgs.org". Someone may have already built the package for your distro. Commented Nov 3, 2022 at 22:03
  • Yeah thank you very much, your solution is very simple, I 'll keep this trick... I'm mainly on Gentoo, so I'll need to learn how to write ebuilds. I think you're right about building packages, this seems to be the better way ! Commented Nov 4, 2022 at 7:39

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.