undefined reference to ‘powf@GLIBC_2.27’

在使用他人提供的ffmpeg动态库时,发生编译错误。

undefined reference to ‘powf@GLIBC_2.27’

参考这篇文章: https://answers.ros.org/question/327482/libflycaptureso-undefined-reference-to-powfglibc_227/

 

问题原因:

     编译ffmpeg动态库的编译环境是Ubuntu 18.04:  glibc版本是2.27

     本地编译环境是Ubuntu 14.04: glibc版本是2.19;

      powf函数在glibc 2.19中没有找到,所以编译失败。

 

ubuntu查看glibc版本:

      ldd --version

root@ubuntu:/usr# ldd --version
ldd (Ubuntu EGLIBC 2.19-0ubuntu6.15) 2.19
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

 

解决方法:

      方法一:  本地使用glibc 2.19 重新编译动态库;

      方法二:  本地的glibc换成2.27

 

可以尝试使用NEON指令集来优化该段代码。NEON是ARM体系结构的一种SIMD指令集,可以实现对向量运算的加速。 以下是一种可能的NEON优化示例: ``` #include <arm_neon.h> // ... for (int i = 0; i < grid_y; i++) { for (int j = 0; j < grid_x; j++) { // Load data into NEON registers float32x4_t pdata_neon = vld1q_f32(pdata); float32x4_t scores_neon = vld1q_f32(pdata + 5); // Compute sigmoid_x for pdata_neon pdata_neon = vnegq_f32(pdata_neon); pdata_neon = vexpq_f32(pdata_neon); pdata_neon = vaddq_f32(pdata_neon, vdupq_n_f32(1)); pdata_neon = vrecpeq_f32(pdata_neon); pdata_neon = vmulq_f32(pdata_neon, vdupq_n_f32(2)); pdata_neon = vsubq_f32(pdata_neon, vdupq_n_f32(0.5f)); // Compute box_score using the first element of pdata_neon float32x2_t box_score_neon = vget_low_f32(pdata_neon); box_score_neon = vsigmoid_x_f32(box_score_neon); box_score_neon = vmul_f32(box_score_neon, vdup_n_f32(1.0f / 255)); float box_score = vget_lane_f32(box_score_neon, 0); if (box_score >= boxThreshold) { // Compute max_class_socre and classIdPoint using scores_neon float32x2_t max_class_socre_neon; int32x2_t classIdPoint_neon; vMinMaxLoc(scores_neon, &max_class_socre_neon, NULL, &classIdPoint_neon, NULL); max_class_socre_neon = vsigmoid_x_f32(max_class_socre_neon); max_class_socre_neon = vmul_f32(max_class_socre_neon, vdup_n_f32(1.0f / 255)); double max_class_socre = vgetq_lane_f32(max_class_socre_neon, 0); Point classIdPoint(classIdPoint_neon[0], 0); if (max_class_socre >= classThreshold) { // Compute x, y, w, h using pdata_neon float32x2_t xy_neon = vget_low_f32(pdata_neon); float32x2_t wh_neon = vget_high_f32(pdata_neon); xy_neon = vsigmoid_x_f32(xy_neon); wh_neon = vexp_f32(wh_neon); wh_neon = vmul_f32(wh_neon, vdup_n_f32(2)); wh_neon = vmul_f32(wh_neon, vdup_n_f32(anchor_w)); xy_neon = vsub_f32(xy_neon, vdup_n_f32(0.5f)); xy_neon = vadd_f32(xy_neon, vdup_n_f32(j)); xy_neon = vmul_f32(xy_neon, vdup_n_f32(netStride[stride])); xy_neon = vmul_f32(xy_neon, vdup_n_f32(ratio_w)); wh_neon = vmul_f32(wh_neon, vdup_n_f32(anchor_h)); wh_neon = vmul_f32(wh_neon, vdup_n_f32(ratio_h)); float x = vget_lane_f32(xy_neon, 0); float y = vget_lane_f32(xy_neon, 1); float w = vget_lane_f32(wh_neon, 0); float h = vget_lane_f32(wh_neon, 1); int left = (int)(x - 0.5 * w) + 0.5; int top = (int)(y - 0.5 * h) + 0.5; classIds.push_back(classIdPoint.x); confidences.push_back(max_class_socre * box_score); boxes.push_back(Rect(left, top, int(w), int(h))); } } pdata += 4 * net_width; } } ``` 需要注意的是,NEON指令集的优化效果取决于处理的数据类型和数据大小。上述示例中只使用了NEON的部分指令,具体的优化方案需要根据实际情况进行调整和优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值