我已经使用 docker 和 qemu 从我的 amd64 工作站为 PiCore64 编译了 canboat。具体来说,这是我的构建脚本:
#!/bin/sh
set -e
NAME=canboat
cd canboat
make all
cd ..
mkdir -p ./root/usr/local/bin/
cp canboat/rel/linux-aarch64/* ./root/usr/local/bin/
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/actisense-serial
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/analyzer
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/analyzer-explain
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/analyzer-explain-j1939
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/analyzer-j1939
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/candump2analyzer
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/command-group-function
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/ikonvert-serial
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/iptee
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/n2kd
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/nmea0183-serial
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/replay
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/request-group-function
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so.6 --set-interpreter ld-linux-aarch64.so.1 ./root/usr/local/bin/socketcan-writer
#exit 1
mksquashfs ./root "$DEST"/"$NAME".tcz -all-root
md5sum "$DEST"/"$NAME".tcz > "$DEST"/"$NAME".tcz.md5.txt
cp "$NAME".tcz.dep "$DEST"
cp "$NAME".tcz.info "$DEST"
Dockerfile:
FROM arm64v8/alpine:3.19
RUN apk add gcc g++ python3 musl-dev make py3-pip py3-virtualenv libxslt libxml2-utils\
squashfs-tools py3-yaml py3-urllib3 npm linux-headers patchelf
当我在 PiCore64 14.1.0 中加载此扩展时,我得到以下输出:
$ /tmp/tcloop/canboat/usr/local/bin/actisense-serial
-sh: /tmp/tcloop/canboat/usr/local/bin/actisense-serial: not found
诊断:
$ ls /tmp/tcloop/canboat/usr/local/bin/actisense-serial
/tmp/tcloop/canboat/usr/local/bin/actisense-serial
$ ldd /tmp/tcloop/canboat/usr/local/bin/actisense-serial
linux-vdso.so.1 (0x0000007f81963000)
libc.so.6 => /lib/libc.so.6 (0x0000007f81720000)
ld-linux-aarch64.so.1 => /lib/ld-linux-aarch64.so.1 (0x0000007f881926000)
$ readelf -l /tmp/tcloop/canboat/usr/local/bin/actisense-serial | grep interpr
[Requesting program interpreter: ld-linux-aarch64.so.1]
$ ls /lib
...
ld-linux-aarch64.so.1
...
libc.so.6
...
$ env
USER=tc
SHLVL=1
HOME=/home/tc
PAGER=less -EM
PS1=...
ENV=/home/tc/.ashrc
BACKUP=1
LOGNAME=tc
TERM=linux
PATH=/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sysconfig/tcedir/ondemand
G_FILENAME_ENCODING=iso8859-1
LANG=C
MANPAGER=less -isR
SHELL=/bin/sh
FLWM_TITLEBAR_COLOR=58:7D:AA
PWD=/home/tc
EDITOR=vi
$ strace /tmp/tcloop/canboat/usr/local/bin/actisense-serial
execve("/tmp/tcloop/canboat/usr/local/bin/actisense-serial", ["/tmp/tcloop/canboat/usr/local/bi"...], 0x7fd7ba350 /* 17 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
(...:为了简洁或我的懒惰而缩写)
因此,显然可以找到所有必需的共享库,但我仍然对为什么收到错误感到困惑。有什么方法可以让我找到它正在寻找但找不到的东西吗?它缺少什么?