I'm using ubuntu server and I installed the libgd2-xpm-dev package (although I'm not sure this is the right one) but apparently GD is bundled so I've no idea what is going on.
If I continue to make and install despite the error the image functions are undefined.