stdcxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Problem building Tuscany SDO with stdcxx on Linux
Date Mon, 16 Oct 2006 16:32:36 GMT
Geoffrey Winn wrote:
> Thank you both. Once I added -libsupc++ to the link, the the test program
> builds cleanly and I can run it.
> 
> The good news is that from 111 test cases, 109 run successfully.
> 
> The bad news is that 2 fail in calls to the C++ library and then the test
> program itself crashes - ironically, while printing the number of 
> successful
> tests :-)
> 
> I'd like to check the final crash first because I think it might be the
> easiest to isolate. It happens when executing lines like
> 
> cout << "Tests passed: ";
> 
> This is in fact the first reference to cout in the program, so by way of an
> experiment I inserted
> 
> cout << "Starting tests";
> 
> at the beginning and it crashes there instead. Does anyone recognise this
> issue?
> 
> gdb prints the following, rather cryptic, backtrace
> 
> (gdb) bt
> #0  0x00e92cdf in raise () from /lib/tls/libc.so.6
> #1  0x00e944e5 in abort () from /lib/tls/libc.so.6
> #2  0x00246592 in __rw::__rw_assert_fail (expr=0x2b3af3 "this->_C_is_valid
> ()",
>    file=0x2b3ab4
> "/home/tuscany/workspace/stdcxx/stdcxx-4.1.3/include/fstream.cc",
> line=509,
>    func=0x2b3e60 "std::basic_streambuf<_CharT, _Traits>*
> std::basic_filebuf<_CharT, _Traits>::setbuf(_CharT*, int) [with _CharT =
> char, _Traits = std::char_traits<char>]") at
> /home/tuscany/workspace/stdcxx/stdcxx-4.1.3/src/assert.cpp:96
> #3  0x0026d962 in std::basic_filebuf<char, std::char_traits<char> >::setbuf
> (this=0xbfffa4d0, __buf=0x0, __len=512) at fstream.cc:509
> #4  0x08073005 in sdotest::testUtil () at fstream:109
> #5  0x0808ad51 in main (argc=1, argv=0xbfffa664) at main.cpp:106
> 
> In the case where the reference to cout is at the beginning of the program
> then the source is ...
> 
> #include <stdio.h>
> 
> #pragma warning(disable:4786)
> 
> #include <iostream>
> using namespace std;
> 
> #include "sdotest.h"

What happens in this header? Are there any global objects being
constructed that might be manipulating cout or its streambuf
object?

Martin

> 
> extern "C"{
> 
> #define TEST(testname)\
>    value = testname;\
>    if (value == 0) {\
>        cout << "Test Failed: " << totaltests  << " " << #testname
<< endl;\
>    }\
>    testspassed += value;\
>    totaltests++;
> 
> int main (int argc, char** argv)
> {
>    cout << "Starting SDO tests ...";      <=== Fails here.
> 
> The thing that puzzles me is that this is fairly unremarkable code compared
> to all the other stuff that's workin OK.
> 
> Regards,
> 
> Geoff.
> 
> On 12/10/06, Liviu Nicoara < nicoara@roguewave.com> wrote:
> 
>>
>> Martin Sebor wrote:
>> > Geoffrey Winn wrote:
>> >> Is the reference to __cxa_pure_virtual familiar to anyone?
>> > (When using g++, the runtime is included in libstdc++).
>>
>> I stand corrected :-), g++ does not link libsupc++ anymore - these
>> symbols are indeed in libstdc++. I do remember a time when downstream
>> products on top of our stdlib were linking libsupc++ explicitly.
>>
>> Liviu
>>
>>
> 


Mime
View raw message