[Buildroot] [PATCH v3] protobuf: fix build for some unsupported architectures

Baruch Siach baruch at tkos.co.il
Thu May 8 20:48:50 UTC 2014


Hi Peter,

On Thu, May 08, 2014 at 09:46:27PM +0200, Peter Korsgaard wrote:
> >>>>> "Baruch" == Baruch Siach <baruch at tkos.co.il> writes:
> 
>  > Add patches for making use of generic gcc atomic operations for unknown
>  > architectures. Patches taken from
>  > http://code.google.com/p/protobuf/issues/detail?id=488 .
> 
>  > Disable build for architectures that are not supported.
> 
>  > Fixes:
>  > http://autobuild.buildroot.net/results/7e5/7e5791225334096206887de8a38fd947e1f8e9a2/
>  > http://autobuild.buildroot.net/results/cf1/cf147b9188d6787a6a1a6072bf9bc6f7ddf5e5ae/
> 
>  > Cc: Phil Eichinger <phil.eichinger at gmail.com>
>  > Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> 
> Thanks, but a quick test with powerpc and the default external toolchain
> doesn't build:
> 
> BR2_powerpc=y
> BR2_powerpc_603e=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_PACKAGE_PROTOBUF=y
> 
> In file included from ./google/protobuf/stubs/atomicops.h:188:0,
>                  from ./google/protobuf/stubs/once.h:81,
>                  from google/protobuf/stubs/once.cc:38:
> ./google/protobuf/stubs/atomicops_internals_generic_gcc.h: In function 'google::protobuf::internal::Atomic32 google::protobuf::internal::NoBarrier_CompareAndSwap(volatile google::protobuf::internal::Atomic32*, google::protobuf::internal::Atomic32, google::protobuf::internal::Atomic32)':
> ./google/protobuf/stubs/atomicops_internals_generic_gcc.h:44:31: error: '__ATOMIC_RELAXED' was not declared in this scope
> ./google/protobuf/stubs/atomicops_internals_generic_gcc.h:44:65: error: '__atomic_compare_exchange_n' was not declared in this scope
> ./google/protobuf/stubs/atomicops_internals_generic_gcc.h: In function 'google::protobuf::internal::Atomic32 google::protobuf::internal::NoBarrier_AtomicExchange(volatile google::protobuf::internal::Atomic32*, google::protobuf::internal::Atomic32)':
> 
> So it looks like we need to tweak the arch list a bit.

The generic internal atomic ops implementation (which is used to fix powerpc 
build) is using the gcc feature of "memory model aware atomic operations". 
These were introduced in gcc 4.7, while the Sourcery toolchain is gcc 4.5. I 
don't see a straightforward way to depend on gcc version like we have for 
kernel headers. Any ideas?

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the buildroot mailing list