Open BliemHax opened 1 year ago
So your compilation fails when linking with libasound. In my experience, linking to system binaries is the most painful thing when cross-compiling rust. As a workaround/test you could try adding the flag --no-default-features
to cargo build
so that the default audio backend rodio-backend
doesn't get compiled. Then you would only have a stdout/pipe audio device which you propably could just pipe to aplay
.
Hello @BliemHax, if you are still interested, this might be of some help: https://github.com/librespot-org/librespot/pull/1263 What makes it work is using ubuntu 18.04 and fixing C/openssl/sound library links.
Question: Can't successfully cross-compile ‘librespot’ for arm-unknown-linux-musleabihf on ubuntu 22.04.
Error Log on run
cargo build
:cargo build
Command:Full Log:
Environment:
cargo --target
: arm-unknown-linux-musleabihf (must using musl because usingguneabihf
cant run on target device. )Action that I did:
Install the rustup with the Chinese mirror server (run as root):
Downloaded the
musl
compilation toolchain from musl.cc, versioncross
arm-linux-musleabihf,
and added the toolchain path to the PATH:https://musl.cc/arm-linux-musleabihf-cross.tgz
PATH is:/opt/arm-linux-musleabihf/bin
Add armhf support to dpkg and change armhf software source to "China Tsinghua University open source software mirror":
deb cdrom:[Ubuntu 22.04.2 LTS Jammy Jellyfish - Release amd64 (20230223)]/ jammy main restricted
See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted
Major bug fix updates produced after the final release of the
distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
team. Also, please note that software in universe WILL NOT receive any
review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ jammy universe
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy universe
deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates universe
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates universe
N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
team, and may not be under a free licence. Please satisfy yourself as to
your rights to use the software. Also, please note that software in
multiverse WILL NOT receive any review or updates from the Ubuntu
security team.
deb http://cn.archive.ubuntu.com/ubuntu/ jammy multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates multiverse
N.B. software from this repository may not have been tested as
extensively as that contained in the main release, although it includes
newer versions of some applications which may provide useful features.
Also, please note that software in backports WILL NOT receive any review
or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main restricted
deb-src http://security.ubuntu.com/ubuntu jammy-security main restricted
deb http://security.ubuntu.com/ubuntu jammy-security universe
deb-src http://security.ubuntu.com/ubuntu jammy-security universe
deb http://security.ubuntu.com/ubuntu jammy-security multiverse
deb-src http://security.ubuntu.com/ubuntu jammy-security multiverse
This system was installed using small removable media
(e.g. netinst, live or single CD). The matching "deb cdrom"
entries were disabled at the end of the installation process.
For information about how to configure apt package sources,
see the sources.list(5) manual.
默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb [arch=armhf,arm64] https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse
deb [arch=armhf,arm64] https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb [arch=armhf,arm64] https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
预发布软件源,不建议启用
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-proposed main restricted universe multiverse
cargo build
Additional context The dockerfile provided by repo does not compile to musl. my attempts to use rust-musl-cross and install the environment manually also failed, so I tried to compile it manually myself instead of docker, if you have any good ideas please let me know. I will try to compile on Pi4 on July 4, 2023 at +8 PM GMT.