2014-04-09 37 views
0

我試圖在庫更新後編譯大項目,其中一個是GTK - 我需要將項目從GTK 2.x遷移到GTK 3.x.編譯器不提供任何語法錯誤或產生錯誤信息,但它檔與此:GCC運行到內存不足GTK + 3

g++ -DBOOST_ASIO_DYN_LINK -DBOOST_FILESYSTEM_VERSION=3 -DBOOST_LOG_DYN_LINK 
-DBOOST_LOG_USE_NATIVE_SYSLOG -DMOKMXRP -D__DEBUG -D__STDC_LIMIT_MACROS 
-Wno-missing-braces -Wextra -Wno-missing-field-initializers -Wformat=2 -Wswitch-default 
-Wswitch-enum -Wcast-align -Wpointer-arith -Wstrict-overflow=5 -Wundef -Wcast-qual 
-Wshadow -Wunreachable-code -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 
-Wredundant-decls -Wwrite-strings -Winit-self -rdynamic -O2 -ggdb3 -fstrict-aliasing 
-g -I./include -I/usr/include/websocketpp -I/usr/include/re2 -I/usr/include/gtk-3.0 
-I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 
-I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 
-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz 
-I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 
-I/usr/include/json-glib-1.0 -I/usr/include/libtorrent -I/usr/include/jsoncpp 
-I/usr/include/webkitgtk-3.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 
    -UTORRENT_NO_DEPRECATE -o CMakeFiles/temp_lib.dir/CPlayer/CWebView.cpp.o 
-c ./CPlayer/CWebView.cpp 
    In file included from /usr/include/boost/smart_ptr/shared_ptr.hpp:30:0, 
        from /usr/include/boost/shared_ptr.hpp:17, 
        from /usr/include/boost/date_time/time_clock.hpp:17, 
        from /usr/include/boost/thread/thread_time.hpp:9, 
        from /usr/include/boost/thread/lock_types.hpp:18, 
        from /usr/include/boost/thread/pthread/thread_data.hpp:12, 
        from /usr/include/boost/thread/thread_only.hpp:17, 
        from /usr/include/boost/thread/thread.hpp:12, 
        from /home/constantine/Downloads/digbil_player/include/digbil/digbilplayer/CWebView.hpp:20, 
        from /home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp:1: 
    /usr/include/boost/checked_delete.hpp: In instantiation of 'void boost::checked_delete(_GdkCursor*)': 
    /usr/include/boost/smart_ptr/detail/shared_count.hpp:134:38: required from 'boost::detail::shared_count::shared_count(_GdkCursor*)' 

這檔存在,直到它擊中。在我開始使用GTK3頭文件而不是GTK2文件後發生了。

EDIT 1:

下面是相同的命令與-v選項的輸出:

