# Cross compiling diesel

**URL:** <https://discourse.diesel.rs/t/cross-compiling-diesel/186>\
**Category:** Uncategorized\
**Created:** [September 21, 2020, 9:42am UTC](https://discourse.diesel.rs/t/cross-compiling-diesel/186 "2020-09-21T09:42:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fschuetz](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fschuetz](https://discourse.diesel.rs/u/fschuetz)\
**Post date:** [September 21, 2020, 9:42am UTC](https://discourse.diesel.rs/t/cross-compiling-diesel/186/1 "2020-09-21T09:42:38Z")

</div>

Dear all

I am trying to cross compile a rust programm using Diesel and PostgresSQL for ARM 6. Naturally this results in a native dependency on libpg (and potentially others?). I am new to cross compiling and wanted to ask if you know any sources that explains how to cross compile Diesel (preferably for ARM 6)?

Thanks  
Florian

PS: I did succesfully cross compile with non-native dependenceis. (no Diesel, or SSL or the like)

---

<div class="post-metadata">

**Author:** ![weiznich](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.diesel.rs/weiznich/32/64_2.png) [@weiznich](https://discourse.diesel.rs/u/weiznich)\
**Post date:** [September 21, 2020, 9:52am UTC](https://discourse.diesel.rs/t/cross-compiling-diesel/186/2 "2020-09-21T09:52:31Z")

</div>

You may want to have a look at [this](https://github.com/emk/rust-musl-builder) repository. It contains a docker image that can be used to cross compile diesel for the musl target. While this does not target `arm6` it should make the principle of cross compiling rust with native dependencies clear.  
In the end all boils down to compile all native dependencies with the right C-compiler + set a few environment variables. If you have an running arm6 system you can probably also receive the required libraries from there and skip the step of manually building them.

---

<div class="post-metadata">

**Author:** ![fschuetz](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fschuetz](https://discourse.diesel.rs/u/fschuetz)\
**Post date:** [September 21, 2020, 11:18am UTC](https://discourse.diesel.rs/t/cross-compiling-diesel/186/3 "2020-09-21T11:18:40Z")

</div>

Thanks for the pointer. I will take a look. Much appreciated!
