Cross compiler for OF 0.9.0/Jessie/arm6/RPi1

In updating the Raspberry Pi Cross-compiling guide for OF 0.9.0 I felt the forum may be a better place for this as these things can often change/require feedback. I am also using my personal workflow which everyone may not subscribe to.

The warning is - don’t take this as an official guide but more “this is what I did and what works for me”. I am also writing this post-process so there is a chance I am missing a step or instruction. Hopefully by this being a forum post it will be easier to get feedback or have others contribute solutions for different platforms.

Some updates since this guide was written:

With OF 0.9.1 or later, the recommended/supported distribution for all RPi models is armv6.
That means this cross-compiler will also work for the RPI2.

The official Raspberry Pi Tools have been updated with GCC 4.9.3 so those work as opposed to the custom-compiled GCC in this guide

System setup:

Mac OS X 10.10
Virtual Box 4.3 running 64 bit Debian Jessie (the cross-compiler VM)
Raspberry PI 1 with Debian Jessie
openFrameworks 0.9.0 for arm6

Workflow overview/goal:

The end goal is to be able to create and edit openFrameworks apps on a Mac, compile quickly and run them on the RPI. This workflow does not have a copy task (e.g. compile on one machine and copy the app over). Compiling is done over the network.

In order to do this a few things must be configured.

Raspberry Pi has root filesystem (/) available as a mount point
The Mac and Cross-complier VM mounts the RPI as a network drive and is able to add, edit and change files without permission hassle.

Also in this workflow, the RPI has openFrameworks installed and is available to compile natively in case cross-compiler is not available

RPI Configuration:

Download and install openFrameworks 0.9.0 into /home/pi/openFrameworks according to the Getting Started guide
http://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/

Install Samba server and configure it with root access
http://openframeworks.cc/setup/raspberrypi/raspberry-pi-smb/

Install Avahi in order to be able to access the RPI with an address like raspberrypi.local

sudo apt-get install cifs-utils avahi-daemon avahi-utils libavahi-compat-libdnssd-dev 

Mac Configuration:

Install VirtualBox
https://www.virtualbox.org/wiki/Downloads

Install Debian 64 bit Jessie as a VM
This is the image I used
http://gemmei.acc.umu.se/mirror/cdimage/release/8.2.0-live/amd64/iso-hybrid/debian-live-8.2.0-amd64-standard.iso

For the VM Jessie installation you don’t need a Desktop.
You will want to give it at least 10GB of disk storage. 15GB is safer if you can spare it.
Use Bridge Mode for the Network adapter. This will allow access to local network without NAT entries.
I configured it with 4 processors and 2GB of RAM but less is probably ok for a laptop (my primary machine is a Mac Pro)
I made the primary user named “pi”.

Here is what mine looks like in the end

VM Configuration:

From the Mac, ssh into the VM as the user “pi” for the following steps. You can type them into the VM window but SSHing in allows easier copy/pasting with the Mac Terminal.

Add the user “pi” to the root group makes things simpler to install and configure the VM.

su
apt-get install sudo
adduser pi sudo
nano /etc/sudoers

Under “User privilege specification” add pi line below to look like

root  ALL=(ALL:ALL) ALL
pi    ALL=(ALL:ALL) ALL

Save and exit nano (Ctrl+O, Ctrl+X)

Hit Ctrl+D to go back to not being root (you will then be the “pi” user again)

Install these packages to allow compiling, mounting network drives, and easier network access

sudo apt-get install gawk pkg-config make build-essential cifs-utils avahi-daemon avahi-utils libavahi-compat-libdnssd-dev 

Mount the RPI onto the Debian VM

sudo mkdir /media/Data
sudo nano /etc/fstab

Add the below line. raspberrypi.local is the RPI Network address and can be IP.

//raspberrypi.local/Data /media/Data cifs credentials=/home/pi/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

Save and exit nano (Ctrl+O, Ctrl+X)

Create a file that will be used to store the RPI user/pass to mount the drive

nano /home/pi/.smbcredentials

Add lines

username=pi
password=raspberry

Save and exit nano (Ctrl+O, Ctrl+X)

Mount the RPI on the VM and test by listing the RPI root filesystem

