midir icon indicating copy to clipboard operation
midir copied to clipboard

Midir crosscompilation not possible

Open atoav opened this issue 4 years ago • 2 comments

I am not sure if this is a bug or just my own fault, but I can't crosscompile for a raspberry pi when midir is a dependency (it works just fine if I comment it out in Cargo.toml).

The problem seems to happen at the linker stage (warning, really long!):

error: linking with `arm-linux-gnueabihf-gcc` failed: exit code: 1
  |
  = note: "arm-linux-gnueabihf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.25syr1jzb3exvk4y.rcgu.o" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.2hfogt1f3dulz1n8.rcgu.o" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.2kwzfdj7r6e7gc1x.rcgu.o" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.3lwv1peyt9qjersl.rcgu.o" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.4z41z2gtkawr4vib.rcgu.o" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.8nly3lsfi38ubgi.rcgu.o" "-o" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps/midi_to_trigger-8e6e7ed081b07421.17xjcw3dr7n7ptsr.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/d0/Coding/work/midi_to_trigger/target/arm-unknown-linux-gnueabihf/debug/deps" "-L" "/home/d0/Coding/work/midi_to_trigger/target/debug/deps" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libstd-95f5053e3555b465.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libpanic_unwind-625d9a5dfe06f142.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libhashbrown-4bdaee786b6ecc2f.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librustc_std_workspace_alloc-4896b2c7440385ff.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libbacktrace-359913043371f425.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libbacktrace_sys-3189fe54f33ba5a6.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librustc_demangle-278e49f56bc4aa04.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libunwind-932bef4eba16b4ec.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcfg_if-d2a28b76ca5161ed.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liblibc-0bb253fb21b3c0c3.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc-933869c77bd04128.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librustc_std_workspace_core-9b29881a4cdf4184.rlib" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcore-a7e5328f57a93d46.rlib" "-Wl,--end-group" "/home/d0/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcompiler_builtins-ce2041e567e5f109.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/lib/x86_64-linux-gnu/libdl.so: file not recognized: File format not recognized
          collect2: error: ld returned 1 exit status

I managed to compile the same thing directly on the target hardware, but it takes forever and speeding it up would be really convinient. Any ideas?

atoav avatar May 26 '20 20:05 atoav

I have no idea what's going on there ... I'm not an expert with linking on Linux. It seems weird to me, though, that the -ldl flag passed to the ARM linker makes the linker try to load /usr/lib/x86_64-linux-gnu/libdl.so (note the x86_64) ...

Boddlnagg avatar May 27 '20 15:05 Boddlnagg

Sadly I don't have too much experience with linkers myself, so I can't help. But it would be very cool to be able to cross compile midir to ARM targets as this would be a natural match for all kind of midi manipulators, controllers, etc. For example I am currently working on something that converts MIDI notes to modular synth/eurorack gates via GPIO.

atoav avatar May 28 '20 20:05 atoav