3

For building packages from source code, there is apt-get source --compile pkg-name. But for it to work, one has to run apt-get build-dep pkg-name beforehand, which downloads binary packages.

Is it possible to get to a point, where all packages that are updated, are compiled from source code beforehand?

6
  • 1
    "a point, where all packages that are updated, are compiled from source code beforehand?" -> You mean so they are exactly the same as the normal pre-compiled binaries (why would they be any different, hint hint)? Most people would consider that a serious hassle and, since it is also a complete waste of time, a pointless hassle.
    – goldilocks
    Feb 14, 2015 at 10:07
  • 1
    Maybe you should read up on Linux from scratch rather than Ubuntu.
    – bsd
    Feb 14, 2015 at 12:36
  • 1
    If you really need to compile every package than probably you can find Gentoo much better for you.
    – pawel7318
    Feb 14, 2015 at 12:45
  • Specifically asked about Debian on purpose, because other distributions come with other issues.
    – adrelanos
    Feb 15, 2015 at 2:45
  • @goldilocks You mean so they are exactly the same as the normal pre-compiled binaries No, not necessarily. Just to make sure they are built from source rather than using per-compiled ones.
    – adrelanos
    Feb 15, 2015 at 2:46

1 Answer 1

4

It's possible, but it's very difficult. If you really want to rebuild everything from source, you'll end up running into dependency loops which you will have to break. But if you want to persevere, instead of using apt-get build-dep you should look inside each source package's debian/control, and rebuild all the packages listed in Build-Depends and Build-Depends-Indep. Ideally you should also rebuild all the "essential" packages and all the packages which build-essential depends upon (packages don't need to declare their dependencies on these).

Others have worked on this (and still are); you can read up on the on-going efforts to bootstrap Debian on the Debian wiki.

As goldilocks points out though this is rather a waste of time. In fact there are people in Debian working to make it completely pointless by ensuring that binary packages are reproducible, i.e. that you can get the same binary as is in the archive by rebuilding on your own machine, thus proving that the claimed source code is really what was used to build the binaries; as a result, unless you want to make changes to the source code or the build configuration, there would then be no point in rebuilding from source on your own computer. You can read up on this effort on the Debian wiki as well; over 80% of the archive is already reproducible.

If you want to do this as a learning exercise, then bdowning's suggestion is very good: take a look at Linux from scratch instead. You could also check out distributions which are more source-oriented (as in, compiling from source locally), such as Gentoo Linux.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .