[csw-users] g++ libraries

Steve Garcia sgarcia at bak.rr.com
Fri Feb 25 20:30:50 CET 2005

Peter FELECAN wrote:

>>We have a problem with the gcc version 3.3.3 installed via
>>Blastwave. It's quite possible (maybe even likely) that the problem
>>stems from a misconfiguration on my part, but I haven't been able to
>>figure out what that misconfiguration is.
> The current version is 3.4.3. Can you upgrade your installation, test
> and report back? BTW, there is the bug-tracking system at
> http://www.blastwave.org/mantis/login_page.php

The end of the quarter is in a couple of weeks.  I've found it's safer 
*not* to do upgrades in the middle of a term -- no matter how benign, 
the risk of altering behavior is too potentially disruptive.  Once the 
quarter is over I'll do the upgrade.

And thanks for the pointer to the bug-tracker.  I'll take a look and see 
what might already be reported.
>>What seems to be happening is that under certain circumstances a
>>fairly straightforward C++ program will segfault for no apparent
>>reason.  When I trace the error using gdb I see that it is failing in
>>/lib/libc.so.1 in the realfree() function.
> Well, could you provide an example? There are many reasons for this
> kind of error.

The archive of the project is 17k.  All the files are real small except 
the string.cpp and the string.h, but if there's a problem with his code 
that's likely where it is.  I'm having the faculty member whose student 
this is examine those files, and if we can isolate suspect areas I'll 
post those.

However, this is his main.cpp:

#include <iostream>
#include "dtoken.h"
#include "stoken.h"

using namespace std;

int main()
    cout<< "\n\n";

    Token * tlist[50];
    tlist[0]= new Dtoken(66);

    tlist[1]= new Dtoken(345.88);

    tlist[2]= new Stoken("Lab 6");

    tlist[3]= new Dtoken(234.45);

    tlist[4]= new Stoken("Does it work?");

    for (int i = 0; i < 3; i++)

    return 0;

Note that if you get rid of the 'for loop' it works fine.  The problem 
may be in the display() function which is very simple:

void Stoken::display() const{
    cout<<left<< setw(10)<< data;

void Dtoken::display() const{
    cout<<left<< setw(10)<< data;

but he's got his own string class which is about 5k and I don't want to 
clog the list with that, particularly if the instructor looks at it and 
finds an error.  If she doesn't find an error then we'll still be 
wondering what the problem is...


>>If so, how can I configure the system so it
>>picks the correct libraries?
> Take care of the values of the PATH and LD_LIBRARY_PATH in your
> environment as described at http://www.blastwave.org/userguide/

I'll look at that some more.  I'm still trying to wrap my mind around 
all the LD_LIBRARY_PATH issues.

> Although is not a solution for your situation, you can have both
> compiler installed simultaneously on your system.

Which we do.  But they have to change their PATH (and possibly 
LD_LIBRARY_PATH) in order to switch compilers.  If it is actually a 
fault in the students' code, best to learn now rather than somewhere 
down the road.  If we can't find an obvious problem with their code, 
I'll set things up so they're using the old compiler until we figure it out.

Oh, for what it's worth (which may not be much), the code compiles and 
runs without error on my Linux box under gcc 3.3.5.

sgarcia at bak.rr.com

More information about the users mailing list