Using built-in specs. 
COLLECT_GCC=/usr/bin/g++ 
Target: i686-linux-gnu 
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu 
Thread model: posix 
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
COLLECT_GCC_OPTIONS='-v' '-D' 'BOOST_ASIO_DYN_LINK' '-D' 'BOOST_FILESYSTEM_VERSION=3' '-D' 'BOOST_LOG_DYN_LINK' '-D' 'BOOST_LOG_USE_NATIVE_SYSLOG' '-D' 'MOKMXRP' '-D' '__DEBUG' '-D' '__STDC_LIMIT_MACROS' '-Wno-missing-braces' '-Wextra' '-Wno-missing-field-initializers' '-Wformat=2' '-Wswitch-default' '-Wswitch-enum' '-Wcast-align' '-Wpointer-arith' '-Wstrict-overflow=5' '-Wundef' '-Wcast-qual' '-Wshadow' '-Wlogical-op' '-Wfloat-equal' '-Wstrict-aliasing=2' '-Wredundant-decls' '-Wwrite-strings' '-Winit-self' '-rdynamic' '-O2' '-ggdb3' '-fstrict-aliasing' '-g' '-I' '/home/constantine/Downloads/digbil_player/include' '-I' '/usr/include/websocketpp' '-I' '/usr/include/re2' '-I' '/usr/include/gtk-3.0' '-I' '/usr/include/atk-1.0' '-I' '/usr/include/at-spi2-atk/2.0' '-I' '/usr/include/pango-1.0' '-I' '/usr/include/gio-unix-2.0' '-I' '/usr/include/cairo' '-I' '/usr/include/gdk-pixbuf-2.0' '-I' '/usr/include/glib-2.0' '-I' '/usr/lib/i386-linux-gnu/glib-2.0/include' '-I' '/usr/include/harfbuzz' '-I' '/usr/include/freetype2' '-I' '/usr/include/pixman-1' '-I' '/usr/include/libpng12' '-I' '/usr/include/json-glib-1.0' '-I' '/usr/include/libtorrent' '-I' '/usr/include/jsoncpp' '-I' '/usr/include/webkitgtk-3.0' '-I' '/usr/include/libsoup-2.4' '-I' '/usr/include/libxml2' '-U' 'TORRENT_NO_DEPRECATE' '-o' 'CMakeFiles/digbilplayer_temp_lib.dir/CPlayer/CWebView.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=i686' 
/usr/lib/gcc/i686-linux-gnu/4.8/cc1plus -quiet -v -I /home/constantine/Downloads/digbil_player/include -I /usr/include/websocketpp -I /usr/include/re2 -I /usr/include/gtk-3.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/pango-1.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cairo -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/glib-2.0 -I /usr/lib/i386-linux-gnu/glib-2.0/include -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/pixman-1 -I /usr/include/libpng12 -I /usr/include/json-glib-1.0 -I /usr/include/libtorrent -I /usr/include/jsoncpp -I /usr/include/webkitgtk-3.0 -I /usr/include/libsoup-2.4 -I /usr/include/libxml2 -imultiarch i386-linux-gnu -dD -D_GNU_SOURCE -D BOOST_ASIO_DYN_LINK -D BOOST_FILESYSTEM_VERSION=3 -D BOOST_LOG_DYN_LINK -D BOOST_LOG_USE_NATIVE_SYSLOG -D MOKMXRP -D __DEBUG -D __STDC_LIMIT_MACROS -U TORRENT_NO_DEPRECATE /home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp -quiet -dumpbase CWebView.cpp -mtune=generic -march=i686 -auxbase-strip CMakeFiles/digbilplayer_temp_lib.dir/CPlayer/CWebView.cpp.o -ggdb3 -g -O2 -Wno-missing-braces -Wextra -Wno-missing-field-initializers -Wformat=2 -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wstrict-overflow=5 -Wundef -Wcast-qual -Wshadow -Wlogical-op -Wfloat-equal -Wstrict-aliasing=2 -Wredundant-decls -Wwrite-strings -Winit-self -version -fstrict-aliasing -fstack-protector -Wformat -Wformat-security -o /tmp/ccbR67KG.s 
GNU C++ (Ubuntu 4.8.2-19ubuntu1) version 4.8.2 (i686-linux-gnu) 
    compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1 
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 
ignoring duplicate directory "/usr/include/i386-linux-gnu/c++/4.8" 
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu" 
ignoring nonexistent directory "/usr/lib/gcc/i686-linux-gnu/4.8/../../../../i686-linux-gnu/include" 
#include "..." search starts here: 
#include <...> search starts here: 
/home/constantine/Downloads/digbil_player/include 
/usr/include/websocketpp 
/usr/include/re2 
/usr/include/gtk-3.0 
/usr/include/atk-1.0 
/usr/include/at-spi2-atk/2.0 
/usr/include/pango-1.0 
/usr/include/gio-unix-2.0 
/usr/include/cairo 
/usr/include/gdk-pixbuf-2.0 
/usr/include/glib-2.0 
/usr/lib/i386-linux-gnu/glib-2.0/include 
/usr/include/harfbuzz 
/usr/include/freetype2 
/usr/include/pixman-1 
/usr/include/libpng12 
/usr/include/json-glib-1.0 
/usr/include/libtorrent 
/usr/include/jsoncpp 
/usr/include/webkitgtk-3.0 
/usr/include/libsoup-2.4 
/usr/include/libxml2 
/usr/include/c++/4.8 
/usr/include/i386-linux-gnu/c++/4.8 
/usr/include/c++/4.8/backward 
/usr/lib/gcc/i686-linux-gnu/4.8/include 
/usr/local/include 
/usr/lib/gcc/i686-linux-gnu/4.8/include-fixed 
/usr/include/i386-linux-gnu 
/usr/include 
End of search list. 
GNU C++ (Ubuntu 4.8.2-19ubuntu1) version 4.8.2 (i686-linux-gnu) 
    compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1 
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 
Compiler executable checksum: b76bde06a7376488e4b30f7e8789f5ce 
/home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp: In static member function 'static const OpaqueJSValue* CWebView::OnCampaignEnded(JSContextRef, JSObjectRef, JSObjectRef, size_t, const OpaqueJSValue* const*, const OpaqueJSValue**)': 
/home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp:791:13: warning: converting 'false' to pointer type 'JSValueRef {aka const OpaqueJSValue*}' [-Wconversion-null] 
     return false; 
      ^
