Bug#805072: protobuf: FTBFS on sparc64 - apparently tries to build x86 code

2016-05-08 Thread Iustin Pop
On 2015-11-24 11:39:08, Robert Edmonds wrote:
> David Matthew Mattli wrote:
> > So now it checks for either SOLARIS_64BIT_ENABLED or __LP64__ to 
> > determine whether the sparc platform is 64bit. With this change the package
> > builds on my sparc64 system and it shouldn't affect any other archs.
> > 
> > I've attached a patch to implement this change.
> 
> Hi, David:
> 
> Thank you for this patch, but it looks like a very similar patch was
> applied upstream against protobuf 3:
> 
> https://github.com/google/protobuf/pull/780
> 
> (Upstream is no longer developing the 2.x branch.)
> 
> I'm not sure when protobuf 3 is going to hit unstable, but if this bug
> is critical for the sparc64 efforts I think we might be able to make

I'll include this patch in the upcoming 2.6.1-2 upload. Upstream has
rejected that pull request, as they had a different (better?) change to
support sparc64. Given that I don't know all the implications of that
patch
(https://github.com/google/protobuf/commit/97fa4ca1565d216d102af9510b17966c28c7a52a),
I'll just apply this patch until we package 3.x (that commit is included
after 3.0.0 beta 1).

thanks!
iustin


signature.asc
Description: PGP signature


Bug#805072: protobuf: FTBFS on sparc64 - apparently tries to build x86 code

2015-11-24 Thread Robert Edmonds
David Matthew Mattli wrote:
> So now it checks for either SOLARIS_64BIT_ENABLED or __LP64__ to 
> determine whether the sparc platform is 64bit. With this change the package
> builds on my sparc64 system and it shouldn't affect any other archs.
> 
> I've attached a patch to implement this change.

Hi, David:

Thank you for this patch, but it looks like a very similar patch was
applied upstream against protobuf 3:

https://github.com/google/protobuf/pull/780

(Upstream is no longer developing the 2.x branch.)

I'm not sure when protobuf 3 is going to hit unstable, but if this bug
is critical for the sparc64 efforts I think we might be able to make
another 2.6.1 upload.

-- 
Robert Edmonds
edmo...@debian.org



Bug#805072: protobuf: FTBFS on sparc64 - apparently tries to build x86 code

2015-11-21 Thread David Matthew Mattli
Source: protobuf
Followup-For: Bug #805072

Dear Maintainer,

The x86 sources are actually included on every platform. If you look at the
build logs for powerpc for example you can see them being included. The
contents are just preprocessed out everywhere except on intel.

The build is failing because the type 'Atomic64' is not defined. This is
supposed to be defined in src/google/protobuf/stubs/atomicops.h:

#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
// We need to be able to go between Atomic64 and AtomicWord implicitly.  
This
// means Atomic64 and AtomicWord should be the same type on 64-bit.
#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) || 
defined(GOOGLE_PROTOBUF_ARCH_SPARC)
// NaCl's intptr_t is not actually 64-bits on 64-bit!
// http://code.google.com/p/nativeclient/issues/detail?id=1162
// sparcv9's pointer type is 32bits
typedef int64 Atomic64;
#else
typedef intptr_t Atomic64;
#endif
#endif

But it is failing to be defined here because GOOGLE_PROTOBUF_ARCH_64_BIT
is not being defind on Debian/sparc64. GOOGLE_PROTOBUF_ARCH_64_BIT is
supposed to be defined in src/google/protobuf/stubs/platform_macros.h.
Here is the section about sparc:

#elif defined(sparc)
#define GOOGLE_PROTOBUF_ARCH_SPARC 1
#ifdef SOLARIS_64BIT_ENABLED
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
#else
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#endif

So it's checking whether SOLARIS_64BIT_ENABLED is defined to determine
if it's on a 64bit arch. This is not defined on sparc64 linux so 
but instead we can check for __LP64__, making that section into:

#elif defined(sparc)
#define GOOGLE_PROTOBUF_ARCH_SPARC 1
#if defined(SOLARIS_64BIT_ENABLED) || defined(__LP64__)
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
#else
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#endif

