GCC and Environment Variables

Yesterday I was building up an EC2 image. Really, I was just building some scripts to bootstrap a common image based on start up parameters (but that is another post to be done in the future). I merely mention it here to bring up the point that while I don't want to include certain binaries in the image, I don't want the boot up process to have to perform a scripted build either.

These are images that get booted 100s of times a day and might only stick around active for 15 minutes or so, therefore speed of boot up and bootstrapping is important. Furthermore, when I decide to upgrade the binaries that this image is using, I don't necessarily want to have to create a new image.

I set out to compile both git and ffmpeg (with a number of libraries) using a custom prefix configuration option to keep all the build artifacts separate and clean from the rest of the system so I could easily make a binary package.

However, I ran into problems where the compile process for ffmpeg was looking for some headers and libraries of dependent projects that were compiled and installed earlier in the day using the same custom prefix.

For the life of me I couldn't figure out how to control the build process to see the non-standard directory paths on the build to reference the header and library files it was looking for. I toyed with the idea of just symlinking everything to /usr/local/include and /usr/local/lib, but that seemed wrong (not to mention tedious).

I finally found my answer:


By setting these environment variables to my custom path, everything configured and compiled and installed cleanly and properly.

Now I can simply tar zcf ffmpeg.tar.gz /mnt/ffmpeg.

Note: A number of folks (Brian Rosner, James Tauber, Eric Holscher, Eric Florenzano, Greg Newman, and Justin Lilly ) are making an attempt to write a blog post for each day of November. While I do like a good challenge and this is certainly one of them, I will only commit to it one day at a time. :)