c - OpenWrt SDK自定义包 'make'失败,因为缺少libpthread.so.0

标签 c pthreads openwrt

所以我写了一个程序在运行OpenWrt Attitude Adjustment 12.09的Tp-link设备上运行。

我在/OpenWrt-SDK../package/myprogram/src/Makefile 中成功编写了 makefile,当我执行“make”时,一切运行顺利。

现在我在我的程序中添加了线程,所以我这样配置 Makefile:

# build myprogram executable when user executes "make"
LDFLAGS=-pthread

myprogram: myprogram.o
    $(CC) $(LDFLAGS) myprogram.o -o myprogram
myprogram.o: myprogram.c
    $(CC) $(CFLAGS) -c myprogram.c

# remove object files and executable when user executes "make clean"
clean:
    rm *.o myprogram

当我在 package/myprogram/src 文件夹中“制作”时,它编译成功并在我的 PC 上运行良好。

现在,当我转到 OpenWrt-SDK 根目录进行“制作”时,我收到了一个缺少依赖项的错误:

Package myprogram is missing dependencies for the following libraries:
libpthread.so.0

那么我需要做什么来包含这些依赖项呢?

我转到我的 OpenWrt-SDK 根目录并尝试:

./scripts/feeds search libpthread

我得到了这个结果:

./scripts/feeds search libpthread
Search results in feed 'trunk':
libpthread                  POSIX thread library

我应该安装它还是不安装它?我不知道我是否做错了什么。

我将不胜感激任何帮助! 谢谢。

最佳答案

在包定义下添加

DEPENDS:=+libpthread

关于c - OpenWrt SDK自定义包 'make'失败,因为缺少libpthread.so.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17321653/

相关文章:

在并行 for 循环中调用函数

android - 为什么这些后续的 "dup2"调用存在于 android 引导代码中

c++ - 在 c++ 的 Windows 线程编程中,pthread_setcanceltype 的替代方案是什么?

c - 在单核机器上运行 3 个并行线程

openwrt - 如何使用crontab在特定时间仅在openwrt中运行一次重启命令?

build - Cscope 构建失败并显示错误消息 "could not read symbols: File in wrong format"

linux - 如何检测 Openwrt kern.info 和 daemon.info 事件?

c - 关于实用程序 'df' 中的库 <libutil.h>,Linux

c - 当使用特定数量的线程时,Pthread 不起作用

c - 调用另一个递归函数的递归函数的运行时分析