Thursday, December 28, 2017

Book read: The Metamorphosis by Franz Kafka





https://www.goodreads.com/book/show/485894.The_Metamorphosis

Film: The Last Jedi directed by Rian Johnson

http://www.imdb.com/title/tt2527336/?ref_=nv_sr_2

So I felt compelled to keep up with the franchise reboot.  First the good things, the opening space battle is really good.  This is something I've wanted to see on the big screen for years.  Star Trek never goes near it, but Star Wars finally did.

The downside is that's where all the CGI budget went!  The rest of the in space scenes are the universe's most dull chase scene.

Now onto Princess Leia, they seemed in two minds over to kill her off or not.  The right decision was to do that given the sad departure of Carrie Fisher.   But no we are teased with the characters death, pushing that problem further down the road.

The casino segment where they are trying to find the codebreaker is a little tenuous.  It was trying to point out the ethics of such places but it all felt too shallow.

Thursday, December 21, 2017

Cross Compiling Qt for Raspberry Pi


These are notes on getting Qt 5.9.2 built on RPi cross compiling from a PC to avoid a long build time.

Target:  RPi model 2
Host: Ubuntu 16.04

1. (Target)
   Edit /etc/apt/sources.list and uncomment the deb-src line

   Install required libraries for target:

    sudo apt-get update      
    sudo apt-get build-dep qt4-x11
    sudo apt-get build-dep libqt5gui5
    sudo apt-get install libudev-dev libinput-dev \

                 libts-dev libxcb-xinerama0-dev  libxcb-xinerama0

   Setup target directories:

    sudo mkdir /usr/local/qt5pi
    sudo chown pi:pi /usr/local/qt5pi

 2. (Host)

   Setup working directory and get a toolchain

    mkdir ~/raspi
    cd ~/raspi
    git clone https:://github.com/raspberrypi/tools

    mkdir sysroot sysroot/usr sysroot/opt


   Libraries from RPi to Host:

    rsync -avz pi@rpi:/lib sysroot
    rsync -avz pi@rpi:/usr/include sysroot/usr
    rsync -avz pi@rpi:/usr/lib sysroot/usr
    rsync -avz pi@rpi:/opt/vc sysroot/opt


   Adjust symlinks to relative:

      wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
      chmod +x sysroot-relativelinks.py
     ./sysroot-relativelinks.py sysroot


 3. (Host)
    Get opensource package for Qt (e.g qt-everywhere-opensource-src-5.9.2.tar.xz)

   The configure was tricky to setup, I got a clean build with:

    ./configure -release \
                -opengl es2 \
                -device linux-rasp-pi2-g++ \
                -device-option \
                CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- \
                -no-use-gold-linker \
                -sysroot ~/raspi/sysroot \
                -opensource \
                -confirm-license \
                -make libs -prefix /usr/local/qt5pi \
                -extprefix ~/raspi/qt5pi \
                -skip wayland \
                -skip qtwebengine \
                -hostprefix ~/raspi/qt5 -v


   Note the linux-rasp-pi2 which might need updating to linux-rasp-pi3 for newer models.  I dropped the qtwebengine and wayland to avoid some compile errors.

4. (Host) Deploy to Rpi

      rsync -avz qt5pi pi@raspberrypi.local:/usr/local

5. (Host) build an example app

     cd qtbase/examples/opengl/qopenglwidget
     ~/raspi/qt5/bin/qmake
     make

     scp qopenglwidget pi@raspberrypi.local:/home/pi

Sources

These were my starting points for this post:

https://wiki.qt.io/Native_Build_of_Qt5_on_a_Raspberry_Pi
https://wiki.qt.io/RaspberryPi2EGLFS

Sunday, December 17, 2017

Book read: Calculating the Cosmos by Ian Stewart

I've not read much of Stewart for a few years, so I tried this book.  It's a good survey of the mathematics behind modern astronomy.  Right from the basics up to exo-planets and dark matter.

It is a little heavy going in place, could have done with a few more formulas rather than worded descriptions of formulas!

Book read: The Korean War by Max Hastings


A book I've wanted to read for many years to plug a gap in my knowledge.  With Trump at loggerheads with N Korea I thought it a good time to read up on the original conflict.

This book was from the late 1980s, and N Korea was as closed as it is now.  Hastings describes the conflict very well and the subversive involvement of China which soon became China versus America which is probably little appreciated.