Also compile C++ code with O3.
Added patch to link against libraries required for static linking.