Skip to Content.
Sympa Menu

charm - [charm] std::exception with Charm++ as shared library

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

[charm] std::exception with Charm++ as shared library


Chronological Thread 
  • From: Andy Somogyi <somogyie AT umail.iu.edu>
  • To: charm AT cs.uiuc.edu
  • Subject: [charm] std::exception with Charm++ as shared library
  • Date: Fri, 2 Sep 2011 11:04:59 -0400
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Hi folks.

I have a project which uses Charm++, this project is built both as an executable and as a shared library. 

Thanks to Gengbin Zheng for the tip to build as a shared lib. 

The problem I'm having now is when an exception (std::runtime_error in this case) is thrown, it IS PROPERLY CAUGHT when running as a stand alone executable. Again, it works perfectly fine when running as a stand alone executable. 

However, when running as shared library, any exception, wether or not it is caught results in a segfault, with the error message:

terminate called after throwing an instance of 'std::runtime_error'
Abort trap

The relevant stack trace is:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib             0x00007fff87e580b6 __kill + 10
1   libSystem.B.dylib             0x00007fff87ef89f6 abort + 83
2   testlib.so                       0x0000000102b53132 __gnu_cxx::__verbose_terminate_handler() + 360
3   testlib.so                       0x0000000102b51ea5 __cxxabiv1::__terminate(void (*)()) + 11
4   testlib.so                       0x0000000102b51eda __cxxabiv1::__unexpected(void (*)()) + 0
5   testlib.so                       0x0000000102b51fc0 __gxx_exception_cleanup(_Unwind_Reason_Code, _Unwind_Exception*) + 0
6   testlib.so                       0x0000000102a1f025 DCDFile_init(DCDFile*, _object*, _object*) + 1598 (PyDCDFile.C:113)

I'm linking the shared lib as:

testlib.so: $(INCDIR) $(DSTDIR) $(OBJS) $(LIBS) $(DSTDIR)/SharedLibModuleInit.o
$(MAKEBUILDINFO) 
$(CHARMC) -shared -verbose -ld++-option \
"$(COPTI)$(CHARMINC) $(COPTI)$(INCDIR) $(COPTI)$(SRCDIR) $(CXXOPTS)" \
$(CHARM_MODULES) -language charm++ \
-L$(CHARMLIB) \
$(BUILDINFO).o \
$(OBJS) \
$(CHARMOPTS) \
$(EXTRALINKLIBS) \
$(PYTHONLIBS) \
$(DSTDIR)/SharedLibModuleInit.o \
    $(CHARMLIB)/libmemory-default.o \
    $(CHARMLIB)/libthreads-default.o \
    $(CHARMLIB)/libldb-rand.o  \
-lsupc++ -lstdc++ \
-lck -lconv-cplus-y -lconv-core -lconv-util -lckqt -ldl -lm \
-lmoduleNeighborLB -lmoduleHybridLB -lmoduleRefineLB -lmoduleGreedyLB \
-o testlib.so

Any ideas?

thanks


  • [charm] std::exception with Charm++ as shared library, Andy Somogyi, 09/02/2011

Archive powered by MHonArc 2.6.16.

Top of Page