Skip to content

cross compilation for elk audio os #425

Closed

Description

@laenzlinger

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

  1. build the https://github.com/elk-audio/elk-audio-os-builder (see README)
  2. run the docker docker container docker run --name elk-cross-compiler -it elk-audio-os-builder
  3. 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
  1. activate the cross-compiler: . /opt/elk/1.0.0/environment-setup-cortexa72-elk-linux
  2. 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)?

Activity

  1. falkTX commented on Jul 15, 2023

    @falkTX
    Contributor

    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 uses CMAKE_CROSSCOMPILING_EMULATOR
    just 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

  2. falkTX commented on Jul 15, 2023

    @falkTX
    Contributor

    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.

  3. laenzlinger commented on Jul 15, 2023

    @laenzlinger
    Author

    thank you so much @falkTX

    It worked like a charm when after installing qemu-user-static on the container with

    sudo apt-get install qemu-user-static
    

    and then building dragonfly-reverb with

    make EXE_WRAPPER="qemu-aarch64-static -L /opt/elk/1.0.0/sysroots/cortexa72-elk-linux"
    
  4. locked and limited conversation to collaborators on Dec 14, 2024
  5. converted this issue into a discussion #482 on Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions