Compiling a QT app for Raspberry Pi on MacOS/OSX



  • Hi,

    I'm new to Qt and trying to get one of the example Qt projects working on a Raspberry Pi to test the workflow and from what I can read, there's no way to cross-compile on OSX/MacOS for a Raspberry Pi Raspian target? Do I need to have a Linux machine to just be able to compile for the Raspberry Pi (within a reasonable timeframe)?

    It seems like quite the long route to do my design and development on one machine and then copy it over to another just to compile and then that has to be copied again (but at least the RaspberryPi2EGLFS guide should make that last stage faster) . I could do a bootcamp dual boot but overall having to go through so many steps in the round tripping slows precious development time.

    #1. Is there some way to achieve the effect in the RaspberryPi2EGLFS guide but with OSX instead of Linux on the host PC?


  • Moderators

    @Casp You could have a virtual machine with Linux.
    Regarding copying project: use a source code versioning system like Git or Subversion.


  • Moderators

    I have no Mac to check, but I think followint the RaspberryPi2EGLFS guide should still be possible. Nothing particularly extraordinary is done there - as long as you have rsync available on Mac (dunno if that's the case), it should (might?) work.



  • @sierdzio thanks for that suggestion! I have followed the RaspberryPi2EGLFS guide up to step #9 where I couldn’t get the python script to run (it said something like, as I’m not next to my Mac right now, “starting python command: directory not found”). I’ll have to spend some time understanding what is different in that script between OS X and Linux.

    Yet to just help. Q#2) Is the tool chain a standalone library that doesn’t depend on the operating system to work? I had some idea that it drew on components of the OS. I’ll just skip step 9 for now and see what I can get working.

    I’m keen to get it working on OSX if I can because I think that’s a bit of a missing link to getting another user base on Qt. If you get hobbyists using Raspberry Pi’s over to Qt that increases the employment base and decreases the development cost and thus increases use of the Qt and hopefully the quality of projects too.

    I’m still looking for a solid replacement for Flash for touchscreen development (JS and Chrome isn’t that nice still)


  • Moderators

    @Casp said in Compiling a QT app for Raspberry Pi on MacOS/OSX:

    @sierdzio thanks for that suggestion! I have followed the RaspberryPi2EGLFS guide up to step #9 where I couldn’t get the python script to run (it said something like, as I’m not next to my Mac right now, “starting python command: directory not found”). I’ll have to spend some time understanding what is different in that script between OS X and Linux.

    I'm not a python pro, but the script does not look like it's doing any Linux-specific magic inside. It's only changing symlinks to relative ones. Are you sure you have python installed?

    Yet to just help. Q#2) Is the tool chain a standalone library that doesn’t depend on the operating system to work? I had some idea that it drew on components of the OS. I’ll just skip step 9 for now and see what I can get working.

    As far as I know the toolchain is standalone, indeed. It contains all the build tools (compiler, linker etc.).

    The sysroot is standalone as well - it is a copy of the crucial parts of Raspbian operating system.

    If you skip step 9, Qt compilation is very likely to fail - and the errors will be very misleading.

    I’m keen to get it working on OSX if I can because I think that’s a bit of a missing link to getting another user base on Qt. If you get hobbyists using Raspberry Pi’s over to Qt that increases the employment base and decreases the development cost and thus increases use of the Qt and hopefully the quality of projects too.

    Well, installing a VM with Linux is not a big hassle. For popular distros it takes around 15 minutes to have the OS up and running. But you're right, if RPi could be set up from Mac it would be a plus.

    I’m still looking for a solid replacement for Flash for touchscreen development (JS and Chrome isn’t that nice still)

    Qt is great on touch screens :-)



  • Hi,

    Thanks for the response. I realised that I didn't have Python3 but an older version installed and once that was that script ran fine. So onto the next step #10 in RaspberryPi2EGLFS.

    I got the following error when I run the ./configure line in the instructions. I've read up and have g++ installed and that library is there and I'm running a 64 bit system so I put the x64 version of the compiler. Not sure what I'm looking for to resolve this one, so would love any suggestions:

    Project ERROR: Cannot run target compiler '/Users/username/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++'. Output:
    ===================
    sh: /Users/username/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++: cannot execute binary file
    ===================
    Maybe you forgot to setup the environment?
    

  • Moderators

    Ugh, that's nasty but makes sense. It's a Linux binary so probably mac won't run it :(


  • Moderators

    @sierdzio @Casp That's why I suggested to use a virtual machine with Linux :-)


  • Moderators

    @jsulm said in Compiling a QT app for Raspberry Pi on MacOS/OSX:

    @sierdzio @Casp That's why I suggested to use a virtual machine with Linux :-)

    Yeah, sure. It was still interesting to take a shot at running it natively. Now we know :-)



  • Actually i have this blog-post here:

    https://www.jaredwolff.com/blog/cross-compiling-on-mac-osx-for-raspberry-pi/

    That I plan to follow sometime soon(TM) but haven't found the time yet to do so.
    Maybe its of help for the OP.

    Its not Qt-Specific but it sets up a cross-compile toolchain for MacOS-/-RasPi



  • Thanks @J-Hilk I'll have a review of it. For now I've just decided to follow the standard Linux route under VirtualBox


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.