C++ ORM事务提交上的Wt SEGFULT

C++ ORM事务提交上的Wt SEGFULT,c++,c++11,wt,dbo,wt-dbo,C++,C++11,Wt,Dbo,Wt Dbo,说 本教程中使用的示例的完整源代码可以在Wt的examples/feature/dbo/文件夹中作为准备运行的程序获得 我正试图从该目录运行tutorial1.C,得到以下输出: (gdb)运行 启动程序:/home/lawsa/sources/memory/dist/flashcard--docroot--http地址0.0.0.0--http端口9090 [已启用使用libthread_db的线程调试] 使用主机libthread_db library“/usr/lib/libthread

本教程中使用的示例的完整源代码可以在Wt的
examples/feature/dbo/
文件夹中作为准备运行的程序获得

我正试图从该目录运行
tutorial1.C
,得到以下输出:

(gdb)运行
启动程序:/home/lawsa/sources/memory/dist/flashcard--docroot--http地址0.0.0.0--http端口9090
[已启用使用libthread_db的线程调试]
使用主机libthread_db library“/usr/lib/libthread_db.so.1”。
开始交易
创建表“用户”(
“id”整数主键自动递增,
“版本”整数不为空,
“名称”文本不为空,
“密码”文本不为空,
“角色”整数不为空,
“因果报应”整数不为空
)
提交事务
创建的表
终止交易
程序接收信号SIGSEGV,分段故障。
0x000000000041a4a8无效std::vector::emplace_back(Wt::Dbo::ptr_base*&&)()
(gdb)英国电信
#0 0x000000000041a4a8无效std::vector::emplace_back(Wt::Dbo::ptr_base*&&)()
#std::vector::push_back(Wt::Dbo::ptr_base*&&)中的1 0x0000000000419c8e
#2 0x0000000000419682在void中Wt::Dbo::Session::implSave(Wt::Dbo::MetaDbo&)()
#Wt::Dbo::MetaDbo::flush()中的3 0x0000000000418c4e()
#Wt::Dbo::Session::flush()中的4 0x00007ffff6c8eae2()
from/usr/lib/libwtdbo.so.38
#Wt::Dbo::Transaction::Impl::commit()中的5 0x00007ffff6c9d14d()
from/usr/lib/libwtdbo.so.38
#Wt::Dbo::Transaction::commit()中的6 0x00007ffff6c9d1a9()
from/usr/lib/libwtdbo.so.38
#7 0x00000000004063d2正在运行()()
#8 0x0000000000407066主管道()
(gdb)
供您参考,以下是我的代码:(我希望这能持续一段时间,但如果它停止工作,请告诉我)。还有我的Makefile:我使用
$gdb--args./flashcard--docroot运行gdb--http地址0.0.0.0--http端口9090

您可以看到第80行的输出,但看不到第83行的输出,gdb的回溯表明第81行(commit)是问题所在。如果我删除第81行,使事务由于超出范围而提交,同样的问题也会存在,但它来自事务的析构函数

我使用WT3.3.4-4、gcc 5.1.0-5运行archlinux,使用
-std=c++0x
编译


我能想象的唯一一件事是,如果std::vector与二进制文件不兼容?

重新编译Wt应该可以解决这个问题。不要使用通过archlinux(pacman)打包的Wt,而是从源代码处编译Wt


可能在某些地方存在ABI差异,应该通过使用相同的标准库和boost库在您自己的机器上编译所有内容来解决。

重新编译Wt应该可以解决这个问题。不要使用通过archlinux(pacman)打包的Wt,而是从源代码处编译Wt


可能在某些地方存在ABI差异,应该通过使用相同的标准库和boost库在您自己的机器上编译所有内容来解决。

我使用最新的Wt(来自git)编译并运行了此文件,并在其上运行了我能想到的所有检查程序。代码似乎很好。我使用以下命令编译:clang++-g--std=c++11tmp.cpp-lwt-lwthttp-lwtdbo-lwtdbosqlite3;我建议您做一个makeclean,也许可以像上面那样使用普通的旧命令行进行编译。也许升级Wt?谢谢你的检查。答案已经找到了,而你实际上是在正确的轨道上!我用最新的Wt(来自git)编译并运行了它,并在上面运行了我能想到的所有检查程序。代码似乎很好。我使用以下命令编译:clang++-g--std=c++11tmp.cpp-lwt-lwthttp-lwtdbo-lwtdbosqlite3;我建议您做一个makeclean,也许可以像上面那样使用普通的旧命令行进行编译。也许升级Wt?谢谢你的检查。答案已经找到了,而你实际上是在正确的轨道上!
(gdb) run
Starting program: /home/lawsa/sources/memory/dist/flashcard --docroot . --http-address 0.0.0.0 --http-port 9090
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
begin transaction
create table "user" (
  "id" integer primary key autoincrement,
  "version" integer not null,
  "name" text not null,
  "password" text not null,
  "role" integer not null,
  "karma" integer not null
)
commit transaction
created tables
ending transaction

Program received signal SIGSEGV, Segmentation fault.
0x000000000041a4a8 in void std::vector<Wt::Dbo::ptr_base*, std::allocator<Wt::Dbo::ptr_base*> >::emplace_back<Wt::Dbo::ptr_base*>(Wt::Dbo::ptr_base*&&) ()
(gdb) bt
#0  0x000000000041a4a8 in void std::vector<Wt::Dbo::ptr_base*, std::allocator<Wt::Dbo::ptr_base*> >::emplace_back<Wt::Dbo::ptr_base*>(Wt::Dbo::ptr_base*&&) ()
#1  0x0000000000419c8e in std::vector<Wt::Dbo::ptr_base*, std::allocator<Wt::Dbo::ptr_base*> >::push_back(Wt::Dbo::ptr_base*&&) ()
#2  0x0000000000419682 in void Wt::Dbo::Session::implSave<User>(Wt::Dbo::MetaDbo<User>&) ()
#3  0x0000000000418c4e in Wt::Dbo::MetaDbo<User>::flush() ()
#4  0x00007ffff6c8eae2 in Wt::Dbo::Session::flush() ()
   from /usr/lib/libwtdbo.so.38
#5  0x00007ffff6c9d14d in Wt::Dbo::Transaction::Impl::commit() ()
   from /usr/lib/libwtdbo.so.38
#6  0x00007ffff6c9d1a9 in Wt::Dbo::Transaction::commit() ()
   from /usr/lib/libwtdbo.so.38
#7  0x00000000004063d2 in run() ()
#8  0x0000000000407066 in main ()
(gdb)