In file included from /usr/include/boost/smart_ptr/shared_ptr.hpp:30:0, 
       from /usr/include/boost/shared_ptr.hpp:17, 
       from /usr/include/boost/date_time/time_clock.hpp:17, 
       from /usr/include/boost/thread/thread_time.hpp:9, 
       from /usr/include/boost/thread/lock_types.hpp:18, 
       from /usr/include/boost/thread/pthread/thread_data.hpp:12, 
       from /usr/include/boost/thread/thread_only.hpp:17, 
       from /usr/include/boost/thread/thread.hpp:12, 
       from /home/constantine/Downloads/digbil_player/include/digbil/digbilplayer/CWebView.hpp:20, 
       from /home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp:1: 
/usr/include/boost/checked_delete.hpp: In instantiation of 'void boost::checked_delete(_GdkCursor*)': 
/usr/include/boost/smart_ptr/detail/shared_count.hpp:134:38: required from 'boost::detail::shared_count::shared_count(_GdkCursor*)' 

編輯2

clang輸出:

In file included from /home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp:1: 
In file included from /home/constantine/Downloads/digbil_player/include/digbil/digbilplayer/CWebView.hpp:20: 
In file included from /usr/include/boost/thread/thread.hpp:12: 
In file included from /usr/include/boost/thread/thread_only.hpp:17: 
In file included from /usr/include/boost/thread/pthread/thread_data.hpp:12: 
In file included from /usr/include/boost/thread/lock_types.hpp:18: 
In file included from /usr/include/boost/thread/thread_time.hpp:9: 
In file included from /usr/include/boost/date_time/time_clock.hpp:17: 
In file included from /usr/include/boost/shared_ptr.hpp:17: 
In file included from /usr/include/boost/smart_ptr/shared_ptr.hpp:30: 
/usr/include/boost/checked_delete.hpp:32:41: error: invalid application of 'sizeof' to an incomplete type '_GdkCursor' 
    typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; 
             ^~~~~~~~~ 
/usr/include/boost/smart_ptr/detail/shared_count.hpp:134:20: note: in instantiation of function template specialization 'boost::checked_delete<_GdkCursor>' requested here 
      boost::checked_delete(p); 
       ^
/usr/include/boost/smart_ptr/shared_ptr.hpp:276:5: note: in instantiation of function template specialization 'boost::detail::shared_count::shared_count<_GdkCursor>' requested here 
    boost::detail::shared_count(p).swap(pn); 
    ^
