[odb-users] C++11 To-Many Relationship using std::shared_ptr<std::vector<std::shared_ptr<...>>>

Behling Carsten Carsten.Behling at wiesheu.de
Thu Jul 29 09:55:57 EDT 2021


Hi,


I'm having a To-Many Relationship :


OvenData ----*>ProgramData


using C++11 containers and smart pointers


This worked fine until I changed the relationship using a std::shared_ptr to the std::vetor:



std::vector<std::shared_ptr<dal::ProgramData>> programs_;


to


std::shared_ptr<std::vector<std::shared_ptr<dal::ProgramData>>> programs_;



Persistent data file excerpt:


...

namespace dal {
#pragma db object pointer(std::shared_ptr) session
#pragma db object table("programs")
class ProgramData {
...
  std::string program_name_;
...
}
...
#pragma db object pointer(std::shared_ptr) session
#pragma db object table("ovens")
class OvenData {
...
#pragma db value_not_null unordered
std::shared_ptr<std::vector<std::shared_ptr<dal::ProgramData>>> programs_;
};
...

and ODB compiler crashes:

...
ocbe at debian:~/projects/5446/bakingsystem/src/dal$ cd /home/kocbe/projects/5446/bakingsystem/src/dal && /usr/bin/odb -x -dH -d sqlite --generate-query --generate-session --generate-schema --std c++11 --output-dir /home/kocbe/projects/5446/build-bakingsystem-Desktop_Qt_5_12_8_GCC_64bit-Debug/src/dal/odb_gen --hxx-suffix .h --ixx-suffix _inline.h --cxx-suffix .cpp --odb-file-suffix _odb -I/usr/include BakingSystemData.h
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_START_UNIT                | odb
PLUGIN_PRAGMAS                   | odb
PLUGIN_OVERRIDE_GATE             | odb
In file included from /usr/include/odb/container-traits.hxx:217:0,
                 from <standard-odb-epilogue>:9:
/usr/include/odb/std-unordered-set-traits.hxx:122:1: internal compiler error: Segmentation fault
 }
 ^
g++: internal compiler error: Aborted (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
...

Backtrace:
...
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007fdc37c3142a in __GI_abort () at abort.c:89
#2  0x000000000113ba8b in diagnostic_action_after_output(diagnostic_context*, diagnostic_t) ()
#3  0x000000000113bd0e in diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ()
#4  0x000000000113d20e in internal_error(char const*, ...) ()
#5  0x0000000000ad3fb0 in ?? ()
#6  <signal handler called>
#7  0x00000000011aa60d in __dynamic_cast ()
#8  0x00007fdc370c2358 in ?? () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#9  0x00007fdc37076a66 in cutl::compiler::dispatcher<semantics::node>::dispatch(semantics::node&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#10 0x00007fdc37077586 in cutl::compiler::dispatcher<semantics::edge>::dispatch(semantics::edge&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#11 0x00007fdc370702e6 in traversal::scope_template<semantics::class_>::names(semantics::class_&, cutl::compiler::dispatcher<semantics::edge>&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#12 0x00007fdc370c9a1f in ?? () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#13 0x00007fdc37076a66 in cutl::compiler::dispatcher<semantics::node>::dispatch(semantics::node&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#14 0x00007fdc37077586 in cutl::compiler::dispatcher<semantics::edge>::dispatch(semantics::edge&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#15 0x00007fdc370989c6 in traversal::scope_template<semantics::namespace_>::names(semantics::namespace_&, cutl::compiler::dispatcher<semantics::edge>&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#16 0x00007fdc37076a66 in cutl::compiler::dispatcher<semantics::node>::dispatch(semantics::node&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#17 0x00007fdc37077586 in cutl::compiler::dispatcher<semantics::edge>::dispatch(semantics::edge&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#18 0x00007fdc37098966 in traversal::scope_template<semantics::unit>::names(semantics::unit&, cutl::compiler::dispatcher<semantics::edge>&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#19 0x00007fdc37076a66 in cutl::compiler::dispatcher<semantics::node>::dispatch(semantics::node&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#20 0x00007fdc370c7667 in process(options const&, features&, semantics::unit&, cutl::fs::basic_path<char> const&) () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#21 0x00007fdc370f6595 in gate_callback () from /usr/lib/gcc/x86_64-linux-gnu/6/plugin/odb.so
#22 0x0000000000a2fb12 in invoke_plugin_callbacks_full(int, void*) ()
#23 0x0000000000a25f17 in execute_one_pass(opt_pass*) ()
#24 0x0000000000a26c12 in execute_ipa_pass_list(opt_pass*) ()
#25 0x00000000007c6b05 in ?? ()
#26 0x00000000007c8815 in symbol_table::finalize_compilation_unit() ()
#27 0x0000000000ad422a in ?? ()
---Type <return> to continue, or q <return> to quit---
#28 0x00000000005cae04 in toplev::main(int, char**) ()
#29 0x00000000005cd05b in main ()
...

I'm on Deian Stretch using quite old ODB 2.4.0.

Is it possible to use

std::shared_ptr<std::vector<std::shared_ptr<...>>>

as 'To-Many Relationship'?

Anyway ODB compiler should not crash.

Best regards
Carsten


  
       

WIESHEU GmbH Schleifwiesenstr.27 71723 Großbottwar / Deutschland 
Geschäftsführer / Managing Director: Marcus Gansloser HRB-Nr. 310389 

Informationspflicht nach Art 13 DSGVO
https://www.wiesheu.de/informationspflicht 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fb-1.jpg.gif
Type: image/gif
Size: 1261 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20210729/4ce4b387/fb-1.jpg.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: youtube.jpg.gif
Type: image/gif
Size: 711 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20210729/4ce4b387/youtube.jpg.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: link.gif
Type: image/gif
Size: 818 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20210729/4ce4b387/link.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: insta.gif
Type: image/gif
Size: 1467 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20210729/4ce4b387/insta.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WIESHEU_4c__002_.gif
Type: image/gif
Size: 6141 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20210729/4ce4b387/WIESHEU_4c__002_.gif


More information about the odb-users mailing list