错误输出为
libQtWebKit.so: undefined reference to `trunc’
libQtWebKit.so: undefined reference to `lroundf’
libQtWebKit.so: undefined reference to `roundf’
libQtWebKit.so: undefined reference to `lround’
因为链接数学库函数时找不到它们,所以可以修改如下
src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h
105 #if 1 // 原值为COMPILER(MSVC) || COMPILER(RVCT)修改为1,也就是要编译这些函数 106 107 inline long lround(double num) { return static_cast<long>(num > 0 ? num + 0.5 : ceil(num - 0.5)); } 108 inline long lroundf(float num) { return static_cast<long>(num > 0 ? num + 0.5f : ceilf(num - 0.5f)); } 109 inline double round(double num) { return num > 0 ? floor(num + 0.5) : ceil(num - 0.5); } 110 inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); } 111 inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); } 112 113 #endif