Skip to content

Local development

Lukáš Karas edited this page Jan 10, 2023 · 7 revisions

For development tasks like debugging, memory and performance profiling is helpful to run application locally. When you start application with --desktop switch, it will use desktop.qml with desktop Qt Quick UI. You don't need Sailfish.Silica components on your machine.

First, you need to install libsailfishapp locally:

git clone https://github.com/sailfish-sdk/libsailfishapp.git
cd libsailfishapp
git checkout tags/0.0.6 -b 0.0.6
mkdir build
cd build
qmake PREFIX=/usr/ ..
make -j `nproc`
sudo make install

Then you can compile osmscout-sailfish:

git clone --recursive https://github.com/Karry/osmscout-sailfish.git osmscout-sailfish
cd osmscout-sailfish

mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DQT_QML_DEBUG=yes -DOSMSCOUT_ENABLE_SSE=true ..
make -j `nproc`
./harbour-osmscout --desktop 

Tuning examples

  • Qml profiler on computer
./harbour-osmscout --desktop -qmljsdebugger=port:1234
  • Qml profiler on Sailfish OS device:
/usr/bin/harbour-osmscout -qmljsdebugger=port:1234,block,services:CanvasFrameRate,EngineControl,DebugMessages

Then use QtCreator action "Analyze", "QML Profiler (Attach to Waiting Application)" and connect to device port 1234...

  • Memory leak detection
valgrind -v --track-origins=yes --leak-check=full --show-leak-kinds=all ./harbour-osmscout --desktop
  • Heap usage profiling
LD_PRELOAD=/usr/local/lib/libtcmalloc.so HEAPPROFILE=./heap-profile ./harbour-osmscout --desktop 
# convert all samples to svg
find  . -name \*.heap -exec bash -c "pprof -svg harbour-osmscout {} | tee {}.svg" \;
  • Debug Qt renderer timing
QSG_RENDER_TIMING=1 ./harbour-osmscout --desktop
Clone this wiki locally