sudo mount -a
ls -al /media/Data

So if you have successfully listed the files we can move onto the next step of creating local RPI filesystem that the VM will use to compile.

Create a folder named RPI_ROOT, go into it and just make symbolic links for some of the content we don’t need to change and copy the folder we do.

cd
mkdir RPI_ROOT
cd RPI_ROOT
ln -s /media/Data/etc/ etc
ln -s /media/Data/lib/ lib
ln -s /media/Data/opt/ opt
cp -Rv /media/Data/usr/ usr

Now we are at which has been the most problematic part. The files you just copied (and that the cross-complier will reference) have hardcoded symbolic links to “/lib”. These need to be changed to a relative path in order to compile correctly. Previously there was a script named fixQualifiedPaths.sh that did this for you but wasn’t working for me anymore (I suspect sed/regex changes).

The next commands do this but have an inherit problem of not being future-proof as they are targeting explicit version numbers that are likely to change with Raspbian updates.

These worked for me - since it is a local copy the worst that can happen is that you need to re-copy the RPI /usr folder and do it manually

Go into the directory with the bad links (you still should be in RPI_ROOT)

cd usr/lib/arm-linux-gnueabihf

Remove the bad links

rm libudev.so libanl.so libBrokenLocale.so libcidn.so libcrypt.so libdbus-1.so libdl.so libexpat.so libglib-2.0.so liblzma.so libm.so libnsl.so libnss_compat.so libnss_dns.so libnss_files.so libnss_hesiod.so libnss_nisplus.so libnss_nis.so libpcre.so libpng12.so.0 libresolv.so libthread_db.so libusb-0.1.so.4 libusb-1.0.so libutil.so libz.so

Recreate the symbolic links with relative paths

ln -s ../../../lib/arm-linux-gnueabihf/libanl.so.1  libanl.so        
ln -s ../../../lib/arm-linux-gnueabihf/libBrokenLocale.so.1  libBrokenLocale.so      
ln -s ../../../lib/arm-linux-gnueabihf/libcidn.so.1  libcidn.so        
ln -s ../../../lib/arm-linux-gnueabihf/libcrypt.so.1  libcrypt.so       
ln -s ../../../lib/arm-linux-gnueabihf/libdbus-1.so.3.8.13  libdbus-1.so       
ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2  libdl.so        
ln -s ../../../lib/arm-linux-gnueabihf/libexpat.so.1.6.0  libexpat.so       
ln -s ../../../lib/arm-linux-gnueabihf/libglib-2.0.so.0  libglib-2.0.so       
ln -s ../../../lib/arm-linux-gnueabihf/liblzma.so.5.0.0  liblzma.so        
ln -s ../../../lib/arm-linux-gnueabihf/libm.so.6  libm.so        
ln -s ../../../lib/arm-linux-gnueabihf/libnsl.so.1  libnsl.so        
ln -s ../../../lib/arm-linux-gnueabihf/libnss_compat.so.2  libnss_compat.so      
ln -s ../../../lib/arm-linux-gnueabihf/libnss_dns.so.2  libnss_dns.so       
ln -s ../../../lib/arm-linux-gnueabihf/libnss_files.so.2  libnss_files.so      
ln -s ../../../lib/arm-linux-gnueabihf/libnss_hesiod.so.2  libnss_hesiod.so      
ln -s ../../../lib/arm-linux-gnueabihf/libnss_nisplus.so.2  libnss_nisplus.so      
ln -s ../../../lib/arm-linux-gnueabihf/libnss_nis.so.2  libnss_nis.so       
ln -s ../../../lib/arm-linux-gnueabihf/libpcre.so.3  libpcre.so        
ln -s ../../../lib/arm-linux-gnueabihf/libpng12.so.0  libpng12.so.0       
ln -s ../../../lib/arm-linux-gnueabihf/libresolv.so.2  libresolv.so       
ln -s ../../../lib/arm-linux-gnueabihf/libthread_db.so.1  libthread_db.so      
ln -s ../../../lib/arm-linux-gnueabihf/libusb-0.1.so.4  libusb-0.1.so.4      
ln -s ../../../lib/arm-linux-gnueabihf/libusb-1.0.so.0.1.0  libusb-1.0.so       
ln -s ../../../lib/arm-linux-gnueabihf/libutil.so.1  libutil.so        
ln -s ../../../lib/arm-linux-gnueabihf/libz.so.1.2.8  libz.so  
ln -s ../../../lib/arm-linux-gnueabihf/libudev.so.1.5.0 libudev.so

