Add -fPIC to compilation options.

PIC is Position Independent Code, and is important for libraries.