Hi.
I’m trying to create an environment in which I’ll be able to cross-compile different programs (eg. Pillow, ImageMagick, Gotify, mitmproxy) for my Turris Omnia 2 with OS 3.11.16 and Kernel 4.4.199. I’m totally new to linux compiling, so cross-compiling is for me a brainf*ck. I already spent hours in searching for a proper, understandable-for-me tutorial, no success yet. I have access to both Win10 and Debian machine, so I can use one of them for creating this environment.
After some research into the subject, I was advised that maybe the best solution would be to download the already-prepared env inside a Docker container. I also know that I might have later additional problems with musl library.
So recently I found this stuff: https://github.com/dockcross/dockcross, it looks like it might be a good fit for my endeavour. But I have some question marks here.
As far I understand, my Omnia has these properties:
Target: mvebu
Subtarget: cortexa9
Package architecture: arm_cortex-a9_vfpv3
CPU: Marvell Armada 385 88F6820
uname -a shows: armv7l
So which of the docker images from the dockcross will be the best fit?
dockcross/linux-armv5-musl - Linux armv5 cross compiler toolchain using musl as base “libc”.
dockcross/linux-armv7 - Generic Linux armv7 cross compiler toolchain.
dockcross/linux-armv7a - Toolchain configured for ARMv7-A used in Beaglebone Black single board PC with TI SoC AM3358 on board, Cortex-A8.
1 - Has a musl inside, which I will need for sure leter-on,
2 - Seems the most generic - so will I have to further upgrade/refine it?
and 3 - seems to be the closest with the Cortexa8 instead of Cortex9 used in my Omnia
So I’m totally lost here. And I don’t want to pick a random one and then after hours of trials and errors, discover that that wasn’t the right one. Or maybe this approach is totally wrong, and you will know of any other, easier way of cross-compilation?
In practice, I was not able to get OpenSSL compiled in a way that would work with Rust, so I ended up using the following Docker image: https://github.com/messense/rust-musl-cross
alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabihf'
rust-musl-builder cargo build --release
I understand my experience may not be entirely relevant to you, since you don’t seem to be compiling Rust programs, but I hope you will find the pointers helpful.
Not related but for this who looking how to compile Golang for Turris OS (or OpenWrt):
GOOS=linux GOARCH=arm GOARM=7 go build main.go
Then upload with scp and make it executable.
I compiled the sample Simple Golang DNS Server · GitHub
And resulted binary has size 6467709
Maybe for other projects the size will be smaller.
The CGO won’t work.
Interesting idea to check: the Alpine linux also uses musl so any program from Alpine must work on OpenWrt. I don’t know if the Alpine has packages for the armv7