Build the Cross Compiler

We are now ready to build a cross-compiler. As mentioned in the cross-compiling guide, the previous tools provided by the RPI foundation are built on GCC 4.8 which doesn’t provide the C++11 support OF 0.9.0 requires.

Make a temp folder for the cross-compiler build and download the build script

cd
mkdir CROSS_BUILD_TOOLS
cd CROSS_BUILD_TOOLS
wget https://gist.githubusercontent.com/jvcleave/ed342fb2d41564bcdab6/raw/cd7a8e7555a1375d93c511dd368b1d4cad538de2/build_cross_gcc.sh

link to whole gist

Set the build script to executable

sudo chmod +x build_cross_gcc.sh

The script will take some time as it downloads, builds a GCC 4.9 based arm6 compiler, and installs it into /opt/cross/bin.

sudo ./build_cross_gcc.sh

Set Environmental Variables

If all goes well we are almost ready to cross-compile. Here we set some of the helper variables that the OF Makefile system will use for cross-compiling.

cd
nano .profile

Add the lines to the bottom

export GST_VERSION=1.0
export RPI_ROOT=/home/pi/RPI_ROOT
export TOOLCHAIN_ROOT=/opt/cross/bin
export PLATFORM_OS=Linux
export PLATFORM_ARCH=armv6l
export PKG_CONFIG_PATH=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig:$RPI_ROOT/usr/share/pkgconfig:$RPI_ROOT/usr/lib/pkgconfig

Save and exit nano (Ctrl+O, Ctrl+X)

Apply the variables to your current session (they will be permanent from here on out)

source .profile

Try and compile:

make -C /media/Data/home/pi/openFrameworks/examples/empty/emptyExample/

If it compiles successfully, SSH into the RPI and run the application.

Some other stuff I do:

An additional line you can add to ~/.profile to use multiple processors (4 being the amount of cores you want to dedicate)

export MAKEFLAGS="-j 4"

Make a link to the RPI openFrameworks folder on the VM so I don’t have to type /media/Data/openFrameworks

cd
ln -s /media/Data/home/pi/openFrameworks

Quirks:

Sometimes when I boot the VM it doesn’t mount the RPI right away. This often solves it

sudo mount -a

Good luck!

10 Likes

I’ve updated https://github.com/twobitcircus/rpi-build-and-boot. Uses vagrant and ansible to spin up an Ubuntu 14.04 machine that cross-compiles OpenFrameworks 0.9 for armv7 and NFS boots Raspberry Pi.

Now with simpler instructions that recognize the fact that NFS booting large numbers of Raspberry Pis may be a niche use-case :smile:

There is zero chance that I would have figured out how to build that cross-compiler myself, so THANK YOU!

1 Like

Hey @jvcleave, thanks a lot for the guide. I tried some months ago also the @eric_gradman tutorial without success. This is like a nightmare to me, now I am back! :wink:

I followed all your guide and I am stuck at the end step “Try and compile”. The only difference it’s than I used another debian image: debian-8.2.0-amd64-netinst.iso. Same release version, but the other one used by you didn’t installed the graphic environment.

So, when I make the compile I am getting this errors:

pi@debian:~$ make -C /media/Data/home/pi/openFrameworks/examples/empty/emptyExample/
make: Entering directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'
HOST_OS=Linux
HOST_ARCH=x86_64
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-3.0 
Compiling OF library for Release
make[1]: Entering directory '/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project'
HOST_OS=Linux
HOST_ARCH=x86_64
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-3.0 
HOST_OS=Linux
HOST_ARCH=x86_64
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-3.0 
/bin/sh: 1: cannot create /media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/.compiler_flags: Permission denied
makefileCommon/compile.core.mk:233: recipe for target '/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/.compiler_flags' failed
make[2]: *** [/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/.compiler_flags] Error 2
makefileCommon/compile.core.mk:205: recipe for target 'Release' failed
make[1]: *** [Release] Error 2
make[1]: Leaving directory '/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project'
/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:126: recipe for target 'Release' failed
make: *** [Release] Error 2
make: Leaving directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'

