Error cross-compiling OF 0.10 for Stretch with Vagrant and Debian

#1

Hello everyone,

I’m trying to update the cross-compiling Vagrant VM setup that can be found here for OF 0.10 and Stretch/arm6 and running into a weird problem.
I’m using the latest build_cross_gcc.sh script from jvcleave and have followed a few other guides, including this one:https://forum.openframeworks.cc/t/cross-compile-of-0-10-for-raspberry-pi-armv6-guide/31733
I can get through all the steps and am able to compile a simple test c++ code but when trying to compile an OF example, I get the following error

detected cross compiling 1
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 libcurl glfw3 rtaudio gtk+-3.0 libmpg123
with PKG_CONFIG_LIBDIR=/opt/raspberrypi/root/usr/lib/pkgconfig:/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/pkgconfig:/opt/raspberrypi/root/usr/share/pkgconfig
Compiling OF library for Release
make[1]: Entering directory '/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/project'
HOST_OS=Linux
detected cross compiling 1
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 libcurl glfw3 rtaudio gtk+-3.0 libmpg123
with PKG_CONFIG_LIBDIR=/opt/raspberrypi/root/usr/lib/pkgconfig:/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/pkgconfig:/opt/raspberrypi/root/usr/share/pkgconfig
HOST_OS=Linux
detected cross compiling 1
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 libcurl glfw3 rtaudio gtk+-3.0 libmpg123
with PKG_CONFIG_LIBDIR=/opt/raspberrypi/root/usr/lib/pkgconfig:/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/pkgconfig:/opt/raspberrypi/root/usr/share/pkgconfig
Compiling /opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/utils/ofSystemUtils.cpp
ccache /opt/cross/bin/arm-linux-gnueabihf-g++ -O3 -DNDEBUG -Wall -Werror=return-type -std=c++11 -march=armv6 -mfpu=vfp -mfloat-abi=hard -fPIC -ftree-vectorize -Wno-psabi -pipe --sysroot=/opt/raspberrypi/root -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -DTARGET_RASPBERRY_PI -DSTANDALONE -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -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/opt/raspberrypi/root/opt/vc/include -I/opt/raspberrypi/root/opt/vc/include/IL -I/opt/raspberrypi/root/opt/vc/include/interface/vcos/pthreads -I/opt/raspberrypi/root/opt/vc/include/interface/vmcs_host/linux -I/opt/raspberrypi/root/usr/include/c++/4.9 -I/opt/raspberrypi/root/usr/include/arm-linux-gnueabihf/c++/4.9 -pthread -D_REENTRANT -pthread -I/opt/raspberrypi/root/usr/include/gstreamer-1.0 -I/opt/raspberrypi/root/usr/include/AL -I/opt/raspberrypi/root/usr/include/arm-linux-gnueabihf -I/opt/raspberrypi/root/usr/include/rtaudio -I/opt/raspberrypi/root/usr/include/alsa -I/opt/raspberrypi/root/usr/include/gtk-3.0 -I/opt/raspberrypi/root/usr/include/at-spi2-atk/2.0 -I/opt/raspberrypi/root/usr/include/at-spi-2.0 -I/opt/raspberrypi/root/usr/include/dbus-1.0 -I/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/opt/raspberrypi/root/usr/include/gtk-3.0 -I/opt/raspberrypi/root/usr/include/gio-unix-2.0/ -I/opt/raspberrypi/root/usr/include/cairo -I/opt/raspberrypi/root/usr/include/pango-1.0 -I/opt/raspberrypi/root/usr/include/harfbuzz -I/opt/raspberrypi/root/usr/include/pango-1.0 -I/opt/raspberrypi/root/usr/include/atk-1.0 -I/opt/raspberrypi/root/usr/include/cairo -I/opt/raspberrypi/root/usr/include/pixman-1 -I/opt/raspberrypi/root/usr/include/freetype2 -I/opt/raspberrypi/root/usr/include/libpng16 -I/opt/raspberrypi/root/usr/include/gdk-pixbuf-2.0 -I/opt/raspberrypi/root/usr/include/libpng16 -I/opt/raspberrypi/root/usr/include/glib-2.0 -I/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/opt/raspberrypi/root/opt/openframeworks/libs/fmodex/include -I/opt/raspberrypi/root/opt/openframeworks/libs/glm/include -I/opt/raspberrypi/root/opt/openframeworks/libs/glm/include/glm -I/opt/raspberrypi/root/opt/openframeworks/libs/glm/include/glm/simd -I/opt/raspberrypi/root/opt/openframeworks/libs/glm/include/glm/detail -I/opt/raspberrypi/root/opt/openframeworks/libs/glm/include/glm/gtc -I/opt/raspberrypi/root/opt/openframeworks/libs/glm/include/glm/gtx -I/opt/raspberrypi/root/opt/openframeworks/libs/json/include -I/opt/raspberrypi/root/opt/openframeworks/libs/kiss/include -I/opt/raspberrypi/root/opt/openframeworks/libs/tess2/include -I/opt/raspberrypi/root/opt/openframeworks/libs/utf8/include -I/opt/raspberrypi/root/opt/openframeworks/libs/utf8/include/utf8 -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/utils -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/events -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/graphics -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/types -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/video -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/3d -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/math -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/app -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/sound -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/communication -I/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/gl  -MMD -MP -MF /opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/utils/ofSystemUtils.d -MT/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/utils/ofSystemUtils.o -o /opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/utils/ofSystemUtils.o -c /opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/utils/ofSystemUtils.cpp
In file included from /opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/utils/ofSystemUtils.cpp:2:0:
/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworks/utils/ofConstants.h:268:18: fatal error: cstdio: No such file or directory
 #include <cstdio>
                  ^
compilation terminated.
makefileCommon/compile.core.mk:238: recipe for target '/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/utils/ofSystemUtils.o' failed
make[2]: *** [/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/utils/ofSystemUtils.o] Error 1
makefileCommon/compile.core.mk:204: recipe for target 'Release' failed
make[1]: *** [Release] Error 2
make[1]: Leaving directory '/opt/raspberrypi/root/opt/openframeworks/libs/openFrameworksCompiled/project'
../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:124: recipe for target 'Release' failed
make: *** [Release] Error 2

To me, that looks like the compiler somehow is compiling project as C instead of C++, but the compiler is correct (/opt/cross/bin/arm-linux-gnueabihf-g++) and cross-compilation is detected. I’ve tried poking around OF makefile and various config files for the make, but no luck so far.

Anyone see this before? any ideas?

P.S. My setup can be found here https://github.com/eshkrab/rpi-build-and-boot

#2

This doesn’t seem to prevent anyone else from having RPi cross compilers, but could someone possibly explain why the PLATFORM_LIBRARY_SEARCH_PATHS for linuxarmv6l are hardcoded to be 4.9 in config.linuxarmv6l.default.mk if the gcc version nowadays is 6.3?