Issue cross-compiling on x86_64 for armv7 using rustembedded/cross


I want to automate the creation of a docker image for a rust api ( ) based on rocket for a raspberry pi.

I tried various way of doing it and had quite my load of issues... I finally suceed of doing it, but my solution is ugly, In order to make my build passes, I have to build twice.

So I am using and in order for my solution to be portable, I create one container in which I installed cross, let say compiler image. Now my build requires ssl and postgres so inspired by I create another image that contains the native openssl and postgres compiled in, let say native image.

As for openssl, everything works fine, but in order to get my build passes, I have to run the build with the native image that does not contains the x86_64 lib of postgres. it fails and after that I run the build with the native image that contains the x86_64 lib of postgres and now it passes.

Here is my code:
Dockerfile for the compiler image:
Dockerfile for the cross image:

The script that builds my armv7 binary:

After that I use the created binary with docker buildx to create the armv7 image.

So if anyone could give me some insight on why that happens, and maybe find a way to do that properly would make my day :slight_smile:

Have a good one yourself!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.