Should I rename by hand like you said above?

it looks like it is a file permissions issue. The smb.conf file usually solves this

on the RPi side you can try

chmod -R 777 /home/pi/openFrameworks

pi@debian:~$ make -C /media/Data/home/pi/openFrameworks/examples/empty/emptyExample/
make: Entering directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'
HOST_OS=Linux
HOST_ARCH=x86_64
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-3.0 
Compiling OF library for Release
make[1]: Entering directory '/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project'
HOST_OS=Linux
HOST_ARCH=x86_64
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-3.0 
HOST_OS=Linux
HOST_ARCH=x86_64
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk+-3.0 
Compiling /media/Data/home/pi/openFrameworks/libs/openFrameworks/3d/ofMesh.cpp
/opt/cross/bin/arm-linux-gnueabihf-g++ -O3 -DNDEBUG -Wall -std=c++14 -DGCC_HAS_REGEX -march=armv6 -mfpu=vfp -mfloat-abi=hard -fPIC -ftree-vectorize -Wno-psabi -pipe --sysroot=/home/pi/RPI_ROOT -DOF_USING_GTK -DOF_USING_GTK -DTARGET_RASPBERRY_PI -DSTANDALONE -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -I/home/pi/RPI_ROOT/opt/vc/include -I/home/pi/RPI_ROOT/opt/vc/include/IL -I/home/pi/RPI_ROOT/opt/vc/include/interface/vcos/pthreads -I/home/pi/RPI_ROOT/opt/vc/include/interface/vmcs_host/linux -I/home/pi/RPI_ROOT/usr/include/c++/4.9 -D_REENTRANT -pthread -I/home/pi/RPI_ROOT/usr/include/gstreamer-1.0 -I/home/pi/RPI_ROOT/usr/include/AL -I/home/pi/RPI_ROOT/usr/include/alsa -I/home/pi/RPI_ROOT/usr/include/gtk-3.0 -I/home/pi/RPI_ROOT/usr/include/at-spi2-atk/2.0 -I/home/pi/RPI_ROOT/usr/include/at-spi-2.0 -I/home/pi/RPI_ROOT/usr/include/dbus-1.0 -I/home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/home/pi/RPI_ROOT/usr/include/gtk-3.0 -I/home/pi/RPI_ROOT/usr/include/gio-unix-2.0/ -I/home/pi/RPI_ROOT/usr/include/cairo -I/home/pi/RPI_ROOT/usr/include/pango-1.0 -I/home/pi/RPI_ROOT/usr/include/harfbuzz -I/home/pi/RPI_ROOT/usr/include/pango-1.0 -I/home/pi/RPI_ROOT/usr/include/atk-1.0 -I/home/pi/RPI_ROOT/usr/include/cairo -I/home/pi/RPI_ROOT/usr/include/pixman-1 -I/home/pi/RPI_ROOT/usr/include/freetype2 -I/home/pi/RPI_ROOT/usr/include/libpng12 -I/home/pi/RPI_ROOT/usr/include/gdk-pixbuf-2.0 -I/home/pi/RPI_ROOT/usr/include/libpng12 -I/home/pi/RPI_ROOT/usr/include/glib-2.0 -I/home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/media/Data/home/pi/openFrameworks/libs/fmodex/include -I/media/Data/home/pi/openFrameworks/libs/glfw/include -I/media/Data/home/pi/openFrameworks/libs/glfw/include/GLFW -I/media/Data/home/pi/openFrameworks/libs/kiss/include -I/media/Data/home/pi/openFrameworks/libs/poco/include -I/media/Data/home/pi/openFrameworks/libs/tess2/include -I/media/Data/home/pi/openFrameworks/libs/utf8cpp/include -I/media/Data/home/pi/openFrameworks/libs/utf8cpp/include/utf8 -I/media/Data/home/pi/openFrameworks/libs/openFrameworks -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/3d -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/gl -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/sound -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/communication -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/utils -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/types -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/events -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/graphics -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/app -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/video -I/media/Data/home/pi/openFrameworks/libs/openFrameworks/math  -MMD -MP -MF /media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/3d/ofMesh.d -MT/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/3d/ofMesh.o -o /media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/3d/ofMesh.o -c /media/Data/home/pi/openFrameworks/libs/openFrameworks/3d/ofMesh.cpp
In file included from /media/Data/home/pi/openFrameworks/libs/openFrameworks/utils/ofConstants.h:239:0,
                 from /media/Data/home/pi/openFrameworks/libs/openFrameworks/math/ofVec2f.h:5,
                 from /media/Data/home/pi/openFrameworks/libs/openFrameworks/math/ofVec3f.h:3,
                 from /media/Data/home/pi/openFrameworks/libs/openFrameworks/3d/ofMesh.h:7,
                 from /media/Data/home/pi/openFrameworks/libs/openFrameworks/3d/ofMesh.cpp:1:
