btleplug icon indicating copy to clipboard operation
btleplug copied to clipboard

compilation error when compiling to arm

Open alexou2 opened this issue 11 months ago • 5 comments

Describe the bug i get a pkg config error when i try to compile my code to armv7-unknown-linux-gnueabihf

Expected behavior the code should compile without an errors

Actual behavior when i compile my code for armv7-unknown-linux-gnueabihf, get this error: pkg_config failed: pkg-config has not been configured to support cross-compilation..

Additional context I am compiling from x86 linux

alexou2 avatar Mar 21 '24 22:03 alexou2

Have you set up pkg-config for cross compilation? You'll need libdbus to link against, at least. cross is one way to do this, you'll want something like this Dockerfile.

qwandor avatar Mar 22 '24 11:03 qwandor

I was able to set up pkg-config for cross compilation, but now i get this linker error: /usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: cannot find -ldbus-1: No such file or directory collect2: error: ld returned 1 exit status

alexou2 avatar Mar 22 '24 17:03 alexou2

btleplug on Linux depends on libdbus, so you'll need to have it available to link against for your target architecture. How to do that depends on what distribution you are using. Using cross and a Docker container as I suggested above will make this simpler.

qwandor avatar Mar 22 '24 17:03 qwandor

now I get this error when compiling with cross The system library dbus-1required by cratelibdbus-sys was not found.

alexou2 avatar Mar 23 '24 04:03 alexou2

Did you install libdbus-1-dev in the Docker container for cross, using the Dockerfile I linked or otherwise?

qwandor avatar Mar 24 '24 19:03 qwandor