Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Raspberry pi compilation errors

Zoltan_F_
Beginner
1,299 Views

After downloading latest source (4.2 update 2) and adding CPLUS_FLAG:

CPLUS_FLAGS=-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

I receive the next errors when trying to compile on Raspberry Pi:

Created ./build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_release and ..._debug directories
/usr/bin/make -C "./build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_debug"  -r -f ../../build/Makefile.tbb cfg=debug
make[1]: Entering directory `/home/ilagi/ros_catkin_ws/external_src/tbb42_20131118oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_debug'
../../build/Makefile.tbb:40: CONFIG: cfg=debug arch=armv7 compiler=gcc target=linux runtime=cc4.6_libc2.13_kernel2.6.32
g++ -o pipeline.o -c -MMD -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0 -fPIC -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-non-virtual-dtor    -I../../src -I../../src/rml/include -I../../include ../../src/tbb/pipeline.cpp
In file included from ../../src/tbb/tls.h:35:0,
                 from ../../src/tbb/pipeline.cpp:34:
../../include/tbb/machine/windows_api.h:84:2: error: #error tbb/machine/windows_api.h should only be used for Windows based platforms
In file included from ../../src/tbb/pipeline.cpp:34:0:
../../src/tbb/tls.h:57:13: error: 'DWORD' does not name a type
../../src/tbb/tls.h:84:5: error: 'tls_key_t' does not name a type
../../src/tbb/tls.h: In member function 'int tbb::internal::basic_tls<T>::create()':
../../src/tbb/tls.h:61:9: error: 'tls_key_t' was not declared in this scope
../../src/tbb/tls.h:61:19: error: expected ';' before 'tmp'
../../src/tbb/tls.h:62:13: error: 'tmp' was not declared in this scope
../../src/tbb/tls.h:62:18: error: 'TLS_OUT_OF_INDEXES' was not declared in this scope
../../src/tbb/tls.h:64:9: error: 'my_key' was not declared in this scope
../../src/tbb/tls.h:64:18: error: 'tmp' was not declared in this scope
../../src/tbb/tls.h: In member function 'int tbb::internal::basic_tls<T>::destroy()':
../../src/tbb/tls.h:67:35: error: 'my_key' was not declared in this scope
../../src/tbb/tls.h:67:41: error: there are no arguments to 'TlsFree' that depend on a template parameter, so a declaration of 'TlsFree' must be available [-fpermissive]
../../src/tbb/tls.h:67:41: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../src/tbb/tls.h: In member function 'void tbb::internal::basic_tls<T>::set(T)':
../../src/tbb/tls.h:68:39: error: 'my_key' was not declared in this scope
../../src/tbb/tls.h:68:48: error: 'LPVOID' was not declared in this scope
../../src/tbb/tls.h:68:60: error: there are no arguments to 'TlsSetValue' that depend on a template parameter, so a declaration of 'TlsSetValue' must be available [-fpermissive]
../../src/tbb/tls.h: In member function 'T tbb::internal::basic_tls<T>::get()':
../../src/tbb/tls.h:69:49: error: 'my_key' was not declared in this scope
../../src/tbb/tls.h:69:55: error: there are no arguments to 'TlsGetValue' that depend on a template parameter, so a declaration of 'TlsGetValue' must be available [-fpermissive]
../../src/tbb/tls.h: In member function 'int tbb::internal::basic_tls<T>::destroy() [with T = int]':
../../src/tbb/pipeline.cpp:238:67:   instantiated from here
../../src/tbb/tls.h:67:27: error: 'TlsFree' was not declared in this scope
../../src/tbb/tls.h: In member function 'T tbb::internal::basic_tls<T>::get() [with T = int]':
../../src/tbb/pipeline.cpp:239:62:   instantiated from here
../../src/tbb/tls.h:69:55: error: 'TlsGetValue' was not declared in this scope
../../src/tbb/tls.h: In member function 'void tbb::internal::basic_tls<T>::set(T) [with T = int]':
../../src/tbb/pipeline.cpp:240:60:   instantiated from here
../../src/tbb/tls.h:68:27: error: 'TlsSetValue' was not declared in this scope
../../src/tbb/tls.h: In member function 'T tbb::internal::basic_tls<T>::get() [with T = int]':
../../src/tbb/tls.h:69:58: warning: control reaches end of non-void function [-Wreturn-type]
make[1]: *** [pipeline.o] Error 1
make[1]: Leaving directory `/home/ilagi/ros_catkin_ws/external_src/tbb42_20131118oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_debug'
make: *** [tbb] Error 2

 

 

0 Kudos
1 Solution
Vladimir_P_1234567890
1,300 Views

Somehow USE_PTHREAD was not defined. I guess you need to change

CPLUS_FLAGS=-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

to

CPLUS_FLAGS+=-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

So for example for release configuration CPLUS_FLAGS in linux.gcc.inc should be like:

CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

I was able to build tbb using following toolchain

http://gnutoolchains.com/raspberry/

i'm not sure that it works since i do not have HW but it was compiled successfully on windows using following command

gnumake tbb_os=linux runtime=qq arch=armv7 tbb

hope this helps,
--Vladimir

View solution in original post

0 Kudos
10 Replies
Vladimir_P_1234567890
1,301 Views

Somehow USE_PTHREAD was not defined. I guess you need to change

CPLUS_FLAGS=-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

to