/home/pi/RPI_ROOT/usr/include/c++/4.9/cstdlib:41:28: fatal error: bits/c++config.h: No such file or directory
 #include <bits/c++config.h>
                            ^
compilation terminated.
makefileCommon/compile.core.mk:239: recipe for target '/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/3d/ofMesh.o' failed
make[2]: *** [/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/3d/ofMesh.o] Error 1
makefileCommon/compile.core.mk:205: recipe for target 'Release' failed
make[1]: *** [Release] Error 2
make[1]: Leaving directory '/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project'
/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:126: recipe for target 'Release' failed
make: *** [Release] Error 2
make: Leaving directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'

/home/pi/RPI_ROOT/usr/include/c++/4.9/cstdlib:41:28: fatal error: bits/c++config.h: No such file or directory

Should have been copied over to the cross-compiler at this point. Does it exist?

Yes, I made this ‘cp -Rv /media/Data/usr/ usr’ command previously. I think the long process finished ok.
The files seems are copied:

   pi@debian:~/RPI_ROOT/usr/include/c++$ ls
    4.9  4.9.2

and:

pi@debian:~/RPI_ROOT/usr/include/c++/4.9$ ls
algorithm  ciso646             cstdio        fenv.h            locale            set           typeindex
array      climits             cstdlib       forward_list      map               shared_mutex  typeinfo
atomic     clocale             cstring       fstream           memory            sstream       type_traits
backward   cmath               ctgmath       functional        mutex             stack         unordered_map
bits       complex             ctime         future            new               stdexcept     unordered_set
bitset     complex.h           cwchar        initializer_list  numeric           streambuf     utility
cassert    condition_variable  cwctype       iomanip           ostream           string        valarray
ccomplex   csetjmp             cxxabi.h      ios               parallel          sun           vector
cctype     csignal             debug         iosfwd            profile           system_error
cerrno     cstdalign           decimal       iostream          queue             tgmath.h
cfenv      cstdarg             deque         istream           random            thread
cfloat     cstdbool            exception     iterator          ratio             tr1
chrono     cstddef             experimental  limits            regex             tr2
cinttypes  cstdint             ext           list              scoped_allocator  tuple

except this one ‘bits/c++config.h’:

