digideskio / protobuf-c

Automatically exported from code.google.com/p/protobuf-c
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

compiling on FreeBSD #22

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. install protobuf-2.1.0 (from ports) to FreeBSD 7-STABLE/amd64
2. run ./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
3. change alloca.h to stdlib.h (there is no alloca.h on FreeBSD)
4. re-run the above configure
5. run make, then crash

What is the expected output? What do you see instead?
I expected a normal configure-make run, but instead I get:
/bin/sh ../../libtool --tag=CXX --mode=link g++   -I/usr/local/include 
-L/usr/local/lib -o cxx-generate-packed-data  cxx-generate-packed-data.o
test-full.pb.o -lprotobuf
mkdir .libs
g++ -I/usr/local/include -o cxx-generate-packed-data
cxx-generate-packed-data.o test-full.pb.o  -L/usr/local/lib
/usr/local/lib/libprotobuf.so -lz   -Wl,--rpath -Wl,/usr/local/lib
-Wl,--rpath -Wl,/usr/local/lib
./cxx-generate-packed-data > generated-code/test-full-cxx-output.inc
Segmentation fault (core dumped)
*** Error code 139

Stop in /tmp/protobuf-c-0.11/src/test.
*** Error code 1

gdb says:
(gdb) bt
#0  0x000000080071b398 in std::_Rb_tree<std::string, std::pair<std::string
const, std::pair<void const*, int> >, std::_Select1st<std::pair<std::string
const, std::pair<void const*, int> > >, std::less<std::string>,
std::allocator<std::pair<std::string const, std::pair<void const*, int> > >
>::_M_insert_unique () from /usr/local/lib/libprotobuf.so.4
#1  0x000000080071b530 in
google::protobuf::InsertIfNotPresent<std::map<std::string, std::pair<void
const*, int>, std::less<std::string>, std::allocator<std::pair<std::string
const, std::pair<void const*, int> > > >, std::string, std::pair<void
const*, int> > () from /usr/local/lib/libprotobuf.so.4
#2  0x000000080071fc7d in
google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void
const*, int> >::AddFile () from /usr/local/lib/libprotobuf.so.4
#3  0x0000000800719e42 in google::protobuf::EncodedDescriptorDatabase::Add
() from /usr/local/lib/libprotobuf.so.4
#4  0x00000008006d151f in
google::protobuf::DescriptorPool::InternalAddGeneratedFile () from
/usr/local/lib/libprotobuf.so.4
#5  0x00000008007053fe in
google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto
() from /usr/local/lib/libprotobuf.so.4
#6  0x0000000800705c6f in __static_initialization_and_destruction_0 () from
/usr/local/lib/libprotobuf.so.4
#7  0x00000008007655c7 in __do_global_ctors_aux () from
/usr/local/lib/libprotobuf.so.4
#8  0x00000008006c5efe in _init () from /usr/local/lib/libprotobuf.so.4
#9  0x00007fffffffeb20 in ?? ()
#10 0x0000000800552415 in dlsym () from /libexec/ld-elf.so.1
#11 0x00000008005536c7 in dlopen () from /libexec/ld-elf.so.1
#12 0x000000080054e4c9 in ?? () from /libexec/ld-elf.so.1
#13 0x0000000000000000 in ?? ()
#14 0x0000000000000000 in ?? ()
#15 0x0000000000000000 in ?? ()

What version of the product are you using? On what operating system?
The latest, FreeBSD.

Please provide any additional information below.

Original issue reported on code.google.com by nagy.att...@gmail.com on 24 Jun 2009 at 2:33

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
(Thank you for the note on alloca; fixed in subversion)

I don't have a freebsd system to test on, but this is a normal protobuf (not
protobuf-c) program that's failing.

It's crashing in protobuf's static initializers -- this is code that runs 
before main().

Can you apply the attached patch to protobuf-c, then re-run
   cxx-generate-packed-data > /dev/null
and tell me if it prints 
   calling generated code static init before protobuf static init
before crashing?

thanks

Original comment by lahike...@gmail.com on 25 Jun 2009 at 4:01

Attachments:

GoogleCodeExporter commented 8 years ago
common-test-arrays.h:61: warning: deprecated conversion from string constant to 
'char*'
common-test-arrays.h:61: warning: deprecated conversion from string constant to 
'char*'
common-test-arrays.h:61: warning: deprecated conversion from string constant to 
'char*'
common-test-arrays.h:61: warning: deprecated conversion from string constant to 
'char*'
common-test-arrays.h:62: warning: deprecated conversion from string constant to 
'char*'
if g++ -DPACKAGE_NAME=\"protobuf-c\" -DPACKAGE_TARNAME=\"protobuf-c\"
-DPACKAGE_VERSION=\"0.11\" -DPACKAGE_STRING=\"protobuf-c\ 0.11\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"protobuf-c\" -DVERSION=\"0.11\" 
-DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_SYS_POLL_H=1
-DHAVE_SYS_SELECT_H=1 -DPROTOC_VERSION=2001000 -DHAVE_MACHINE_ENDIAN_H=1
-DIS_LITTLE_ENDIAN=1 -I. -I. -I./..    -I/usr/local/include -MT test-full.pb.o 
-MD
-MP -MF ".deps/test-full.pb.Tpo" -c -o test-full.pb.o `test -f
'generated-code/test-full.pb.cc' || echo './'`generated-code/test-full.pb.cc;  
then
mv -f ".deps/test-full.pb.Tpo" ".deps/test-full.pb.Po"; else rm -f
".deps/test-full.pb.Tpo"; exit 1; fi
/bin/sh ../../libtool --tag=CXX --mode=link g++   -I/usr/local/include 
-L/usr/local/lib -o cxx-generate-packed-data  cxx-generate-packed-data.o
test-full.pb.o -lprotobuf
g++ -I/usr/local/include -o cxx-generate-packed-data cxx-generate-packed-data.o
test-full.pb.o  -L/usr/local/lib /usr/local/lib/libprotobuf.so -lz   -Wl,--rpath
-Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib
./cxx-generate-packed-data > generated-code/test-full-cxx-output.inc
Segmentation fault (core dumped)
*** Error code 139

Stop in /tmp/protobuf-c-0.11/src/test.

I see no change.

Original comment by nagy.att...@gmail.com on 25 Jun 2009 at 1:08

GoogleCodeExporter commented 8 years ago
Hmm, this looks tricky.  

1)  probably you can just ignore this problem since protobuf-c has already 
built and
you have working a protoc-c program and a libprotobuf-c.so -- essentially just 
doing
'make install' should give you a working installation.  this isn't very 
satisfying
and is probably inacceptable if you are trying to make an official port of 
protobuf-c

2)  one general debugging aid is valgrind -- if you could install it and run
     cd /tmp/protobuf-c-0.11/src/test
     valgrind ./cxx-generate-packed-data > /dev/null
and send me whatever valgrind prints it might help (or it might not, who knows?)

3)  i will take a stab at debugging on your machine if you give me an account.  
if
you want to do this email me.  (i will send you my ssh public-key -- that way we
won't have to send passwords through email.  i'll need your ip address/hostname 
and
the account name.)

Original comment by lahike...@gmail.com on 29 Jun 2009 at 4:49

GoogleCodeExporter commented 8 years ago
it builds all over .. and no follow-up for a long time.. feel free to try with 
responses to 
my questions

Original comment by lahike...@gmail.com on 18 Mar 2010 at 2:26