|
Boost Users : |
Subject: [Boost-users] program option library segfaults for exception
From: Neetu Garg (garg_neetu_at_[hidden])
Date: 2010-03-16 16:57:47
Hi,
I have application that is using boost program option library. If I provide unknown option via CLI it should throw exception. The library is statically linked on windows and Linux environment. It works fine on windows platform I do get exception for unknown CLI option. On Linux platform I get "segfault" in place of exception for unknown CLI option.
It is s a multi-threaded application and it also uses boost thread library. Application does throw exception on Linux also if I link dynamically.
I am using following flags to link the library statically:
LDFLAGS= -fexceptions -static-libgcc -Wl,-static -L/usr/lib -lboost_program_options-gcc41-mt -lboost_filesystem-gcc41-mt -lboost_thread-gcc41-mt -lboost_system-gcc41-mt -lnet7ssh -lbotan -ltar -lz -lrt -lpthread
I am using following version of gcc:
# g++ --version
g++ (GCC) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Here is the core dump for the segfault:
(gdb) backtrace
#0 __gnu_internal::get_global () at /usr/software/src/gcc-4.1.1/libstdc++-v3/libsupc++/eh_globals.cc:58
#1 0x082c0f67 in __cxa_get_globals () at /usr/software/src/gcc-4.1.1/libstdc++-v3/libsupc++/eh_globals.cc:71
#2 0x082c0b3f in __cxa_allocate_exception (thrown_size=32) at /usr/software/src/gcc-4.1.1/libstdc++-v3/libsupc++/eh_alloc.cc:154
#3 0x080a71f8 in boost::program_options::detail::cmdline::finish_option ()
#4 0x080a77eb in boost::program_options::detail::cmdline::run ()
#5 0x0806f3aa in boost::program_options::basic_command_line_parser<char>::run ()
#6 0x080660e9 in CLIHandler::collectCLIOptions ()
#7 0x0808a0d1 in perfstat::runPerfstat ()
#8 0x0808af3d in main ()
Current language: auto; currently c++
Appreciate your help
Regards,
NG
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net