BaleineBleue
BaleineBleue

Reputation: 377

Compile Rust program for raspberry pi `armv7-unknown-linux-gnueabihf` from 64 bit arch linux

I want to compile a Rust program from my laptop for my raspberry pi. I am having issues upgrading the version of C on the pi and cannot install rust to compile it from there.

I followed this tutorial for cross compiling rust for rpi. I can compile simple programs this way with no problems, however the program I want to compile uses sqlite and openssl and this is where I am having issues.

I have installed lib32-dbus, lib32-openssl and lib32-sqlite. Doing export OPENSSL_LIB_DIR=/usr/lib32 and export OPENSSL_INCLUDE_DIR=/usr/include/openssl-1.0 fixes openssl, but the linker still can't find the 32 bit version of the sqlite lib and exits with this error:

$ PKG_CONFIG_ALLOW_CROSS=1 cargo build --target armv7-unknown-linux-gnueabihf

...

note: /usr/lib/libsqlite3.so: file not recognized: file format not recognized

Full error here.

Is there some sort of SQLITE_LIB_DIR env variable that I can set? If not, how do I point the linker to the correct version? Thanks.

Edit: I have now downloaded and cross compiled libsqlite3 for arm linux. Now I just need to know how to point the linker to the arm version.

Upvotes: 3

Views: 1642

Answers (1)

Pawan Bisht
Pawan Bisht

Reputation: 211

You can't cross-compile your Rust program with every feature of OpenSSL, because some versions of OpenSSL don't support (feature as Vendored) which helps for cross-compilation. So you can use a version of OpenSSL which supports this feature, like openssl = { version = "0.10", features = ["vendored"] }

Upvotes: 1

Related Questions