pi@debian:~/RPI_ROOT/usr/include/c++/4.9/bits$ ls
algorithmfwd.h             hash_bytes.h             regex_automaton.tcc        stl_multiset.h
allocator.h                hashtable.h              regex_compiler.h           stl_numeric.h
alloc_traits.h             hashtable_policy.h       regex_compiler.tcc         stl_pair.h
atomic_base.h              indirect_array.h         regex_constants.h          stl_queue.h
atomic_lockfree_defines.h  ios_base.h               regex_error.h              stl_raw_storage_iter.h
basic_ios.h                istream.tcc              regex_executor.h           stl_relops.h
basic_ios.tcc              list.tcc                 regex_executor.tcc         stl_set.h
basic_string.h             locale_classes.h         regex.h                    stl_stack.h
basic_string.tcc           locale_classes.tcc       regex_scanner.h            stl_tempbuf.h
boost_concept_check.h      locale_facets.h          regex_scanner.tcc          stl_tree.h
c++0x_warning.h            locale_facets_nonio.h    regex.tcc                  stl_uninitialized.h
c++14_warning.h            locale_facets_nonio.tcc  shared_ptr_base.h          stl_vector.h
char_traits.h              locale_facets.tcc        shared_ptr.h               streambuf_iterator.h
codecvt.h                  localefwd.h              slice_array.h              streambuf.tcc
concept_check.h            mask_array.h             sstream.tcc                stream_iterator.h
cpp_type_traits.h          memoryfwd.h              stl_algobase.h             stringfwd.h
cxxabi_forced.h            move.h                   stl_algo.h                 unique_ptr.h
deque.tcc                  nested_exception.h       stl_bvector.h              unordered_map.h
enable_special_members.h   ostream_insert.h         stl_construct.h            unordered_set.h
exception_defines.h        ostream.tcc              stl_deque.h                uses_allocator.h
exception_ptr.h            parse_numbers.h          stl_function.h             valarray_after.h
forward_list.h             postypes.h               stl_heap.h                 valarray_array.h
forward_list.tcc           predefined_ops.h         stl_iterator_base_funcs.h  valarray_array.tcc
fstream.tcc                ptr_traits.h             stl_iterator_base_types.h  valarray_before.h
functexcept.h              random.h                 stl_iterator.h             vector.tcc
functional_hash.h          random.tcc               stl_list.h
gslice_array.h             range_access.h           stl_map.h
gslice.h                   regex_automaton.h        stl_multimap.h

EDIT: I checked on the same ‘/usr/include/c++/4.9/bits’ Raspberry folder (from where the command copied to the VM) and the file ‘c++config.h’ is not there neither. When I try to compile any project directly on the Raspberry it works fine.

strange. The file is on the RPi but is in

/usr/include/arm-linux-gnueabihf/c++/4.9/bits/c++config.h

I’m not sure what is different with your configuration that it is looking for it in a different place

@moebiussurfing are you using a RPI2?

no, RPI1 B+

In openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk

I would try adding the line

PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/arm-linux-gnueabihf/c++/4.9

after the line
PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/c++/4.9

Thanks. I added this line and the process has been longer, good; but I get this error at the end: (I paste just the last block)

Linking bin/emptyExample for linuxarmv6l
/opt/cross/bin/arm-linux-gnueabihf-g++ -o bin/emptyExample  obj/linuxarmv6l/Release/src/ofApp.o obj/linuxarmv6l/Release/src/main.o  /media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/lib/linuxarmv6l/libopenFrameworks.a   -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -pthread --sysroot=/home/pi/RPI_ROOT -Wl,-rpath=/home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf -Wl,-rpath=/home/pi/RPI_ROOT/lib/arm-linux-gnueabihf -L/home/pi/RPI_ROOT/opt/vc/lib -L/home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf /media/Data/home/pi/openFrameworks/libs/kiss/lib/linuxarmv6l/libkiss.a /media/Data/home/pi/openFrameworks/libs/tess2/lib/linuxarmv6l/libtess2.a  /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoNetSSL.a /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoNet.a /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoCrypto.a /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoUtil.a /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoJSON.a /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoXML.a /media/Data/home/pi/openFrameworks/libs/poco/lib/linuxarmv6l/libPocoFoundation.a  -L/usr/lib/arm-linux-gnueabihf -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -lfreetype -lsndfile -lopenal -lssl -lcrypto -lpulse-simple -lpulse -lasound -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lfreeimage -lrtaudio -lboost_filesystem -lboost_system -lGLESv2 -lGLESv1_CM -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpcre -lrt -lX11 -ldl
/opt/cross/lib/gcc/arm-linux-gnueabihf/4.9.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find crtbegin.o: No such file or directory
/opt/cross/lib/gcc/arm-linux-gnueabihf/4.9.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lstdc++
/opt/cross/lib/gcc/arm-linux-gnueabihf/4.9.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgcc_s
/opt/cross/lib/gcc/arm-linux-gnueabihf/4.9.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:381: recipe for target 'bin/emptyExample' failed
make[1]: *** [bin/emptyExample] Error 1
make[1]: Leaving directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'
/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:126: recipe for target 'Release' failed
make: *** [Release] Error 2
make: Leaving directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'
pi@debian:~$

try adding this line after the last line you added