/usr/include/boost/smart_ptr/shared_ptr.hpp:354:24: note: in instantiation of function template specialization 'boost::detail::sp_pointer_construct<_GdkCursor, _GdkCursor>' requested here 
     boost::detail::sp_pointer_construct(this, p, pn); 
        ^
/home/constantine/Downloads/digbil_player/src/digbilplayer/CPlayer/CWebView.cpp:161:23: note: in instantiation of function template specialization 'boost::shared_ptr<_GdkCursor>::shared_ptr<_GdkCursor>' requested here 
    mpDefaultCursor = GdkCursor_Ptr(gdk_cursor_new(GDK_BLANK_CURSOR)); 
        ^
/usr/include/gtk-3.0/gdk/gdktypes.h:118:16: note: forward declaration of '_GdkCursor' 
typedef struct _GdkCursor GdkCursor; 

編輯3

包括:

#include <string> 
#include <vector> 

#include <gtk/gtk.h> 
//#include <gdk/gdkkeysyms.h> 
#include <gdk/gdk.h> 
#include <webkit/webkit.h> 
#include <webkit/webkitwebinspector.h> 
#include <JavaScriptCore/JavaScript.h> 
#include <JavaScriptCore/JSValueRef.h> 
#include <JavaScriptCore/JSContextRef.h> 
#include <boost/thread/thread.hpp> 
#include <boost/thread/mutex.hpp> 
#include <boost/thread/recursive_mutex.hpp> 
#include <boost/tuple/tuple.hpp> 
#include <cups/cups.h> 
#include <cups/ppd.h> 
#include <json-glib/json-glib.h> 
#include <digbil/Typedefs.hpp> 
#include <digbil/digbilplayer/CViewBase.hpp> 
#include <digbil/digbilplayer/CBasicDB.hpp> 
#include <digbil/digbilplayer/CViewUtil.hpp> 
#include <digbil/digbilplayer/CWsPlatformUtil.hpp> 
#include <digbil/digbilplayer/PlayerOption.hpp> 
#include <digbil/digbilplayer/CUtil.hpp> 
#include <digbil/digbilplayer/ILayout.hpp> 

代碼有關GDK:

void CWebView::InitWindows(CViewBase::WndStyle style) 
{ 
    CSingletonFab::GetLog().Debug(__func__, CLog::sJustSteppedIn, sClsName); 

    //Set up windows. 
    mpPlayerWnd = WebViewWrapper_Ptr(new CWebView::WebViewWrapper); 

    gtk_window_set_keep_above(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get()), TRUE); 
    /// count how many screen and monitor and move this window to 2nd screen by them 
    int intXpos = 0, intYpos = 0; 
    if (mMonitorNum == 2) { 
     GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get())); 
     /// if mOptionArgs.mMonitorNum higher than 2, we need use intMonitorNum. 
//  size_t intMonitorNum = gdk_screen_get_n_monitors(pScreen); 
     GdkRectangle dest; 
     try { 
      gdk_screen_get_monitor_geometry(pScreen,(gint)1,&dest); 
      intXpos = dest.x; 
      intYpos = dest.y; 
     } catch (...) { 
      CSingletonFab::GetLog().Error(__func__, "An exception is thrown", 
             __LINE__, __FILE__, sClsName); 
      intXpos = 1920; 
      intYpos = 0; 
     } 
    } 

    CSingletonFab::GetLog().Debug(__func__, "intXpos: " + boost::lexical_cast<string>(intXpos) + 
           "intYpos: " + boost::lexical_cast<string>(intYpos), 
           sClsName); 
    gtk_window_move(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get()),intXpos,intYpos); 

    if (style == FULLSCREEN) 
    { 
     gtk_window_fullscreen(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get())); 
     gtk_window_set_decorated(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get()), FALSE); 
    } else if (style == WND) { 
     gtk_window_set_default_size(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get()), 
       800, 
       600); 
    } else if (style == ALLSCREEN) { 
     gtk_widget_set_size_request(mpPlayerWnd->mpOuterWnd.get(), 
            mMonitorWidthSize, mMonitorHeightSize); 
     gtk_window_set_decorated(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get()), FALSE); 
    } 

    //Init default cursor. 
    mpDefaultCursor = GdkCursor_Ptr(gdk_cursor_new(GDK_BLANK_CURSOR)); 
    g_timeout_add_seconds(FULLSCREEN_CURSOR_TIMEOUT, (GSourceFunc)HideCursor, 
      NULL); 

    // disable listen mouse motion event, control by unclutter 
