Tuesday, August 19, 2008

How To Compile

I'm sure everyone with Unix experience has their own cherished best practice to compile software from source. I'll try to tone down the soapbox.

What set me off was a TidBITS article on DNS (at work, we compiled that patch as soon as it came out). I was ready to yell at my computer screen! They got it right about the need to patch right away, but wrong on how to do it well.

The very basic process to compile from source is:

./configure

make

make install # as root

Well, I like to log the results of those three commands; if it fails to build, I've got something to study later without worrying about my scroll buffer. I also like the visual feedback of how the compile is going, so I also want to see the output as well as logging it to a file. The reason why make install is its own step is so that you can follow the principle of least privilege. My method does all of those things.

./configure | tee configure.out

make | tee make.out

sudo make install | tee make-install.out

Feel free to choose your own file names, or switch to root instead of using sudo (potentially more secure, but longer). However you do it, just keep in mind that logging and least privilege are Good Things.

No comments:

Post a Comment