码迷,mamicode.com
首页 > Windows程序 > 详细

gtk+-3.21.4 static build step in windows XP

时间:2016-08-13 07:43:15      阅读:510      评论:0      收藏:0      [点我收藏+]

标签:

In recent days the weather is very hot Unable to sleep properly Under the state of daze research gtk3 static compiler.
-------------------------------------------------------------------------------------------------------
build static libs
-------------------------------------------------------------------------------------------------------
export LIBFFI_CFLAGS=" -I/usr/local/lib/libffi-3.2.1/include " export LIBFFI_LIBS=" -lffi " export ZLIB_CFLAGS=-I/usr/local/include export ZLIB_LIBS=-lz export CFLAGS=" -I/usr/local/include -O2 -Wall -march=i686 -mms-bitfields -mthreads -static " export CPPFLAGS=" -I/usr/local/include " export LDFLAGS=" -L/usr/local/lib " export LIBS=‘ -lpsapi -lpng -lffi -lgdiplus -luuid -lexpat -lgdi32 -lmsimg32  -lpixman-1 -lfontconfig -lxml2 -llzma -lmswsock -lfreetype -lpng16 -lz -lharfbuzz -lharfbuzz-icu -lglib-2.0 -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -liconv -lpthread ‘

./configure --prefix=/usr/local --enable-static --disable-shared --with-included-immodules=ime --disable-gtk-doc

GTK+ 3.21.4
===========

GDK backends:         win32
Print backends:       file lpr
Dynamic modules:      yes
Included immodules:   ime
colord support:       no
Introspection:        no
Debugging:            yes
Documentation:        no

---------------------------------------------------------------------------------------------
modify ./makefile
SRC_SUBDIRS = gdk gtk libgail-util modules demos 
---------------------------------------------------------------------------------------------
__declspec(dllexport)                    fix to -->   __attribute__((visibility ("default")))
__stdcall _export                        fix to -->   __attribute__((visibility ("default")))
define PNG_IMPEXP __declspec(dllimport)  fix to -->   define PNG_IMPEXP
__attribute__((visibility ("hidden")))   fix to -->   __attribute__((visibility ("default")))
delete all DllMain function
---------------------------------------------------------------------------------------------
gtk/gtksearchengine.c  error: expected identifier before numeric constant
---------------------------------------------------------------------------------------------
enum 
{
  HITS_ADDED,
  HITS_SUBTRACTED,
  FINISHED,
  ERROR_S,          ERROR fix to -> ERROR_S
  LAST_SIGNAL
}; 

signals[ERROR_S] =
             ^^
g_signal_emit (engine, signals[ERROR_S], 0, error_message);
                                    ^^
---------------------------------------------------------------------------------------------
gtk/gtkspinbutton.c  error: expected identifier before numeric constant
---------------------------------------------------------------------------------------------
/* Signals */
enum
{
  INPUT_S,                INPUT fix to -> INPUT_S
  OUTPUT,
  VALUE_CHANGED,
  CHANGE_VALUE,
  WRAPPED,
  LAST_SIGNAL
};

spinbutton_signals[INPUT_S] =
                        ^^
g_signal_emit (spin_button, spinbutton_signals[INPUT_S], 0, &val, &return_val);
                                                    ^^
---------------------------------------------------------------------------------------------
gtkroundedbox.c:229:3: error: ‘Arc‘ redeclared as different kind of symbol
 } Arc;
   ^
In file included from d:\msys\mingw\i686-w64-mingw32\include\windows.h:71:0,
                 from D:/MSYS/local/include/glib-2.0/glib/glib-init.h:32,
                 from D:/MSYS/local/include/glib-2.0/glib.h:30,
                 from D:/MSYS/local/include/glib-2.0/gobject/gbinding.h:28,
                 from D:/MSYS/local/include/glib-2.0/glib-object.h:23,
                 from gtkroundedboxprivate.h:21,
                 from gtkroundedbox.c:20:
d:\msys\mingw\i686-w64-mingw32\include\wingdi.h:2678:28: note: previous declaration of ‘Arc‘ was here
   WINGDIAPI WINBOOL WINAPI Arc(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4);
---------------------------------------------------------------------------------------------
gtkroundedbox.c
} Arc_L;
arc_path_hash (Arc_L *arc)
  return mem_hash ((gconstpointer)arc, sizeof (Arc_L));
arc_path_equal (Arc_L *arc1,
                Arc_L *arc2)
  Arc_L key;
  memset (&key, 0, sizeof (Arc_L));
