delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/02/16/15:47:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=ri
KVZErvgN4mh59XMx2cCXD5szyxzUO+dT9ujOa0aGTydrmVFUjz+GoxFScJA7z7pN
H4ds6ZyhIkgUusHUBdaX49G7wt4wY3NhkyPEIC20+BzBzXz5OMgqvJmcdyaQNjqx
Xb2eKuQgi7kg2rZf5/PlmAmRk4KNXfkDc7QgaubVU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=r/jdKCOr
PVx1iWa+CJHn/urfMO4=; b=LcZJ1BD12I75q5sJ5TuBakMGQ3QaroczTKzvy/CX
EEoQvH7pu0z7SgxQvyKlCc7vz6dVAqkuud5nwRoago5FEI8zNiaWzqVN5SV1Vvxd
txEhhI8wh5qNByA7uo9qRVV9cgcGPGipSOhgIqYTPjqEW0TCTmt55o5GbSGh5icf
IHs=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=downloading, addon, add-on, interaction
X-HELO: mail-vk0-f52.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Ahw2jrG08SYXmtvnPG3F0Qa44Yq1DSdKicrYE/ubSLA=; b=BwT14CfLfAeda9l246QKUCuiDkwJR8lhtKrEMnyZOCFS5tt/Vd1VVtkYlkPmWuzZ19 Eo3kgmP2RqjpnY0PtTwvZPyBriM8vAt1q40/vqviJkKTLa9RotkdpoNiiHlODzXKQpz4 krwadtML0+PJBXhROJkjBz67HdIqM8ul4thrH1dLnIcAexZ7j/V5R8FS0SXwRnQ2tbLr LxWy6kuTdRn33qkZWGLe+T+8k3/G4+X8RmnT9lyalJRQwzKQx+Z7QSprcnwBi7XGOaKE g/Jfo/rgdX1np3CQA82f/IYcUk3ZLMUb8ZxJGLXseiKfanpF7mUamSld4idSKGEie1Ub wuVw==
X-Gm-Message-State: AG10YORuLGKOk6WyJsymhpg4wGVqIfPy4OmHI1hw646PfdXYafoupSwD0NvRa4MG9gFcjamHDn4VytTqoYoeVg==
MIME-Version: 1.0
X-Received: by 10.31.45.143 with SMTP id t137mr19485263vkt.143.1455655618988; Tue, 16 Feb 2016 12:46:58 -0800 (PST)
In-Reply-To: <CAPqrHhqeBD1ho_CFjUTHT+NbZnftrKJ0Qj9+OEuXBMf2BWU2Xw@mail.gmail.com>
References: <CAPqrHhp4haccefOLiD56cR-e5OXOrfpeNH7V__km7CPpN2sdOA AT mail DOT gmail DOT com> <CAPqrHhodtegz8sDm4jzX=2dko3AcT8wWbw+dW5w+XAH4Js-M1g AT mail DOT gmail DOT com> <CAPqrHhqeBD1ho_CFjUTHT+NbZnftrKJ0Qj9+OEuXBMf2BWU2Xw AT mail DOT gmail DOT com>
Date: Tue, 16 Feb 2016 12:46:58 -0800
Message-ID: <CAPqrHhrUqpGjzf_BT3mAQuOWS=5h6Oy+Kh5iciee7JupotmC_g@mail.gmail.com>
Subject: Re: Protobuf string serialization bug with statically linked protobuf 2.5.0
From: Tomasz Wiszkowski <tomasz DOT wiszkowski AT gmail DOT com>
To: cygwin AT cygwin DOT com

I gather this package bug is not exactly interesting here, but i'll
share a final update.

The package is likely built inaccurately, or is linked against library
that changed ABI over time.

Downloading and compiling protocol buffers library manually does not
expose any of the serialization problems.
furthermore, manual compilation does not introduce an artificial
dependency on cygprotobuf.dll library.

the protobuf package needs to be rebuilt.

thank you for your attention, i will not be disturbing the list with
further updates.

--
"My definition of an expert in any field is a person who knows enough
about what's really going on to be scared" - P. J. Plauger


2016-02-11 15:20 GMT-08:00 Tomasz Wiszkowski <tomasz DOT wiszkowski AT gmail DOT com>:
> A brief correction.
>
> I tried to identify further the problem by selectively linking
> libraries. (-Wl,-Bstatic -lprotobuf.dll -Wl,-Bdynamic) and it turns
> out the problem emerges the moment i statically link both protobuf
> _and_ the c++ library. linking everything statically except for libc++
> seems to work just fine.
>
> i checked if protobuf loads cygc++-6 separately, which would easily
> explain the problem, but it does not seem to. the problem clearly
> seems to be interaction between these two.
>
> linking libc++ dynamically resolves the problem, but that would also
> mean shipping the software with artificial add-on... i suspect
> recompilation still might resolve the issue...
>
>
> --
> "My definition of an expert in any field is a person who knows enough
> about what's really going on to be scared" - P. J. Plauger
>
>
> 2016-02-10 10:54 GMT-08:00 Tomasz Wiszkowski <tomasz DOT wiszkowski AT gmail DOT com>:
>> Dear all,
>>
>> I'm having problems with statically linked executables that use
>> protocol buffers.
>> I suspect the problem may be related to incompatibility between
>> std::string implementation used to compile the library vs. current. If
>> that's the case, the problem would likely go away with recompilation
>> of the protocol buffer libraries (protobuf-lite is also exposing the
>> same problem).
>>
>> I have attached a test case as you requested. the example program
>> compiles two variants - one dynamically linked (works fine) and one
>> statically linked that crashes upon first attempt to serialize the
>> protocol buffer.
>>
>> It would be great if someone could take a look and possibly rebuild
>> the static libraries for protocol buffers.
>>
>> Best regards,
>> Tomasz
>>
>> -------- example.proto ------------
>> syntax = "proto2";
>>
>> package example;
>>
>> message ExampleMsg {
>>   optional int32 argc = 1;
>>   optional string argv0 = 2;
>> };
>>
>> -------- main.cc ------------
>> #include <iostream>
>> #include <string>
>>
>> #include "example.pb.h"
>>
>> int main(int argc, char** argv) {
>>   example::ExampleMsg message;
>>
>>   message.set_argc(argc);
>>   message.set_argv0(argv[0]);
>>
>>   std::cout << "Serializing protocol buffer." << std::endl;
>>   std::string serialized;
>>   message.SerializeToString(&serialized);  // static variant crashes here.
>>   std::cout << "Serialized length: " << serialized.length() << std::endl;
>>
>>   message.Clear();
>>
>>   std::cout << "Deserializing protocol buffer." << std::endl;
>>   message.ParseFromString(serialized);  // static variant also crashes here.
>>   std::cout << "Deserialized content: argc=" << message.argc() << ", argv0="
>>             << message.argv0();
>>
>>   return 0;
>> }
>>
>> -------- Makefile ------------
>> CFLAGS += -Wall
>> CXXFLAGS := $(CFLAGS)
>> CC = g++
>> LIBS = -lprotobuf.dll
>>
>> all: clean example example-bug
>>
>> example.pb.cc: example.proto
>>         protoc --cpp_out=. $^
>>
>> clean:
>>         rm -f *.o *.pb.* *.exe*
>>
>> example: example.pb.o main.o
>>         $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
>>
>> example-bug: example.pb.o main.o
>>         $(CC) $(CFLAGS) -static $^ -o $@ $(LIBS)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019