We have moved to a new Sailfish OS Forum. Please start new discussions there.

Build non-Qt project for Emulator and device

asked 2016-05-31 16:48:52 +0200

Luca gravatar image

updated 2018-12-03 21:37:03 +0200

Tanghus gravatar image

Hi all, I need to build a C++ software to test on Emulator and on the Jolla device.

Is it possible by using MerSDK VM ?

I found some tutorial on building Qt Projects from command line but I didn't found how to build generic C++ software.

For example I have a library that I usually build on my Linux PC with:



How can I do that on MerSDK to build for Emulator and for Device ?


edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted

answered 2016-05-31 17:44:42 +0200

Connect by ssh to the merSDK VM (adjust $INSTALL according to your installation path) :

ssh -i $INSTALL/SailfishOS/vmshare/ssh/private_keys/engine/mersdk -p 2222 mersdk@localhost

Copy your source to /home/deploy and go there.

Then, if your project has a spec file for rpm building do :

mb2 -t SailfishOS-armv7hl -s rpm/my_software.spec build

It will download all necessary dependencies and build the rpm for you. Then you can copy the rpm to the emulator and install it to test.

If you don't have a rpm spec file, you'll have to do it by hand :

  • Install dependencies by login to scratchbox with root privileges sb2 -R -t SailfishOS-armv7hl and then install with zypper in toto-devel. You can look for packages with zypper search toto. Then unlog root from scratchbox.
  • Configure and compile while loggued in scratchbox sb2 -t SailfishOS-armv7hl, then make.
edit flag offensive delete publish link more


Thanks! So, correct me if I wrong, sb2 command is used to setup the "environment". After executing:

sb2 -t SailfishOS-armv7hl

all I build is built for ARM...


Luca ( 2016-05-31 18:13:38 +0200 )edit

The VM contains a Linux environnement that is not used for build, but just as a host where all files are easily controlled and adjusted (not like a desktop of anyone's computer). Then, in this host, there are two "targets", one for building for arm, the other one for i486 (you can use TAB to complete any sb2 -t … or mb2 -t … command). These targets stuff are more or less chroot used by the utility scratchbox. You can log to the scratchbox target with sb2 (see sb2 --help). Then, any command are issued for this target (so building for arm, downloading dependencies for arm…). The mb2 command is a wrap up around usual command to build a rpm package so we don't have to log into the scratchbox target itself.

Damien Caliste ( 2016-05-31 18:22:59 +0200 )edit

Thanks for clarification!

Luca ( 2016-05-31 18:43:00 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2016-05-31 16:48:52 +0200

Seen: 272 times

Last updated: May 31 '16