// mMotionEventCallBackID = g_signal_connect(G_OBJECT(mpPlayerWnd->mpOuterWnd), 
//              "motion-notify-event", 
//              G_CALLBACK(OnMotionEventCallBack),NULL); 

    // Causes widget to have the keyboard focus for the GtkWindow it's inside 
    gtk_widget_grab_focus(GTK_WIDGET(mpPlayerWnd->mpOuterWnd.get())); 
    // GTK_POLICY_NEVER: scrollbar is never presented 
    gtk_scrolled_window_set_policy(
      GTK_SCROLLED_WINDOW (mpPlayerWnd->mpScrollerWnd.get()), GTK_POLICY_NEVER, 
      GTK_POLICY_NEVER); 
    // GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position. 
    // disable this setting, change to gtk_window_move() to setup the window position. 
// gtk_window_set_position(GTK_WINDOW (mpPlayerWnd->mpOuterWnd.get()), 
//   GTK_WIN_POS_CENTER_ALWAYS); //GTK_WIN_POS_CENTER_ALWAYS or GTK_WIN_POS_MOUSE 
    gtk_container_add(GTK_CONTAINER (mpPlayerWnd->mpScrollerWnd.get()), 
      GTK_WIDGET(mpWebView.get())); 

    // GDK_KEY_PRESS_MASK: receive key press events 
    gtk_widget_set_events(GTK_WIDGET(mpPlayerWnd->mpOuterWnd.get()), 
      GDK_KEY_PRESS_MASK); 
    // GDK_KEY_RELEASE_MASK: receive key release events 
    gtk_widget_set_events(GTK_WIDGET(mpPlayerWnd->mpOuterWnd.get()), 
      GDK_KEY_RELEASE_MASK); 
    gtk_container_add(GTK_CONTAINER (mpPlayerWnd->mpOuterWnd.get()), 
      mpPlayerWnd->mpScrollerWnd.get()); 

    BOOST_ASSERT_MSG(mpWebView != 0, "mpWebView SHOULD != 0"); 
    BOOST_ASSERT_MSG(mpPlayerWnd->mpOuterWnd != 0, "mpPlayerWnd->mpOuterWnd SHOULD != 0"); 
    BOOST_ASSERT_MSG(mpPlayerWnd->mpScrollerWnd != 0, "mpPlayerWnd->mpScrollerWnd SHOULD != 0"); 

    g_signal_connect(mpPlayerWnd->mpOuterWnd.get(), "delete-event", 
      G_CALLBACK(OnWebviewDestroy), NULL); 
    //g_signal_connect(mpPlayerWnd->mpOuterWnd,"expose-event",G_CALLBACK(OnExposeEventDummy),NULL); 
    //g_signal_connect(mpPlayerWnd->mpScrollerWnd,"expose-event",G_CALLBACK(OnExposeEventDummy),NULL); 
    gtk_window_move(GTK_WINDOW(mpPlayerWnd->mpOuterWnd.get()),intXpos,intYpos); 

    CSingletonFab::GetLog().Debug(__func__, CLog::sSuccess, sClsName); 
} 
+0

需要更多信息。讓編譯器更健談。 – drahnr

+0

這不會產生任何有助於診斷的信息。 – drahnr

+0

那我還能發佈什麼? –

回答

0

[解決]:

顯然是不一致是因爲boost::shared_ptr打完改變聲明f rom boost::shared_ptr<GdkCursor>GdkCursor*一切正常。