help cross compile using vxworks

1,123 views
Skip to first unread message

Rob

unread,
Mar 12, 2012, 10:28:08 PM3/12/12
to Protocol Buffers
Hi everyone.

I'm currently having issues cross compiling protobuf (2.4.1) so it
will work with vxworks.

This is how I configure protobuf with cygwin:
CC=ccppc \
CXX=g++ppc \
CFLAGS="-mcpu=604 -mstrict-align -fno-implicit-fp -ansi -g -fno-
builtin -Wall -IC:/WindRiver/vxworks-6.7/target/h -IC:/WindRiver/
vxworks-6.7/target/h/wrn/coreip -I../Infrastructure -DCPU=PPC604 -
DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -DINET -D_WRS_LIB_BUILD
-D_VSB_CONFIG_FILE=\"C:/WindRiver/vxworks-6.7/target/lib/h/config/
vsbConfig.h\" -MD" \
CXXFLAGS="$CFLAGS" \
./configure --host=ppc --with-protoc=$HOME/install/bin/protoc -prefix=
$HOME/install-ppc

$ ccppc.exe --version (this is the cross compiler)
ccppc.exe (Wind River VxWorks G++ DWARF-EH 4.1-131) 4.1.2

And make fails with this mess. I don't know how to make it work...
any help?

/bin/sh ../libtool --tag=CXX --mode=compile g++ppc -DHAVE_CONFIG_H -
I. -I.. -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-
compare -mcpu=604 -mstrict-align -fno-implicit-fp -ansi -g -fno-
builtin -Wall -IC:/WindRiver/vxworks-6.7/target/h -IC:/WindRiver/
vxworks-6.7/target/h/wrn/coreip -I../Infrastructure -DCPU=PPC604 -
DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -DINET -D_WRS_LIB_BUILD
-D_VSB_CONFIG_FILE="C:/WindRiver/vxworks-6.7/target/lib/h/config/
vsbConfig.h" -MD -MT extension_set.lo -MD -MP -MF .deps/
extension_set.Tpo -c -o extension_set.lo `test -f 'google/protobuf/
extension_set.cc' || echo './'`google/protobuf/extension_set.cc
libtool: compile: g++ppc -DHAVE_CONFIG_H -I. -I.. -Wall -Wwrite-
strings -Woverloaded-virtual -Wno-sign-compare -mcpu=604 -mstrict-
align -fno-implicit-fp -ansi -g -fno-builtin -Wall -IC:/WindRiver/
vxworks-6.7/target/h -IC:/WindRiver/vxworks-6.7/target/h/wrn/coreip -
I../Infrastructure -DCPU=PPC604 -DTOOL_FAMILY=gnu -DTOOL=gnu -
D_WRS_KERNEL -DINET -D_WRS_LIB_BUILD -D_VSB_CONFIG_FILE=C:/WindRiver/
vxworks-6.7/target/lib/h/config/vsbConfig.h -MD -MT extension_set.lo -
MD -MP -MF .deps/extension_set.Tpo -c google/protobuf/extension_set.cc
-o extension_set.o
c:/windriver/gnu/4.1.2-vxworks-6.7/lib/gcc/../../include/c++/4.1/
hash_map: In instantiation of 'std::_Hmap_traits<std::pair<const
google::protobuf::MessageLite*, int>,
google::protobuf::internal::ExtensionInfo,
google::protobuf::hash<std::pair<const google::protobuf::MessageLite*,
int> >, std::equal_to<std::pair<const google::protobuf::MessageLite*,
int> >, false>':
c:/windriver/gnu/4.1.2-vxworks-6.7/lib/gcc/../../include/c++/4.1/xhash:
195: instantiated from 'std::_Hash<std::_Hmap_traits<std::pair<const
google::protobuf::MessageLite*, int>,
google::protobuf::internal::ExtensionInfo,
google::protobuf::hash<std::pair<const google::protobuf::MessageLite*,
int> >, std::equal_to<std::pair<const google::protobuf::MessageLite*,
int> >, false> >'
c:/windriver/gnu/4.1.2-vxworks-6.7/lib/gcc/../../include/c++/4.1/
hash_map:78: instantiated from 'std::hash_map<std::pair<const
google::protobuf::MessageLite*, int>,
google::protobuf::internal::ExtensionInfo,
google::protobuf::hash<std::pair<const google::protobuf::MessageLite*,
int> >, std::equal_to<std::pair<const google::protobuf::MessageLite*,
int> > >'
./google/protobuf/stubs/hash.h:165: instantiated from
'google::protobuf::hash_map<std::pair<const
google::protobuf::MessageLite*, int>,
google::protobuf::internal::ExtensionInfo,
google::protobuf::hash<std::pair<const google::protobuf::MessageLite*,
int> >, std::equal_to<std::pair<const google::protobuf::MessageLite*,
int> > >'
google/protobuf/extension_set.cc:68: instantiated from here
c:/windriver/gnu/4.1.2-vxworks-6.7/lib/gcc/../../include/c++/4.1/
hash_map:21: error: no class template named 'rebind' in 'struct
std::equal_to<std::pair<const google::protobuf::MessageLite*, int> >'
c:/windriver/gnu/4.1.2-vxworks-6.7/lib/gcc/../../include/c++/4.1/
hash_map:24: error: no class template named 'rebind' in 'struct
std::equal_to<std::pair<const google::protobuf::MessageLite*, int> >'
c:/windriver/gnu/4.1.2-vxworks-6.7/lib/gcc/../../include/c++/4.1/
hash_map:25: error: no class template named 'rebind' in 'struct
std::equal_to<std::pair<const google::protobuf::MessageLite*, int> >'
google/protobuf/extension_set.cc: In function 'const
google::protobuf::internal::ExtensionInfo*
google::protobuf::internal::<unnamed>::FindRegisteredExtension(const
google::protobuf::MessageLite*, int)':
google/protobuf/extension_set.cc:94: error: no matching function for
call to 'FindOrNull(google::protobuf::hash_map<std::pair<const
google::protobuf::MessageLite*, int>,
google::protobuf::internal::ExtensionInfo,
google::protobuf::hash<std::pair<const google::protobuf::MessageLite*,
int> >, std::equal_to<std::pair<const google::protobuf::MessageLite*,
int> > >&, std::pair<const google::protobuf::MessageLite*, int>)'
make[3]: *** [extension_set.lo] Error 1

Todd Leitzel

unread,
May 1, 2012, 2:03:37 PM5/1/12
to prot...@googlegroups.com

I ran into similar compile errors, most of which were because the VxWorks compiler we are using does not support TR1 very well, including hash maps.  To get around these issues I recommend using Boost.  In the config.h file you can switch out using the stl hash_map/hash_set for the Boost version.   Something like:

#define HASH_MAP_H <boost/unordered_map.hpp>

#define HASH_NAMESPACE boost

#define HASH_SET_H <boost/unordered_set.hpp>


Of course you will need to add Boost to the include path.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages