What to do in the situation of "installed some dependencies to build a package and the build still failed, now left with dependencies I didn't need"?
This seems as if it could eventually cause bloat to the system.
I thought:
always try installations/builds to a "sandbox" OS first, like virtual box Ubuntu or something
organize main OS so that it's possible to do full clean installs of OS from time to time to clear all the junk
Anything else?
All dependencies pulled in by
apt-get
e.g. using thebuild-dep
command are marked as "automatically installed". Once the package that needed them is removed, they can be removed by an "apt-get autoremove" command.All dependencies you installed explicitly yourself are marked as "manually installed". You need to explicitly remove them again to get rid of them. So indeed, you will need to take note of the packages you installed so you can clean up if your compilation effort ends up failing.
Something that may help you after the fact to identify packages installed on the date that you did the compilation. You can do so in the output of
grep install /var/log/dpkg.log
(source and further info).