Using cross-compiler extracted from 1804 Application SDK

asked 2018-07-03 00:01:16 +0300

too gravatar image

updated 2018-07-03 01:10:40 +0300

olf gravatar image

While Virtualbox is greate software and I've installed it on many occations I did not want to mess up these particular computers with it (and on some other machines I don't have graphical desktop access) I started to look how I could create stuff for my Jolla device without it.

After a few strace(1) and readelf(1) output investigations (and some internet searches) I got up with the notes that follow shortly.

I've downloaded the SailfishOSSDK-Beta-1804-Qt5-linux-64-offline.runlocated in page and size and md5sum matches what has been written there:

$ md5sum

$ ls -l
-rwxr-xr-x. 1 too too 974061733 Jul  1 20:24*

Before going to the notes (and continuing further to read this message), execute the following on the command line:

tail --bytes=+30258787 | less

and read through the following embedded license documents... As the normal installer is not run (it exits early if there is no Virtualbox installed so that is also not the way to read the licence documents); there is some binary noise between those, to be ignored...

  • Jolla Developer Software Agreement for the Sailfish Beta Qt5 SDK

  • GNU GENERAL PUBLIC LICENSE Version 2, June 1991

  • GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007

  • GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999

  • Digia Qt LGPL Exception version 1.1

  • ICU License - ICU 1.8.1 and later

You have to agree with the terms before following these steps below.

After doing the following steps the output file a.out can be copied to Jolla device with arm processor and "Hello TJC" is printed on stdout when run.

Final note (Based on the GPL):

These notes are distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of

That said, I''ll also follow the 'release early, release ...'
hmm, perhaps not so often but anyway... ;D

Total disk space used: 6.2 GiB

$ tail --bytes=+30441571 > z7
$ 7za x z7

$ sudo rmmod nbd
$ sudo modprobe nbd max_part=16

$ sudo qemu-nbd -c /dev/nbd0 mersdk/mer.vdi
$ dmesg
$ sudo mount /dev/nbd0p1 /mnt

$ sudo mkdir new-chroot
$ sudo cp -naT /mnt/srv/mer/targets/SailfishOS- new-chroot
$ sudo cp -naT /mnt/srv/mer/toolings/SailfishOS- new-chroot
$ sudo chroot new-chroot bash

bash-3.2# export TERM=xterm
bash-3.2# /opt/cross/bin/armv7hl-meego-linux-gnueabi-gcc -v -xc /dev/null
bash-3.2# exit

$ sudo mkdir new-chroot/opt/cross/armv7hl-meego-linux-gnueabi/sys-root
$ sudo cp -naT /mnt/srv/mer/targets/SailfishOS- new-chroot/opt/cross/armv7hl-meego-linux-gnueabi/sys-root

$ sudo umount /mnt
$ sudo qemu-nbd -d /dev/nbd0

$ sudo chroot new-chroot bash
bash-3.2# export TERM=xterm
bash-3.2# /opt/cross/bin/armv7hl-meego-linux-gnueabi-gcc -v -xc /dev/null

bash-3.2# printf '#include <stdio.h>\nint main(void) { printf("Hello TJC\\n"); return 0; }' | PATH=$PATH:/opt/cross/bin /opt/cross/bin/armv7hl-meego-linux-gnueabi-gcc -B /opt/cross/bin/armv7hl-meego-linux-gnueabi- -v -xc -

bash-3.2# file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x7439853c922aefc31ed06e4b7ff98de37b8f69be, not stripped

edit retag flag offensive close delete



Why you can't just ?

coderus ( 2018-07-03 01:17:10 +0300 )edit

because i did not know of it. thanks, i'll look into it. need some adjustments for zsh (well if i used bash i would do things differently anyway )

too ( 2018-07-03 19:25:14 +0300 )edit