So now it checks for either SOLARIS_64BIT_ENABLED or __LP64__ to 
determine whether the sparc platform is 64bit. With this change the package
builds on my sparc64 system and it shouldn't affect any other archs.

I've attached a patch to implement this change.

Thanks!
David


-- System Information:
Debian Release: stretch/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: sparc64

Kernel: Linux 4.3.0-gentoo (SMP w/1 CPU core)
Locale: LANG=en_SG.UTF-8, LC_CTYPE=en_SG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
--- a/src/google/protobuf/stubs/platform_macros.h
+++ b/src/google/protobuf/stubs/platform_macros.h
@@ -67,7 +67,7 @@
 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
 #elif defined(sparc)
 #define GOOGLE_PROTOBUF_ARCH_SPARC 1
-#ifdef SOLARIS_64BIT_ENABLED
+#if defined(SOLARIS_64BIT_ENABLED) || defined(__LP64__)
 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
 #else
 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1


Bug#805072: protobuf: FTBFS on sparc64 - apparently tries to build x86 code

2015-11-14 Thread John Paul Adrian Glaubitz
Source: protobuf
Version: 2.6.1-1.3
Severity: normal

Hello!

We are currently working on bringing Debian's sparc64 port back in shape
and hence are filing bugs against and possibly providing patches which
need additional work.

Unfortunately protobuf is one of them, it fails to build from source:

make[4]: Entering directory '/«PKGBUILDDIR»/src'
g++ -DHAVE_CONFIG_H -I. -I..   -D_FORTIFY_SOURCE=2 -pthread -Wall 
-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare  -g -O2 
-fstack-protector-strong -Wformat -Werror=format-security -c -o 
google/protobuf/compiler/main.o google/protobuf/compiler/main.cc
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   
-D_FORTIFY_SOURCE=2 -pthread -Wall -Wwrite-strings -Woverloaded-virtual 
-Wno-sign-compare  -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -c -o 
google/protobuf/stubs/atomicops_internals_x86_gcc.lo 
google/protobuf/stubs/atomicops_internals_x86_gcc.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -D_FORTIFY_SOURCE=2 -pthread 
-Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 
-fstack-protector-strong -Wformat -Werror=format-security -c 
google/protobuf/stubs/atomicops_internals_x86_gcc.cc  -fPIC -DPIC -o 
google/protobuf/stubs/.libs/atomicops_internals_x86_gcc.o
In file included from ./google/protobuf/stubs/atomicops.h:201:0,
 from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:107:36: error: 
'Atomic64' does not name a type
 inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
^
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:107:51: error: 
'Atomic64' has not been declared
 inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
   ^
./google/protobuf/stubs/atomicops_internals_generic_gcc.h: In function 'void 
google::protobuf::internal::Release_Store(volatile int*, int)':
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:107:13: error: 
redefinition of 'void google::protobuf::internal::Release_Store(volatile int*, 
int)'
 inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
 ^
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:89:13: note: 'void 
google::protobuf::internal::Release_Store(volatile Atomic32*, 
google::protobuf::internal::Atomic32)' previously defined here
 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
 ^
./google/protobuf/stubs/atomicops_internals_generic_gcc.h: At global scope:
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:111:8: error: 
'Atomic64' does not name a type
 inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
^
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:115:8: error: 
'Atomic64' does not name a type
 inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
^
./google/protobuf/stubs/atomicops_internals_generic_gcc.h:123:8: error: 
'Atomic64' does not name a type
 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
^
make[4]: *** [google/protobuf/stubs/atomicops_internals_x86_gcc.lo] Error 1
Makefile:2071: recipe for target 
'google/protobuf/stubs/atomicops_internals_x86_gcc.lo' failed

It appears that protobuf does not detect the host architecture properly and
seems to try compile code which is supposed to be used on x86 only, but I am
not sure.

Full build log in [1].

Adrian

> [1] 
> https://buildd.debian.org/status/fetch.php?pkg=protobuf=sparc64=2.6.1-1.3=1447501050

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913