0

我正在尝试从 Raspberry Pi 的 Bitbake 配方生成一个包:

inherit cargo

SUMMARY = "myapp"
DESCRIPTION = "Compile and configure myapp"
LICENSE = "CLOSED"
HOMEPAGE = "git://git.myserver.com:myapp/myapp.git"

DEPENDS = "openssl postgresql"

SRC_URI = "git://git.myserver.com/myapp/myapp.git;protocol=https;user=myuser:mypass;tag=v${PV}"
SRC_URI[sha256sum] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"

S = "${WORKDIR}/git"

我正在编译的程序依赖于postgresql包生成的 PostgreSQL 库libpq 。我的问题是链接器找不到 libpq,即使在 DEPENDS 中。

输出错误是:

...
"-Wl,--end-group" "/home/yocto-image/build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/myapp/0.0.1-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-e2523c360f03ba10.rlib" "-Wl,-Bdynamic" "-lpq" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
|   = note: /home/yocto-image/build/tmp/hosttools/ld: cannot find -lpq
|           collect2: error: ld returned 1 exit status
| 
| 
| error: aborting due to previous error
| 
...
4

1 回答 1

0

终于找到了解决办法。我在 Ubuntu x86_64 PC 上交叉编译代码。该库是编译机而不是目标机(Raspberry Pi)所必需的。解决方案就是安装 Ubuntu 中需要的库:

sudo apt-get install libpq-dev
于 2021-04-08T13:29:14.683 回答