PLATFORM_LIBRARY_SEARCH_PATHS += $(SYSROOT)/usr/lib/$(GCC_PREFIX)/4.9

1 Like
pi@debian:~$ make -C /media/Data/home/pi/openFrameworks/examples/empty/emptyExample/
make: Entering directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'
HOST_OS=Linux
HOST_ARCH=x86_64
/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/config.shared.mk:201: *** This package doesn't support your platform, probably you downloaded the wrong package?.  Stop.
make: Leaving directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'

That’s the error after adding the line. But now I deleted the line again and do not compiles like before and I get directly this error (the same):

pi@debian:~$ make -C /media/Data/home/pi/openFrameworks/examples/empty/emptyExample/
make: Entering directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'
HOST_OS=Linux
HOST_ARCH=x86_64
/media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/config.shared.mk:201: *** This package doesn't support your platform, probably you downloaded the wrong package?.  Stop.
make: Leaving directory '/media/Data/home/pi/openFrameworks/examples/empty/emptyExample'

So I am very lost, I don’t know if I need to reboot the RPI and VM and retry again after the changes…

The In openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk here you can see how I added the lines:

 SYSROOT=$(RPI_ROOT)

        PLATFORM_CFLAGS += --sysroot=$(SYSROOT)

        PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/c++/4.9
        PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/arm-linux-gnueabihf/c++/4.9

        PLATFORM_LIBRARY_SEARCH_PATHS += $(SYSROOT)/usr/lib/$(GCC_PREFIX)
        PLATFORM_LIBRARY_SEARCH_PATHS += $(SYSROOT)/usr/lib/$(GCC_PREFIX)/4.9

        PLATFORM_LDFLAGS += --sysroot=$(SYSROOT)
        PLATFORM_LDFLAGS += -Wl,-rpath=$(SYSROOT)/usr/lib/$(GCC_PREFIX)
        PLATFORM_LDFLAGS += -Wl,-rpath=$(SYSROOT)/lib/$(GCC_PREFIX)

I would try removing the lines and see what happens if you try and compile OF.

clean it first

make clean -C /media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project

and then

make -C /media/Data/home/pi/openFrameworks/libs/openFrameworksCompiled/project

If you get the same errors try doing the RPI_ROOT copying process again.

1 Like

ok - i just walked through the process again on a different Mac

@moebiussurfing running through it again I got an error during the build_cross_gcc.sh part because gawk wasn’t installed. I am wondering if you have incomplete build tools.

to remedy on the VM run

sudo apt-get install gawk
delete the CROSS_BUILD_TOOLS folder and start at the “Build the Cross Compiler” section

The original post now contains the gawk include. After this I was able to complete all of the steps

1 Like

Hello everyone.

I got a problem when typing : ls -al /media/Data

somehow I cannot access root folders:

ls: /media/Data/sys: Permission denied
ls: /media/Data/boot: Permission denied
ls: /media/Data/srv: Permission denied…

What am I doing wrong? Tried following the tutorial two times :frowning:

That may be ok, does this one work?

ls -al /media/Data/usr

Thank you for your answer.

No,
I didn’t post the full list, because I thought it would be a general problem. Here it is

ls: /media/Data/sys: Permission denied ls: /media/Data/boot: Permission denied ls: /media/Data/srv: Permission denied ls: /media/Data/lost+found: Permission denied ls: /media/Data/root: Permission denied ls: /media/Data/mnt: Permission denied ls: /media/Data/lib: Permission denied ls: /media/Data/media: Permission denied ls: /media/Data/tmp: Permission denied ls: /media/Data/sbin: Permission denied ls: /media/Data/var: Permission denied ls: /media/Data/etc: Permission denied ls: /media/Data/proc: Permission denied ls: /media/Data/run: Permission denied ls: /media/Data/bin: Permission denied ls: /media/Data/opt: Permission denied ls: /media/Data/dev: Permission denied ls: /media/Data/usr: Permission denied ls: /media/Data/home: Permission denied

But when I change it to /home/pi it is working, so I think it’s a root problem. I searched for a solution on how to use samba as root. But I could not find a good answer.

1 Like

does
sudo ls -al /media/Data
make a difference?