---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------
gtk/updateiconcache.c   ->  gtk-update-icon-cache.exe
---------------------------------------------------------------------------------------------
#include <glib.h>             <-- add
#include <glib-object.h>      <-- add

int
main (int argc, char **argv)
{
  g_clock_win32_init ();      <-- add
  g_thread_win32_init ();     <-- add
  glib_init ();               <-- add
  gobj_init ();               <-- add
  gchar *path;
---------------------------------------------------------------------------------------------
gtk/queryimmodules.c   ->  gtk-query-immodules-2.0.exe
---------------------------------------------------------------------------------------------
#include <glib.h>             <-- add
#include <glib-object.h>      <-- add

int main (int argc, char **argv)
{
  g_clock_win32_init ();      <-- add
  g_thread_win32_init ();     <-- add
  glib_init ();               <-- add
  gobj_init ();               <-- add
  char *cwd;
---------------------------------------------------------------------------------------------
gtk/gtk-launch.c   ->  gtk-launch.exe
---------------------------------------------------------------------------------------------
#include <glib.h>       
#include <glib-object.h>

int
main (int argc, char *argv[])
{
  g_clock_win32_init ();
  g_thread_win32_init ();
  glib_init ();
  gobj_init ();  
---------------------------------------------------------------------------------------------
gtk/encodesymbolic.c  -> gtk-encode-symbolic-svg.exe
#include <glib.h>       
#include <glib-object.h>

int
main (int argc, char *argv[])
{
  g_clock_win32_init ();
  g_thread_win32_init ();
  glib_init ();
  gobj_init ();  
---------------------------------------------------------------------------------------------
gtk/gtk-builder-tool.c
int main (int argc, const char *argv[])
{
  g_set_prgname ("gtk-builder-tool");       fix to -> gtk_init (&argc, &argv);
  gtk_init (NULL, NULL);                    fix to -> g_set_prgname ("gtk-builder-tool");
---------------------------------------------------------------------------------------------
demos\gtk-demo\main.c
---------------------------------------------------------------------------------------------
int
main (int argc, char **argv)
{
  gtk_init (&argc, &argv);  <-- add
  GtkApplication *app;
---------------------------------------------------------------------------------------------
  
*********************** skip the part *******************************************************
---------------------------------------------------------------------------------------------
undefined reference to `IID_IShellLinkW‘         -luuid
undefined reference to `hb_icu_script_to_script‘ -lharfbuzz  -lharfbuzz-icu 
undefined reference to `__gxx_personality_sj0‘   -lsupc++ 
---------------------------------------------------------------------------------------------
demos\gtk-demo\main.c
---------------------------------------------------------------------------------------------
#include <glib.h>             <-- add
#include <glib-object.h>      <-- add

int
main (int argc, char **argv)
{
  g_clock_win32_init ();      <-- add
  g_thread_win32_init ();     <-- add
  glib_init ();               <-- add
  gobj_init ();               <-- add
  GtkWidget *window;
---------------------------------------------------------------------------------------------
gtk/gtkmarshalers.c:(.text+0xc10): multiple definition of `_gtk_marshal_OBJECT__VOID‘
perf/marshalers.o:marshalers.c:(.text+0x0): first defined here
---------------------------------------------------------------------------------------------
gdkmain-win32.c:(.text+0x0): multiple definition of `DllMain@12‘
gtkmain.c:(.text+0x8b0): first defined here
---------------------------------------------------------------------------------------------
  
---------------------------------------------------------------------------------------------
tests/testmultidisplay.c: In function ‘main‘:
testmultidisplay.c:104:14: error: expected identifier or ‘(‘ before numeric constant
   GdkScreen *scr2 = NULL; /* Quiet GCC */
              ^
testmultidisplay.c:145:13: error: lvalue required as left operand of assignment
        scr2 = gdk_display_get_default_screen (dpy2);
             ^
testmultidisplay.c:176:26: warning: passing argument 1 of ‘make_selection_dialog‘ makes pointer from integer without a cast [-Wint-conversion]
   make_selection_dialog (scr2, entry, entry2);
                          ^
GdkScreen *scr2L = NULL;     scr2 fix to -> scr2L

testmultidisplay.c:56:1: note: expected ‘GdkScreen * {aka struct _GdkScreen *}‘ but argument is of
type ‘int‘
 make_selection_dialog (GdkScreen * screen,
---------------------------------------------------------------------------------------------
tests/testselection.c
---------------------------------------------------------------------------------------------
typedef enum {
  SEL_TYPE_NONE,
  APPLE_PICT,
  ATOM_L,             ATOM   fix to -> ATOM_L
  ATOM_PAIR,
  BITMAP_L,           BITMAP fix to -> BITMAP_L
  C_STRING,
*********************************************************************************************

---------------------------------------------------------------------------------------------
gtkmain.c
---------------------------------------------------------------------------------------------
static HMODULE gtk_dll = NULL;

// BOOL WINAPI
// DllMain (HINSTANCE hinstDLL,
	 // DWORD     fdwReason,
	 // LPVOID    lpvReserved)
// {
  // switch (fdwReason)
    // {
    // case DLL_PROCESS_ATTACH:
      // gtk_dll = (HMODULE) hinstDLL;
      // break;
    // }

  // return TRUE;
// }
---------------------------------------------------------------------------------------------
gdkmain-win32.c
---------------------------------------------------------------------------------------------
// int __stdcall
// DllMain (HINSTANCE hinstDLL,
	 // DWORD     dwReason,
	 // LPVOID    reserved)
// {
  // _gdk_dll_hinstance = hinstDLL;

  // return TRUE;
// }
---------------------------------------------------------------------------------------------
gdk/win32/gdkglobals-win32.c
---------------------------------------------------------------------------------------------
HINSTANCE	  _gdk_dll_hinstance = NULL;
---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------
gtkclipboard.c:(.text+0x16b8): undefined reference to `_imp__gdk_threads_unlock‘
gtkclipboard.c:(.text+0x16d1): undefined reference to `_imp__gdk_threads_lock‘
---------------------------------------------------------------------------------------------
gdktypes.h
---------------------------------------------------------------------------------------------
#ifdef G_OS_WIN32
#  ifdef GDK_COMPILATION
#    define GDKVAR __declspec(dllexport)         -> __attribute__((visibility ("default")))
#  else
#    define GDKVAR extern __declspec(dllimport)  ->  define GDKVAR extern
#  endif
#else
#  define GDKVAR extern
#endif
---------------------------------------------------------------------------------------------
gtkdebug.h
gtkmain.h
gtktexttypes.h
---------------------------------------------------------------------------------------------
#ifdef G_OS_WIN32
#  ifdef GDK_COMPILATION
#    define GTKVAR __declspec(dllexport)         -> __attribute__((visibility ("default")))
#  else
#    define GTKVAR extern __declspec(dllimport)  ->  define GTKVAR extern
#  endif
#else
#  define GTKVAR extern
#endif
---------------------------------------------------------------------------------------------
gtk/gtkmain.c
---------------------------------------------------------------------------------------------
...
#include <cairo.h>           <--- add
#include <epoxy/wgl.h>       <--- add
...

void
gtk_init (int *argc, char ***argv)
{
  g_clock_win32_init ();     <--- add
  g_thread_win32_init ();    <--- add
  glib_init ();              <--- add
  gobj_init ();              <--- add
  cairo_mutex_init();        <--- add
  epoxy_init();              <--- add
  if (!gtk_init_check (argc, argv))
---------------------------------------------------------------------------------------------
void gtk_main_do_event (GdkEvent *event)
...
    case GDK_DESTROY:
      /* Unexpected GDK_DESTROY from the outside, ignore for
       * child windows, handle like a GDK_DELETE for toplevels
       */
      if (!gtk_widget_get_parent (event_widget))
        {
          g_object_ref (event_widget);
          if (!gtk_widget_event (event_widget, event) &&
              gtk_widget_get_realized (event_widget))
            gtk_widget_destroy (event_widget);
          g_object_unref (event_widget);
        }
	  cairo_mutex_finalize(); <--- add
	  epoxy_exit();           <--- add
      break;
...
---------------------------------------------------------------------------------------------
In file included from d:\msys\mingw\i686-w64-mingw32\include\windows.h:72:0,
                 from D:/MSYS/local/include/glib-2.0/glib/glib-init.h:32,
                 from D:/MSYS/local/include/glib-2.0/glib.h:30,
                 from ../gdk/gdkconfig.h:13,
                 from ../gdk/gdk.h:30,
                 from gtkwin32drawprivate.h:21,
                 from gtkwin32draw.c:20:
gtkwin32draw.c:162:3: error: expected identifier before ‘(‘ token
   EDGE_RAISED       = (EDGE_RAISED_OUTER | EDGE_RAISED_INNER),
   ^
gtkwin32draw.c:731:0: warning: "RGB" redefined
 #define RGB(r, g, b) { (r)/255.0, (g)/255.0, (b)/255., 1.0 }
 ^
In file included from d:\msys\mingw\i686-w64-mingw32\include\windows.h:71:0,
                 from D:/MSYS/local/include/glib-2.0/glib/glib-init.h:32,
                 from D:/MSYS/local/include/glib-2.0/glib.h:30,
                 from ../gdk/gdkconfig.h:13,
                 from ../gdk/gdk.h:30,
                 from gtkwin32drawprivate.h:21,
                 from gtkwin32draw.c:20:
d:\msys\mingw\i686-w64-mingw32\include\wingdi.h:1395:0: note: this is the location of the previous definition
 #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))

EDGE_RAISED fix to -> EDGE_RAISED_L
EDGE_SUNKEN fix to -> EDGE_SUNKEN_L
EDGE_ETCHED fix to -> EDGE_ETCHED_L
EDGE_BUMP   fix to -> EDGE_BUMP_L
---------------------------------------------------------------------------------------------
./.libs/libgtk-3.a(libgtk_3_la-gtkaccessibility.o):gtkaccessibility.c:(.text+0x19ba): undefined reference to `_imp__atk_misc_instance‘
----------------------------------------------------------
atk/atkmisc.h
//#        define ATK_VAR extern __declspec(dllimport)
#        define ATK_VAR extern
----------------------------------------------------------
atk/config.h
// #define _ATK_EXTERN __attribute__((visibility("default"))) __declspec(dllexport) extern
#define _ATK_EXTERN __attribute__((visibility("default")))
----------------------------------------------------------
make && make install
----------------------------------------------------------
gtk/Makefile
LIBS = * -latk-1.0 <-- add
---------------------------------------------------------------------------------------------
Could not Find Dwmapi.dll Error
    Available in Windows Vista and later versions of Windows.
---------------------------------------------------------------------------------------------
Searching for ‘dwm‘...
gdk\win32\gdkevents-win32.c(3464):    case WM_DWMCOMPOSITIONCHANGED:
gdk\win32\gdkevents-win32.c(3586):      /* TODO: pass all messages to DwmDefWindowProc() first! */
gdk\win32\gdkproperty-win32.c(423):          info.dwMajorVersion > 6 ||
gdk\win32\gdkproperty-win32.c(424):          (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2))
gdk\win32\gdkscreen-win32.c(28):#include <dwmapi.h>
gdk\win32\gdkscreen-win32.c(359):  /* On Windows 8 and later, DWM (composition) is always enabled */
gdk\win32\gdkscreen-win32.c(452):      if (DwmIsCompositionEnabled (&is_composited) != S_OK)
gdk\win32\gdkwindow-win32.c(44):#include <dwmapi.h>
gdk\win32\gdkwindow-win32.c(452):  DWM_BLURBEHIND blur_behind;
gdk\win32\gdkwindow-win32.c(488):  blur_behind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
gdk\win32\gdkwindow-win32.c(491):  call_result = DwmEnableBlurBehindWindow (thiswindow, &blur_behind);
gdk\win32\gdkwindow-win32.c(495):        G_STRLOC, "DwmEnableBlurBehindWindow", thiswindow, (guint32) call_result);
12 occurrence(s) have been found.
---------------------------------------------------------------------------------------------
gdk\win32\gdkevents-win32.c(3464)
//    case WM_DWMCOMPOSITIONCHANGED:
//      _gdk_win32_window_enable_transparency (window);
//      break;

gdk\win32\gdkproperty-win32.c(424)
//      if (!GetVersionEx (&info) ||
//          info.dwMajorVersion > 6 ||
//          (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2))
//        return FALSE;

gdk\win32\gdkscreen-win32.c(28)
//#include <dwmapi.h>

gdk\win32\gdkscreen-win32.c(452)
//if (DwmIsCompositionEnabled (&is_composited) != S_OK)
//  return FALSE;
	  
gdk\win32\gdkwindow-win32.c(44)
//#include <dwmapi.h>

gdk\win32\gdkwindow-win32.c(452)
//DWM_BLURBEHIND blur_behind;

gdk\win32\gdkwindow-win32.c(488)
//memset (&blur_behind, 0, sizeof (blur_behind));
//blur_behind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
//blur_behind.hRgnBlur = empty_region;
//blur_behind.fEnable = TRUE;
//call_result = DwmEnableBlurBehindWindow (thiswindow, &blur_behind);

gdk\win32\gdkwindow-win32.c(495)
//  if (!SUCCEEDED (call_result))
//    g_warning ("%s: %s (%p) failed: %" G_GINT32_MODIFIER "x",
//        G_STRLOC, "DwmEnableBlurBehindWindow", thiswindow, (guint32) call_result);

make
---------------------------------------------------------------------------------------------
SetupDiGetDevicePropertyW SETUPAPI.dll error  
    Available in Windows Vista and later versions of Windows.
---------------------------------------------------------------------------------------------
gdk\win32\gdkmonitor-win32.c(188)
static gboolean
get_device_property (HDEVINFO          device_infoset,
                     SP_DEVINFO_DATA  *device_info_data,
                     DEVPROPKEY       *property_key,
                     gpointer         *r_buffer,
                     gsize            *r_buffer_size,
                     DEVPROPTYPE      *r_property_type,
                     GError          **error)
{
/*
  DEVPROPTYPE property_type;
  gpointer property;
  DWORD property_size;

  property = NULL;
  property_size = 0;

  if (!SetupDiGetDevicePropertyW (device_infoset,
                                  device_info_data,
                                  property_key,
                                  &property_type,
                                  property,
                                  property_size,
                                  &property_size,
                                  0))
    {
      DWORD error_code = GetLastError ();

      if (error_code != ERROR_INSUFFICIENT_BUFFER)
        {
          gchar *emsg = g_win32_error_message (error_code);
          g_warning ("Failed to get device node property {" G_GUID_FORMAT "},%lu size: %s",
                     g_format_guid (&property_key->fmtid),
                     property_key->pid,
                     emsg);
          g_free (emsg);

          return FALSE;
        }
    }

  if (r_buffer)
    {
      property = g_malloc (property_size);

      if (!SetupDiGetDevicePropertyW (device_infoset,
                                      device_info_data,
                                      property_key,
                                      &property_type,
                                      property,
                                      property_size,
                                      &property_size,
                                      0))
        {
          DWORD error_code = GetLastError ();

          gchar *emsg = g_win32_error_message (error_code);
          g_warning ("Failed to get device node property {" G_GUID_FORMAT "},%lu: %s",
                     g_format_guid (&property_key->fmtid),
                     property_key->pid,
                     emsg);
          g_free (emsg);

          return FALSE;
        }

      *r_buffer = property;
    }

  if (r_buffer_size)
    *r_buffer_size = property_size;

  if (r_property_type)
    *r_property_type = property_type;  */
  return TRUE;
}
---------------------------------------------------------------------------------------------
SHCreateItemFromParsingName SHELL32.dll error
    Windows Vista [desktop apps only]
---------------------------------------------------------------------------------------------
gtk\gtkfilechoosernativewin32.c(371)
//  hr = SHCreateItemFromParsingName(uri_w, 0, &IID_IShellItem, (LPVOID *) &item);
//  if (SUCCEEDED (hr))
//    return item;
//  else
//    g_warning_hr ("Can‘t create shell item from shortcut", hr);
---------------------------------------------------------------------------------------------
D:\MSYS\build\libs-2\GTK_-3~1.4\demos\gtk-demo\GTK3-D~1.EXE 出错丢失条目: g_win32_run_session_bus@16
Missing entry: g_win32_run_session_bus@16


---------------------------------------------------------------------------------------------
tests/testheightforwidth.c
typedef struct {
  const gchar *name;
  const gchar *tooltip;
  const gchar *interface_M;  <-
  GtkWidget   *window;
} TestInterface;

static void
test_clicked (GtkWidget     *button, 
	      TestInterface *interface_L) <-
---------------------------------------------------------------------------------------------
*** Warning: This system cannot link to static lib archive /gdk/libgdk-win32-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libpangocairo-1.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libpangowin32-1.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libpangoft2-1.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libpango-1.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libgthread-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libatk-1.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libcairo.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libpixman-1.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libfontconfig.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libxml2.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/liblzma.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libgdk_pixbuf-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libgio-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libgmodule-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libgobject-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libglib-2.0.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libffi.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libintl.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libiconv.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libharfbuzz-icu.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libharfbuzz.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libfreetype.la.
*** Warning: This system cannot link to static lib archive /usr/local/lib/libpng16.la.
*** Warning: This system cannot link to static lib archive d:/msys/mingw/lib/libsupc++.la.
---------------------------------------------------------------------------------------------


Conclusion: in XP system, the performance of gtk3 is very poor.

gtk+-3.21.4 static build step in windows XP

标签:

原文地址:http://www.cnblogs.com/nlsoft/p/5767132.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!