簡體   English   中英

我可以從終端進行編譯時在Linux&Eclipse中進行編譯

[英]Compiling in Linux&Eclipse when I can compile from terminal

因此,我終於能夠下載舊版本的Webkit並使用經典版本在終端中對其進行編譯(修復了100個錯誤之后):

./configure
make

現在既然有了程序的源代碼,我的目標就是調試它(在C ++代碼和內容上設置斷點)。 由於我是第一次使用Linux,因此我下載了eclipse以具有直觀的GUI。 但是,當我導入項目時,我似乎無法編譯它。 包含錯誤無處不在,無論嘗試多少,我都無法解決。

在終端中可以在eclipse中編譯它嗎? 另外,還有另一種方法可以調試程序嗎?

非常感謝!

好的,我設法編譯並鏈接了代碼,以便可以使用如下所示的符號調試信息將其加載到gdb中:

  1. 我下載並提取了http://webkitgtk.org/releases/webkitgtk-2.0.4.tar.xz
  2. 我運行./configure並手動進行了apt-get install (或者在下載並編譯了ICU的情況下)所有必需的依賴項。
  3. 然后,我對GNUmakefile進行了以下修改,將-ggdb添加到每個可變的global_cppflags global_cflagsglobal_cxxflags (為了加快構建速度,我從global_cxxflags刪除了所有警告標志,不確定是否會有所作為。您可能應該恢復這些(如果您要針對此版本進行開發)

GNUmakefile

global_cppflags := -ggdb -fno-exceptions -DBUILDING_CAIRO__ -DBUILDING_GTK__ \
         $(am__append_1) $(am__append_2)
#global_cppflags := -Wall -W -Wcast-align -Wchar-subscripts \
#       -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k \
#       -Wundef -Wmissing-format-attribute -Wpointer-arith \
#       -Wwrite-strings -Wno-unused-parameter -Wno-parentheses \
#       -fno-exceptions -DBUILDING_CAIRO__ -DBUILDING_GTK__ \
#       $(am__append_1) $(am__append_2)
global_cflags := -ggdb
global_cxxflags := -ggdb -fno-rtti

然后,要測試調試符號是否包含在編譯器和鏈接器輸出中,我按以下方式運行了gdb

~/dev/webkitgtk-2.0.4$ gdb ./Programs/MiniBrowser -d ./Tools/MiniBrowser/gtk/ 
GNU gdb (Ubuntu 7.8-1ubuntu4) 7.8.0.20141001-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./Programs/MiniBrowser...done.
(gdb) l
188                                                         "WebKitSettings writable properties for default WebKitWebView",
189                                                         "WebKitSettings properties",
190                                                         webkitSettings,
191                                                         NULL);
192     g_option_group_add_entries(webSettingsGroup, optionEntries);
193     g_free(optionEntries);
194 
195     /* Option context takes ownership of the group. */
196     g_option_context_add_group(context, webSettingsGroup);
197 
(gdb) l
198     return TRUE;
199 }
200 
201 int main(int argc, char *argv[])
202 {
203     gtk_init(&argc, &argv);
204 
205     GOptionContext *context = g_option_context_new(NULL);
206     g_option_context_add_main_entries(context, commandLineOptions, 0);
207     g_option_context_add_group(context, gtk_get_option_group(TRUE));
(gdb) 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM