Repository navigation
cross compilation for elk audio os #425
Copy link
Copy link
Closed
Description
I am trying to cross-compile a plugin with DISTROH DPF
When the LV2 assets are built the following error happens"
make[1]: Entering directory '/src/dpf/utils/lv2-ttl-generator'
aarch64-elk-linux-gcc -mcpu=cortex-a72 -march=armv8-a+crc -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security --sysroot=/opt/elk/1.0.0/sysroots/cortexa72-elk-linux lv2_ttl_generator.c -Wall -Wextra -pipe -MD -MP -fno-gnu-unique -fPIC -DPIC -DNDEBUG -O3 -ffast-math -fdata-sections -ffunction-sections -fvisibility=hidden -std=gnu99 -O2 -pipe -g -feliminate-unused-debug-types -o ../lv2_ttl_generator -fdata-sections -ffunction-sections -Wl,-O1,--as-needed,--gc-sections -Wl,--strip-all -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-undefined -ldl
make[1]: Leaving directory '/src/dpf/utils/lv2-ttl-generator'
/src/dpf/utils/generate-ttl.sh: line 38: /src/dpf/utils/lv2_ttl_generator: No such file or directory
make: *** [Makefile:30: gen] Error 127
Steps to reproduce
- build the https://github.com/elk-audio/elk-audio-os-builder (see README)
- run the docker docker container
docker run --name elk-cross-compiler -it elk-audio-os-builder - install the SDK https://github.com/elk-audio/elkpi-sdk
wget https://github.com/elk-audio/elkpi-sdk/releases/download/1.0.0/elk-glibc-x86_64-elkpi-audio-os-image-cortexa72-raspberrypi4-64-toolchain-1.0.0.sh
chmod +x elk-glibc-x86_64-elkpi-audio-os-image-cortexa72-raspberrypi4-64-toolchain-1.0.0.sh
./elk-glibc-x86_64-elkpi-audio-os-image-cortexa72-raspberrypi4-64-toolchain-1.0.0.sh -y
- activate the cross-compiler:
. /opt/elk/1.0.0/environment-setup-cortexa72-elk-linux - clone and build the plugin
git clone https://github.com/michaelwillis/dragonfly-reverb.git
cd dragonfly-reverb/
git submodule update --init --recursive
make
Potential problem
It looks like the the v2-ttl-generator is built with the cross compiler for the target platform and can then not be executed on the host platform.
file dpf/utils/lv2_ttl_generator
/src/dpf/utils/lv2_ttl_generator: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=b467bc5a455b4b9a5ca47dadf95a27d60efdbba8, for GNU/Linux 3.14.0, stripped
I am not experienced in cross-compilation, therefore I wanted to ask what would be best practice to resolve this. Maybe this issue has to be solved on the plugin which is uses DPF (dragonfly-reverb)?
Metadata
Metadata
Assignees
Labels
No labels
Activity
falkTX commentedon Jul 15, 2023
you can use qemu-user-static package to run these binaries on any system, or setup binfmt-support to do it automatically.
both dpf makefile and cmake already have ways to specify this.
under make you can use
make EXE_WRAPPER="qemu-aarch64-static -L /path/to/toolchain/sysroot"and cmake usesCMAKE_CROSSCOMPILING_EMULATORjust set those accordingly if not wanting to deal with the binfmt stuff, which tends to need support from the outer layer of docker (ie, the host) so it is not always as easy to set up
falkTX commentedon Jul 15, 2023
note that whatever using elk or Pi, or ubuntu core or something else it does not matter.
the procedure is always the same, and it is known to work everywhere I have tested so far.
laenzlinger commentedon Jul 15, 2023
thank you so much @falkTX
It worked like a charm when after installing qemu-user-static on the container with
and then building dragonfly-reverb with