Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Memory fault - coredump: (3 Items)
   
Memory fault - coredump  
Hi, 

We are running a small pogram in QNX6.3.2 using Boost library.

The program is:

#include <iostream>
#inlcude <boost/filesystem.hpp>

using namespace std;
namespace fs = boost::filesystem;

int main ()
{
   if ( fs::exists("/bbb.xml"))
   {
         cout << " File exists" << endl;
   }
   else
   {
        cout << " File does not exist" << endl;
   }
   return 0;
}

and the makefile as:

all : test

test : test.o
       ntox86-g++-3.3.5 test.o -I/usr/local/lib -lboost_filesystem-d -o test

test.o : test.cpp
       ntox86-g++-3.3.5 -c -I/usr/local/include/boost-1_34_1 test.cpp

and we got the executable file as test.

Now when we run test as ./test, its giving <Memory fault>coredump.

How can we will get the output instead of coredump? any help.

Regards,
Lakshmi.
Re: Memory fault - coredump  
> Hi, 
> 
> We are running a small pogram in QNX6.3.2 using Boost library.
> 
> The program is:
> 
> #include <iostream>
> #inlcude <boost/filesystem.hpp>
> 
> using namespace std;
> namespace fs = boost::filesystem;
> 
> int main ()
> {
>    if ( fs::exists("/bbb.xml"))
>    {
>          cout << " File exists" << endl;
>    }
>    else
>    {
>         cout << " File does not exist" << endl;
>    }
>    return 0;
> }
> 
> and the makefile as:
> 
> all : test
> 
> test : test.o
>        ntox86-g++-3.3.5 test.o -I/usr/local/lib -lboost_filesystem-d -o test
> 
> test.o : test.cpp
>        ntox86-g++-3.3.5 -c -I/usr/local/include/boost-1_34_1 test.cpp
> 
> and we got the executable file as test.
> 
> Now when we run test as ./test, its giving <Memory fault>coredump.
> 
> How can we will get the output instead of coredump? any help.
> 
> Regards,
> Lakshmi.

Hi Lakshmi,

I will try to reproduce the crash for you and debug it. Can you confirm how you built boost?

It may be helpful for you to familiarize yourself with gdb -- it is the best way to debug unexpected program behavior.

Regards,

Ryan Mansfield
Re: Memory fault - coredump  
> > Hi, 
> > 
> > We are running a small pogram in QNX6.3.2 using Boost library.
> > 
> > The program is:
> > 
> > #include <iostream>
> > #inlcude <boost/filesystem.hpp>
> > 
> > using namespace std;
> > namespace fs = boost::filesystem;
> > 
> > int main ()
> > {
> >    if ( fs::exists("/bbb.xml"))
> >    {
> >          cout << " File exists" << endl;
> >    }
> >    else
> >    {
> >         cout << " File does not exist" << endl;
> >    }
> >    return 0;
> > }
> > 
> > and the makefile as:
> > 
> > all : test
> > 
> > test : test.o
> >        ntox86-g++-3.3.5 test.o -I/usr/local/lib -lboost_filesystem-d -o test
> 
> > 
> > test.o : test.cpp
> >        ntox86-g++-3.3.5 -c -I/usr/local/include/boost-1_34_1 test.cpp
> > 
> > and we got the executable file as test.
> > 
> > Now when we run test as ./test, its giving <Memory fault>coredump.
> > 
> > How can we will get the output instead of coredump? any help.
> > 
> > Regards,
> > Lakshmi.
> 
> Hi Lakshmi,
> 
> I will try to reproduce the crash for you and debug it. Can you confirm how 
> you built boost?

I'm guessing you switch the toolset to be qcc. In that case, the libboost-filesystem.so was built against libcpp 
(Dinkumware C++ library) and when you link with the gcc driver (ntox86-g++-3.3.5) you link against the GNU C++ library 
so you end up linking against both C++ libraries.

If you built Boost with qcc, you should be using qcc for your project. If you built Boost with gcc, you should be using 
the gcc driver for your project.

For example:

# ntox86-g++-3.3.5 -I/usr/local/include/boost-1_34_1 boost.cc  -L/usr/local/lib -lboost_filesystem-d
# ./a.out
Memory fault (core dumped)
# qcc -V3.3.5,gcc_ntox86 -I/usr/local/include/boost-1_34_1 boost.cc  -L/usr/local/lib -lboost_filesystem-d
# ./a.out
 File does not exist
# touch /bbb.xml   
# ./a.out
 File exists

Regards,

Ryan Mansfield