Page 1 of 1

Question About Compiling RasPi Apps

Posted: Fri Jul 13, 2018 7:08 pm
by simspace
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

Re: Question About Compiling RasPi Apps

Posted: Fri Jul 13, 2018 7:27 pm
by DirkS

Re: Question About Compiling RasPi Apps

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

Re: Question About Compiling RasPi Apps

Posted: Sat Jul 14, 2018 7:19 am
by Heater
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.

Re: Question About Compiling RasPi Apps

Posted: Sat Jul 14, 2018 9:55 am
by mikerr
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

Re: Question About Compiling RasPi Apps

Posted: Sat Jul 14, 2018 7:22 pm
by simspace
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.

Re: Question About Compiling RasPi Apps

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

Re: Question About Compiling RasPi Apps

Posted: Sat Jul 14, 2018 8:04 pm
by jahboater
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+ .....

Re: Question About Compiling RasPi Apps

Posted: Sun Jul 15, 2018 11:22 pm
by simspace
@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

Re: Question About Compiling RasPi Apps

Posted: Mon Jul 16, 2018 1:06 pm
by simspace
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.