I have an application developed under Linux with GCC 4.2 which makes quite heavy use of stringstreams to wrap and unwrap data being sent over the wire. (Because the Grid API I'm using demands it). Under Linux everything is fine but when I deploy to SunOS (v5.10 running SPARC) and compile with GCC 3.4.6 the app hangs when it reaches the point at which stringstreams are used.
*New Information added 9/7/2010* So I still didn't solve this but after a lot of tinkering around I finally found a clue. In fact I think I found the problem but I'm at a loss how to fix it! See linker output below:
ld: warning: symbol `typeinfo for std::basic_iostream<char, std::char_traits<char> >' has differing sizes:
(file /home/roony/dssdk/cppdriver/lib/libdsDriverGCC3.so value=0x28; file /usr/sfw/lib/libstdc++.so value=0x20);
/home/roony/dssdk/cppdriver/lib/libdsDriverGCC3.so definition taken
So the warning says there is a mismatch in the definition of iostream etc between the two libraries but how to fix, or override one or the other.. *End new information*
In more detail: The main thread accepts requests from clients and starts a new pthread to handle each request. The child thread uses stringstreams to pack data. When the child thread gets to that point it seems to hang for a second and then die. The main thread is unaffected.
Are there any known issues with stringstream and GCC 3.4.6 or SunOS or SPARCs? I didn't find anything yet...
Can anyone suggest a better way to pack and unpack large amounts of data a strings or byte streams?
Apologies for not posting code but this to me seems more involved than a simple syntax error. All the same, the thread crashes:
std::stringstream mystringstream; //not here
mystringstream << "some data: "; //but here
That is, I can declare the stringstream but when I try to use it something goes wrong.