CPLUS_FLAGS+=-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

So for example for release configuration CPLUS_FLAGS in linux.gcc.inc should be like:

CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0

I was able to build tbb using following toolchain

http://gnutoolchains.com/raspberry/

i'm not sure that it works since i do not have HW but it was compiled successfully on windows using following command

gnumake tbb_os=linux runtime=qq arch=armv7 tbb

hope this helps,
--Vladimir

0 Kudos
Zoltan_F_
Beginner
1,300 Views

Hi Vladimir,

Thanks, you are right, I should have realized that I need to use += as clearly those flags need to be added and not replacing any flags which were already there. Thanks for that, now it started to compile but I still got a failure later - see below error message.

Regarding compiling for Raspberry, actually you don't need the HW, just like you use the toolchain in Window I'm using ARM emulation in linux to compile on my laptop to the Raspberry's SD card directly - it makes compiling a whole lot faster. If you are interested below is a description on how to crosscompile for Raspberry Pi:

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=8478

 

Unfortunately I still get the below error:

 

 

make[1]: Leaving directory `/home/ilagi/ros_catkin_ws/external_src/tbb42_20131118oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_release'
/usr/bin/make -C "./build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_debug"  -r -f ../../build/Makefile.tbbmalloc cfg=debug malloc
make[1]: Entering directory `/home/ilagi/ros_catkin_ws/external_src/tbb42_20131118oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_debug'
g++ -c -MMD -DTBB_USE_DEBUG  -g -O0 -DUSE_PTHREAD -Wa,-mimplicit-it=thumb    -fno-rtti -fno-exceptions -fno-schedule-insns2 -D__TBBMALLOC_BUILD=1 -Wno-parentheses -Wno-non-virtual-dtor -fPIC -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../src/tbbmalloc/backend.cpp
In file included from ../../include/tbb/tbb_machine.h:252:0,
                 from ../../src/tbbmalloc/Customize.h:40,
                 from ../../src/tbbmalloc/TypeDefinitions.h:66,
                 from ../../src/tbbmalloc/tbbmalloc_internal.h:33,
                 from ../../src/tbbmalloc/backend.cpp:31:
../../include/tbb/machine/gcc_armv7.h:39:2: error: #error compilation requires an ARMv7-a architecture.
make[1]: *** [backend.o] Error 1
make[1]: Leaving directory `/home/ilagi/ros_catkin_ws/external_src/tbb42_20131118oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel2.6.32_debug'
make: *** [tbbmalloc] Error 2

 

0 Kudos
Vladimir_P_1234567890
1,299 Views

somehow new CPLUS_FLAGS was not propagated to the allocator build. I see as the same error as previous post regarding RPI (http://software.intel.com/en-us/forums/topic/489583). Have you changed CPLUS_FLAGS in  linux.gcc.inc file? both release and debug configs ( I guess lines 72 and 75  linux.gcc.inc) ?

BTW you should have already libtbb.so.2 and libtbb.so files (Intel TBB library itself)

--Vladimir

0 Kudos
Zoltan_F_
Beginner
1,299 Views

Thanks Vladimir, you are right - again.

I have only added the CPLUS_FLAGS to the Makefile.tbb and forgot about the linux.gcc.inc . I have added it to there too (both lines 72 and 75) and no it compiles with no error!

Thank you for your help!!!!!

0 Kudos
Vladimir_P_1234567890
1,299 Views

Welcome,

please reply whether it works or not when you actually run tbb on RPI :)

--Vladimir

0 Kudos
Zoltan_F_
Beginner
1,299 Views

Actually I'm building ROS (Robot Operating System) on Raspberry (see http://wiki.ros.org/hydro/Installation/Debian) which requires Gazebo, which uses tbb, but there is no tbb packages on RPI, so I had to compile it myself - which is why all the questions regarding compiling tbb on RPI.

Now I can progress with the installation of ROS and will let you know whether succeeded or not.

 

0 Kudos
Anton_M_Intel
Employee
1,299 Views

BTW, it's better to use normal CXXFLAGS for supplying of additional compiler options.

e.g.

$ make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"

0 Kudos
Rafael_R_1
Beginner
1,299 Views

Hi,

I compiled tbb and executed tbbvars.sh in relase folder.
But OpenCV not found the tbb.
In cmake the response is tbb not found.

What do I need to run?

Tks

0 Kudos
Vladimir_P_1234567890
1,300 Views

Hello, Rafael,

Have you sourced tbbvars.sh or just executed? tbbvars.sh should be sourced.

--Vladimir

0 Kudos
Rafael_R_1
Beginner
1,300 Views

Hi Vladimir,

I included source command in ~/.bashrc.

I create many links, but dont work:
/opt/intel/tbb/include ->  /home/pi/tbb43_20150424oss/include
/opt/intel/tbb/lib -> /home/pi/tbb43_20150424oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release/
/usr/lib/libtbb.so -> /home/pi/tbb43_20150424oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release/libtbb.so
/usr/lib/libtbb.so.2 -> /home/pi/tbb43_20150424oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release/libtbb.so.2
/lib/libtbb.so -> /home/pi/tbb43_20150424oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release/libtbb.so
/lib/libtbb.so.2 -> /home/pi/tbb43_20150424oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release/libtbb.so.2

Nothing!
OpenCV dont found.

I am used RaspBerry PI 2.

Tks for help.

Rafael

0 Kudos
Reply