1

http://www.webtoolkit.eu/wt/doc/tutorial/dbo.html

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

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

(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)

供您参考,这是我的代码:http ://sprunge.us/PYSO (我希望能持续一段时间,但如果它停止工作,请告诉我)。还有我的 Makefile:http ://sprunge.us/UCge我运行 gdb 使用$ gdb --args ./flashcard --docroot . --http-address 0.0.0.0 --http-port 9090

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

我正在使用 Wt 3.3.4-4、gcc 5.1.0-5 运行 archlinux,并使用-std=c++0x.

我唯一能想象的是,如果与 std::vector 存在一些二进制不兼容?

4

1 回答 1

0

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

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

于 2015-07-14T13:27:28.933 回答