Ik heb een programma gemaakt die ik op een raspberry pi 2 compileerde en dit draaide zonder problemen. Pi is is overleden (...) en wilde dit nu op een Pi 3 doen. Hetzelfde programma geeft een segmentation fault.
Programma gebruikt boost program options. Zodra ik hier een variabele aan toegvoeg gaat het mis.
Wat relevante code:
constructor:
Functie om opties toe te voegen:
Dit gaat fout. Als ik de optie met "TEST" weghaal gaat het goed. Stracktrace biedt geen oplossing:
regel 38 is waar po::store staat
Heb andere boost versies geprobeert maar dat mocht niet lukken.
Programma gebruikt boost program options. Zodra ik hier een variabele aan toegvoeg gaat het mis.
Wat relevante code:
constructor:
code:
1
2
3
4
5
6
7
8
| v_AppName = boost::filesystem::basename(argv[0]);
po::options_description desc("Opties");
ProgramOptions(desc);
po::variables_map vm;
try
{
po::store(po::parse_command_line(argc, argv, desc), vm);
<rest is weg> |
Functie om opties toe te voegen:
code:
1
2
3
4
5
6
7
| void Client::ProgramOptions(boost::program_options::options_description & l_Desc)
{
l_Desc.add_options()
("help,h", "Toont gebruik programma")
("toon,t", "Toont huidige IO en instellingen")
("TEST", po::value<int>(), "TEST");
} |
Dit gaat fout. Als ik de optie met "TEST" weghaal gaat het goed. Stracktrace biedt geen oplossing:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| #0 0x76f17f24 in boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const () from /usr/lib/arm-linux-gnueabihf/libboost_program_options.so.1.55.0
No symbol table info available.
#1 0x76f13220 in boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool) ()
from /usr/lib/arm-linux-gnueabihf/libboost_program_options.so.1.55.0
No symbol table info available.
#2 0x0003cae0 in warmte::Client::Client (this=0x7efff618, argc=1, argv=0x7efff794) at src/client.cpp:38
timeout = {<boost::date_time::base_time<boost::posix_time::ptime, boost::date_time::counted_time_system<boost::date_time::counted_time_rep<boost::posix_time::millisec_posix_time_system_config> > >> = {<boost::operators_impl::less_than_comparable<boost::posix_time::ptime, boost::operators_impl::equality_comparable<boost::posix_time::ptime, boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::false_t>, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::true_t>> = {<boost::operators_impl::less_than_comparable1<boost::posix_time::ptime, boost::operators_impl::equality_comparable<boost::posix_time::ptime, boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::false_t> >> = {<boost::operators_impl::equality_comparable<boost::posix_time::ptime, boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>, boost::operators_impl::operators_detail::false_t>> = {<boost::operators_impl::equality_comparable1<boost::posix_time::ptime, boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime> >> = {<boost::operators_impl::operators_detail::empty_base<boost::posix_time::ptime>> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, time_ = {time_count_ = {
value_ = 8569444509916594175}}}, <No data fields>}
desc = {static m_default_line_length = 80, m_caption = "Opties", m_line_length = 80, m_min_description_length = 40,
m_options = std::vector of length 3, capacity 4 = {{px = 0x6d168, pn = {pi_ = 0x6d980}}, {px = 0x6d188, pn = {pi_ = 0x6f588}}, {px = 0x6f628,
pn = {pi_ = 0x6f690}}}, belong_to_group = std::vector<bool> of length 3, capacity 32 = {0, 0, 0},
groups = std::vector of length 0, capacity 0}
vm = <incomplete type>
#3 0x0003c92c in main (argc=1, argv=0x7efff794) at src/client.cpp:17
client = {_vptr.Client = 0x57418 <vtable for warmte::Client+8>, vp_Shm = 0x0, vp_Region = 0x0, v_AppName = "warmteclient", l_Index = 0,
l_Result = 1} |
regel 38 is waar po::store staat
Heb andere boost versies geprobeert maar dat mocht niet lukken.
[ Voor 39% gewijzigd door elgringo op 21-11-2017 22:35 ]
if broken it is, fix it you should