Opened 13 years ago
Last modified 13 years ago
#29394 closed defect
in boost 1.46.1 program_options lib is unusable in macports — at Version 2
Reported by: | christophe.prudhomme@… | Owned by: | adfernandes@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.9.2 |
Keywords: | boost1.46 program_options | Cc: | |
Port: | boost |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
the following simple program using boost.program_options crashes with the boost macports
#include <iostream> #include <boost/program_options.hpp> namespace po = boost::program_options; int main(int ac, char** av) { using namespace std; //locale::global(locale("")); // Declare the supported options. po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") ("compression", po::value<int>(), "set compression level") ; po::variables_map vm; po::store(po::parse_command_line(ac, av, desc), vm); po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; return 1; } if (vm.count("compression")) { cout << "Compression level was set to " << vm["compression"].as<int>() << ".\n"; } else { cout << "Compression level was not set.\n"; } }
the problem lies in printing the options_description structure
(gdb) r --help Starting program: /private/tmp/t --help Allowed options: t(40384) malloc: *** error for object 0x7fff70a22500: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Program received signal SIGABRT, Aborted. 0x00007fff88cab5d6 in __kill () (gdb) bt #0 0x00007fff88cab5d6 in __kill () #1 0x00007fff88d4bcd6 in abort () #2 0x00007fff88c636b5 in free () #3 0x00000001001299d0 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow () #4 0x000000010012e13c in std::basic_streambuf<char, std::char_traits<char> >::xsputn () #5 0x00007fff84fcdae4 in std::__ostream_write<char, std::char_traits<char> > () #6 0x00007fff84fcbb98 in std::__ostream_insert<char, std::char_traits<char> > () #7 0x0000000100063b3d in boost::program_options::options_description::print () #8 0x00000001000640b7 in boost::program_options::operator<< () #9 0x00000001000016cf in main ()
Change History (3)
Changed 13 years ago by christophe.prudhomme@…
comment:1 Changed 13 years ago by christophe.prudhomme@…
Note that the example is taken from the boost.program_options from the tutorial I suspect this has to do with utf-8 encoding and locales.
comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Description: | modified (diff) |
---|---|
Owner: | changed from macports-tickets@… to adfernandes@… |
Note: See
TracTickets for help on using
tickets.
test program to reproduce the crash