[solved] OF 0.9-13706 Compilation Errors on Raspberry PI B

Hi!

I’ve some problems compiling OF on a ARMv6 PI:
Thanks in advance!

Branch: Master (github via svn)
Revision: 13706.
OS: Raspbian GNU/Linux 7
ARCH: armv6l
GCC: 4.6.3 (Debian 4.6.3-14+rpi1)

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 libmpg123 
Compiling ../../../libs/openFrameworks/communication/ofSerial.cpp
g++ -O3 -Wall -std=c++0x -march=armv6 -mfpu=vfp -mfloat-abi=hard -fPIC -ftree-vectorize -Wno-psabi -pipe -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_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 -DUSE_DISPMANX_TRANSFORM_T -I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -pthread -D_REENTRANT -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gstreamer-1.0 -I/usr/include/alsa -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/harfbuzz -I../../../libs/fmodex/include -I../../../libs/glfw/include -I../../../libs/glfw/include/GLFW -I../../../libs/kiss/include -I../../../libs/poco/include -I../../../libs/tess2/include -I../../../libs/openFrameworks -I../../../libs/openFrameworks/communication -I../../../libs/openFrameworks/app -I../../../libs/openFrameworks/sound -I../../../libs/openFrameworks/math -I../../../libs/openFrameworks/events -I../../../libs/openFrameworks/utils -I../../../libs/openFrameworks/video -I../../../libs/openFrameworks/graphics -I../../../libs/openFrameworks/3d -I../../../libs/openFrameworks/gl -I../../../libs/openFrameworks/types  -MMD -MP -MF ../../../libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.d -MT../../../libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.o -o ../../../libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.o -c ../../../libs/openFrameworks/communication/ofSerial.cpp
In file included from ../../../libs/openFrameworks/communication/ofSerial.h:4:0,
                 from ../../../libs/openFrameworks/communication/ofSerial.cpp:1:
../../../libs/openFrameworks/types/ofTypes.h:18:18: error: 'shared_ptr' is already declared in this scope
../../../libs/openFrameworks/types/ofTypes.h:19:18: error: 'weak_ptr' is already declared in this scope
../../../libs/openFrameworks/types/ofTypes.h:20:18: error: 'enable_shared_from_this' is already declared in this scope
In file included from ../../../libs/poco/include/Poco/Foundation.h:148:0,
                 from ../../../libs/poco/include/Poco/Mutex.h:23,
                 from ../../../libs/openFrameworks/types/ofTypes.h:99,
                 from ../../../libs/openFrameworks/communication/ofSerial.h:4,
                 from ../../../libs/openFrameworks/communication/ofSerial.cpp:1:
../../../libs/poco/include/Poco/Bugcheck.h:151:24: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
makefileCommon/compile.core.mk:232: recipe for target '../../../libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.o' failed
make[2]: *** [../../../libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.o] Error 1
makefileCommon/compile.core.mk:203: recipe for target 'Release' failed
1 Like

Hi @MHi I just ran into this today too on both RPi1 and RPi2. I believe this is a compiler settings issue around c++11 – but haven’t had a chance to dig into it. @arturo – I’m happy to track this issue down and fix it (I need to do it to test the new Poco libs anyway) – do you have a tip on where we should look or any recent activity that would have caused the issue? Could it just be a compiler flags issue – or perhaps we need to double check the preprocessor statements to make sure they are compatible w/ c++11 on the RPis?

@MHi can you post this as an official issue on github and we’ll track it from there? (also link back here for reference if you would … ) thanks!

that’s really strange seems like the compile was defining __cplusplus<201103L can you check what’s the value of that define, you can cout << __cplusplus. if it’s really less than 2011 perhaps try changing -std=c++0x with -std=c++11 we are still using c++0x cause some old platforms still use ubuntu 12.04 but i guess we can update the raspberry pi to c++11

Hi!

thanks a lot for the quick repsonses!

@arturo : So I used the same command line as before to compile the small test.cpp. I hope this was right and helps. (output see below.)
According to gnu.org, gcc 4.7 and later support -std=c++11 - but raspbian/stable still ships with version 4.6.3 (Debian 4.6.3-14+rpi1).
So I could not try compiling with -std=c++11 (“unrecognized command line option ‘-std=c++11’”)
Would it help to switch to a newer Version of gcc?

Thanks again, greets Michael.

cat test.cpp

#include <iostream>

int main()
{
        std::cout << std::endl << __cplusplus << std::endl;
        return 0;
}

g++ -O3 -Wall -std=c++0x -march=armv6 -mfpu=vfp -mfloat-abi=hard -fPIC -ftree-vectorize -Wno-psabi -pipe -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_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 -DUSE_DISPMANX_TRANSFORM_T -I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -pthread -D_REENTRANT -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gstreamer-1.0 -I/usr/include/alsa -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/harfbuzz -I…/…/…/libs/fmodex/include -I…/…/…/libs/glfw/include -I…/…/…/libs/glfw/include/GLFW -I…/…/…/libs/kiss/include -I…/…/…/libs/poco/include -I…/…/…/libs/tess2/include -I…/…/…/libs/openFrameworks -I…/…/…/libs/openFrameworks/communication -I…/…/…/libs/openFrameworks/app -I…/…/…/libs/openFrameworks/sound -I…/…/…/libs/openFrameworks/math -I…/…/…/libs/openFrameworks/events -I…/…/…/libs/openFrameworks/utils -I…/…/…/libs/openFrameworks/video -I…/…/…/libs/openFrameworks/graphics -I…/…/…/libs/openFrameworks/3d -I…/…/…/libs/openFrameworks/gl -I…/…/…/libs/openFrameworks/types -MMD -MP -MF …/…/…/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.d -MT…/…/…/libs/openFrameworksCompiled/lib/linuxarmv6l/obj/Release/libs/openFrameworks/communication/ofSerial.o -o test test.cpp

./test

1

Always thought raspbians’ metapackages - in this case “g++”, would always select a current version.
But actually ist install 4.6 while there is a g++4.8 in stable release as well.

Updating to this compiler version fixed this problem.
Compiling all of OF will still take a while on the RaspberryPI but everything seems to be fine so far.

I’m so sorry about spending your time with such a stupid mistake!

Pretty sure this topic can be closed!

Greets MHi.

Well - perhaps we need to update the install-dependencies file? I don’t think it was a stupid mistake :smile: @arturo what do you think?

I always use the 4.8 version to achieve a correct compilation on RPI1 and Raspbian and

-std=c++11

as expected.

1 Like