2015-07-01 13 views
1

http://www.webtoolkit.eu/wt/doc/tutorial/dbo.html重量段錯誤的ORM事務提交

在本教程中使用的例子完整的源代碼是WT的examples/feature/dbo/文件夾可作爲現成的運行程序。

我試圖從該目錄運行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行,以便由於超出範圍而提交事務,則存在同樣的問題,但它來自事務的析構函數。

我正在運行archlinux與Wt 3.3.4-4,gcc 5.1.0-5,編譯-std=c++0x

我能想象的唯一事情是,如果有一些與std :: vector的二進制不兼容?

+0

我編譯並運行了最新的Wt(來自git),並運行了我能想到的每個檢查器。代碼看起來很好。我編譯:clang ++ -g --std = C++ 11 tmp.cpp -lwt -lwthttp -lwtdbo -lwtdbosqlite3;我會建議做一個乾淨的,也許編譯與上面的普通舊命令行。也許升級Wt? – matiu

+0

謝謝您的檢查。答案已經找到,而你實際上處於正確的軌道上! –

回答

0

重新編譯Wt應該解決這個問題。不要使用通過archlinux(pacman)封裝的Wt,而要從源代碼編譯Wt。

在某些地方可能存在ABI差異,應該使用相同的標準庫和增強庫編譯自己機器上的所有內容。