Skip to contentSkip to conversation

protobuf: fix build for some unsupported architectures

PATCH Superseded Baruch Siach 2 participants 5 messages May 8, 2014 – May 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 protobuf: fix build for some unsupported architectures

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 <[email protected]>

---
v3:
Propagate dependencies.

v2:
List supported architectures as dependencies, as this list is much shorter than the list of unsupported archs.

---
 package/ola/Config.in                              |   5 +
 package/protobuf/Config.in                         |   4 +
 ...generic-GCC-support-for-atomic-operations.patch | 214 +++++++++++++++++++++
 ...-02-Add-generic-gcc-header-to-Makefile.am.patch |  31 +++
 package/protobuf/protobuf.mk                       |   2 +
 5 files changed, 256 insertions(+)
 create mode 100644 package/protobuf/protobuf-01-Add-generic-GCC-support-for-atomic-operations.patch
 create mode 100644 package/protobuf/protobuf-02-Add-generic-gcc-header-to-Makefile.am.patch
package/ola/Config.in +5 -0
index eb24a3a07cb1..c0fdedf465e3 100644
@@ -1,5 +1,7 @@
 comment "ola needs a toolchain w/ C++, threads, largefile, wchar"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_x86_64 || BR2_i386 || BR2_arm || BR2_aarch64 || \
+		BR2_mipsel || BR2_powerpc
 
 config BR2_PACKAGE_OLA
 	bool "ola (open lighting architecture)"
@@ -10,6 +12,9 @@ config BR2_PACKAGE_OLA
 	depends on BR2_LARGEFILE # util-linux
 	depends on BR2_USE_WCHAR # util-linux
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	# protobuf
+	depends on BR2_x86_64 || BR2_i386 || BR2_arm || BR2_aarch64 || \
+		BR2_mipsel || BR2_powerpc
 	help
 	  Open Lighting Architecture provides applications
 	  with a mechanism to send and receive DMX512 & RDM
package/protobuf/Config.in +4 -0
index a4f542e0fce1..98e0d398e949 100644
@@ -2,6 +2,8 @@ config BR2_PACKAGE_PROTOBUF
 	bool "protobuf"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_x86_64 || BR2_i386 || BR2_arm || BR2_aarch64 || \
+	    BR2_mipsel || BR2_powerpc
 	help
 	  Protocol buffers are Google's language-neutral, platform-neutral,
 	  extensible mechanism for serializing structured data.
@@ -9,4 +11,6 @@ config BR2_PACKAGE_PROTOBUF
 	  http://code.google.com/p/protobuf/
 
 comment "protobuf needs a toolchain w/ C++, threads"
+	depends on BR2_x86_64 || BR2_i386 || BR2_arm || BR2_aarch64 || \
+	    BR2_mipsel || BR2_powerpc
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
package/protobuf/protobuf-01-Add-generic-GCC-support-for-atomic-operations.patch new file +214 -0

214 lines not on this page · raw message

package/protobuf/protobuf-02-Add-generic-gcc-header-to-Makefile.am.patch new file +31 -0
new file mode 100644
index 000000000000..c53c98a36f57
@@ -0,0 +1,31 @@
+From b53d00e42cdc4a4b57e31d58244cb46b3b05bd6a Mon Sep 17 00:00:00 2001
+From: Stanislav Ochotnicky <[email protected]>
+Date: Thu, 16 May 2013 12:01:10 +0200
+Subject: [PATCH] Add generic gcc header to Makefile.am
+
+This way it will get included properly during installation and
+distribution generation
+
+Patch source: Issue #488
+(http://code.google.com/p/protobuf/issues/detail?id=488)
+
+Signed-off-by: Baruch Siach <[email protected]>
+---
+ src/Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 4069603..2458ceb 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -42,6 +42,7 @@ nobase_include_HEADERS =                                        \
+   google/protobuf/stubs/atomicops_internals_arm_gcc.h           \
+   google/protobuf/stubs/atomicops_internals_arm_qnx.h           \
+   google/protobuf/stubs/atomicops_internals_atomicword_compat.h \
++  google/protobuf/stubs/atomicops_internals_generic_gcc.h       \
+   google/protobuf/stubs/atomicops_internals_macosx.h            \
+   google/protobuf/stubs/atomicops_internals_mips_gcc.h          \
+   google/protobuf/stubs/atomicops_internals_pnacl.h             \
+-- 
+1.8.1.4
+
package/protobuf/protobuf.mk +2 -0
index ceb64dfa63fb..04da975a2452 100644
@@ -12,6 +12,8 @@ PROTOBUF_LICENSE_FILES = COPYING.txt
 # N.B. Need to use host protoc during cross compilation.
 PROTOBUF_DEPENDENCIES = host-protobuf
 PROTOBUF_CONF_OPT = --with-protoc=$(HOST_DIR)/usr/bin/protoc
+# Patching Makefile.am
+PROTOBUF_AUTORECONF = YES
 
 PROTOBUF_INSTALL_STAGING = YES
 
Signature · 1 line
2.0.0.rc0
#1 lore raw

PATCH v3 1/1 protobuf: fix build for some unsupported architectures

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> 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 .

Quoted 8 lines

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 <[email protected]>

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.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v3 1/1 protobuf: fix build for some unsupported architectures

Hi Peter,

Quoted 24 lines · Peter Korsgaard
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> 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 .

Quoted 8 lines

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 <[email protected]>

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,

Quoted 8 lines
                 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

Signature · 3 lines
     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 -
#3 lore raw

PATCH v3 1/1 protobuf: fix build for some unsupported architectures

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

Hi,

Quoted 7 lines
Quoted 1 line

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?

Hmm, not really - No :/ So that makes the patch less interesting :/

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH v3 1/1 protobuf: fix build for some unsupported architectures

Hi Peter,

Quoted 11 lines · Peter Korsgaard
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

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?

Hmm, not really - No :/ So that makes the patch less interesting :/

OK. So we are only left with x86, ARM and MIPS.

BTW, how do we handle host architecture dependencies? This is applicable to
http://autobuild.buildroot.net/results/20b/20b1d279b12176c0dcbaa8b5f170f6c8a55eb6da/
(PowerPC host).

baruch

Signature · 3 lines
     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 -