simspace
Posts: 13
Joined: Wed Jul 11, 2018 10:31 pm

Question About Compiling RasPi Apps

Fri Jul 13, 2018 7:08 pm

Hi,

I am a developer, but I am noob to the RasPi world.

Building apps on my RasPi Zero W is so painfully slow.

For example, I am building the openFrameworks polygonExample app. It's been building for over two hours now and it's not done yet.

Is it possible to build apps on a laptop running Debian, then upload the final image to the RasPI?

Thanks,
Chris


simspace
Posts: 13
Joined: Wed Jul 11, 2018 10:31 pm

Re: Question About Compiling RasPi Apps

Fri Jul 13, 2018 7:30 pm

DirkS wrote:
Fri Jul 13, 2018 7:27 pm
Sure. Search the web for cross compiling
Excellent. Thank you @DirkS

Heater
Posts: 9484
Joined: Tue Jul 17, 2012 3:02 pm

Re: Question About Compiling RasPi Apps

Sat Jul 14, 2018 7:19 am

Are you sure you are talking about just building that app or is it that you are actually building the entire framework? That will take a long time but you should only have to do it once. Building an app will be much faster.

See here for instructions of cross-compiling openframeworks: (It's for Debian Wheezy but should work or be easy to make work on Stretch)

https://openframeworks.cc/setup/raspber ... ed-wheezy/

But why cross-compile? The whole idea of OpenFrameworks is to be cross-platform. So install it on a PC and develop you app there. When it is done then move the source code to the Pi and rebuild it there.

mikerr
Posts: 2698
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Question About Compiling RasPi Apps

Sat Jul 14, 2018 9:55 am

Well a Pi3 is much faster (> 10x) for compiling apps than a Pi Zero.

That's 100% compatible and far easier than messing with cross compiling on a PC
Android app - Raspi Card Imager - download and image SD cards - No PC required !

simspace
Posts: 13
Joined: Wed Jul 11, 2018 10:31 pm

Re: Question About Compiling RasPi Apps

Sat Jul 14, 2018 7:22 pm

Thanks for the replies!

I need to first try and make it work with the RasPi Zero. My project (if I can make it work) requires 20 RasPi’s, so I need to go as cheap as possible.

That’s helpful info regarding building apps that use openFrameworks.

A couple of apps I am trying to build also use Pip as part of the build. Pip is horribly slow on the RasPi.

The cross-compile will be a huge help as I go through the build and test process. I need to speed this process up.

User avatar
rpdom
Posts: 12660
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Question About Compiling RasPi Apps

Sat Jul 14, 2018 8:02 pm

Build on a Pi 3B and move it to the Zeroes once complete.

jahboater
Posts: 2783
Joined: Wed Feb 04, 2015 6:38 pm

Re: Question About Compiling RasPi Apps

Sat Jul 14, 2018 8:04 pm

rpdom wrote:
Sat Jul 14, 2018 8:02 pm
Build on a Pi 3B and move it to the Zeroes once complete.
A Pi 3B+ .....

simspace
Posts: 13
Joined: Wed Jul 11, 2018 10:31 pm

Re: Question About Compiling RasPi Apps

Sun Jul 15, 2018 11:22 pm

@DirkS, I've been going through the two cross-compile tutorials. You suggested.

The hackaday.com tutorial seemed easy, but when I transfer the executable to the RasPi and run it, I get a "segmentation fault" error. I found a few solutions online, but they are not working for me.

Then I tried the medium.com/@au42 tutorial.
His make files reference "tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc" and when I try run that compiler on my Ubuntu 16.04 laptop I get this error: "bash: ./arm-linux-gnueabihf-g++: cannot execute binary file: Exec format error". The file size for this executable is 778k.

I compared that executable to the hackaday tutorial.
The hackaday tutorial is using a compiler in the path "tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++". Different path and different executable. The file size for this executable is 561k. This is the one that builds my simple "Hello World" test app, but the resulting executable is causing the "segmentation fault" error on the RasPi.

Do you have any ideas how I can get the cross-compile to work?

Thanks,
Chris
Last edited by simspace on Mon Jul 16, 2018 1:11 pm, edited 1 time in total.

simspace
Posts: 13
Joined: Wed Jul 11, 2018 10:31 pm

Re: Question About Compiling RasPi Apps

Mon Jul 16, 2018 1:06 pm

I found this cross-compile discussion on Stack Overflow.

The second thread in the discussion ("Let's cross compile a Pie!") worked perfectly for me the first time.

Now I need to take some time and review the differences between the tutorials so I better understand why my first two attempts failed.

I'm sure it has something to do with the compiler being used and the various command line options set in each tutorial.

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 4 guests