小编sam*_*yak的帖子

Yocto-gcc 找不到共享库

我有一个层,它在 Yocto 构建的发行版的目录中创建共享库 ( libbbexample.so) 。usr/lib该库包含多个函数。

因此,我创建了一个新层,在其中编写了一个程序,该程序将使用libbbexample.so.

文件helloworld.c

#incude<stdio.h>
#include<bbexample.h>

int main()
{
    int data;
    
    data = get_data(); // this function is present in libbbexample.so 
    
    printf("data is %d",data);
    
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

所以我尝试对新图层进行bitbake,但出现错误"cannot find -libbbexample"

新层.bb文件内容如下

do_compile() {
    ${CC} helloworld.c -o helloworld -libbbexample ${LDFLAGS} 
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755 helloworld ${D}${bindir}
}
Run Code Online (Sandbox Code Playgroud)

我为图层设置了以下优先级:

  • 旧层(将创建共享库)的优先级为6;
  • 新层(将使用共享库libbbexample.so)的优先级为7。

谢谢

c embedded shared-libraries yocto .so

2
推荐指数
1
解决办法
4607
查看次数

标签 统计

.so ×1

c ×1

embedded ×1

shared-libraries ×1

yocto ×1