のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Gtk# .Net Visual Studio

GtkSharp: Hello World | Mono

プロジェクトで参照の追加
参照マネージャ>アセンブリ>拡張
glib-sharp追加
gtk-sharp追加
(glade-sharp)未追加
(gtk-dotnet)未追加
(gdk-sharp)未追加
glibsharpglue-2が見つかりません。
System.DllNotFoundException が発生しました
  HResult=0x80131524  Message=DLL 'glibsharpglue-2'
 を読み込めません:指定されたプロシージャが見つかりません。 
(HRESULT からの例外:0x8007007F)
  Source=<例外のソースを評価できません>
  スタック トレース:
   場所 GLib.Signal.SignalClosure.glibsharp_closure_new
        (ClosureMarshal marshaler, ClosureNotify notify, IntPtr gch)
   場所 GLib.Signal.SignalClosure..ctor(Signal sig, Type args_type)
   場所 GLib.Signal.AddDelegate(Delegate d)
   場所 Gtk.Object.add_InternalDestroyed(EventHandler value)
   場所 Gtk.Object.set_Raw(IntPtr value)
   場所 Gtk.Button..ctor(String stock_id)
   場所 App.Program.Main() (C:\GithubApp1\GithubApp1\Program.cs):行 27
(GtkSharpApp1:10444): GLib-WARNING **: Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and it is ignored.

(GtkSharpApp1:10444): GLib-WARNING **: Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and it is ignored.
glibsharpglue-2.dllをexeと同じ位置のDebugへコピーしたけど、
同じエラーが出てしまった。
VisualStudioからは、実行できないのかな?
Monoの環境で実行しないといけないかもしれない。

mono binary

mono(x86)をインストールしてみると、"Open Mono x86 Comand Prompt"がインストールされる。

C:\Program Files (x86)\Mono>mono
Usage is: mono [options] program [program-options]

Development:
    --aot[=<options>]      Compiles the assembly to native code
    --debug[=<options>]    Enable debugging support, use --help-debug for details
    --debugger-agent=options Enable the debugger agent
    --profile[=profiler]   Runs in profiling mode with the specified profiler module
    --trace[=EXPR]         Enable tracing, use --help-trace for details
    --jitmap               Output a jit method map to /tmp/perf-PID.map
    --help-devel           Shows more options available to developers

Runtime:
    --config FILE          Loads FILE as the Mono config
    --verbose, -v          Increases the verbosity level
    --help, -h             Show usage information
    --version, -V          Show version information
    --runtime=VERSION      Use the VERSION runtime, instead of autodetecting
    --optimize=OPT         Turns on or off a specific optimization
                           Use --list-opt to get a list of optimizations
    --security[=mode]      Turns on the unsupported security manager (off by default)
                           mode is one of cas, core-clr, verifiable or validil
    --attach=OPTIONS       Pass OPTIONS to the attach agent in the runtime.
                           Currently the only supported option is 'disable'.
    --llvm, --nollvm       Controls whenever the runtime uses LLVM to compile code.
    --gc=[sgen,boehm]      Select SGen or Boehm GC (runs mono or mono-sgen)
    --mixed-mode           Enable mixed-mode image support.
    --handlers             Install custom handlers, use --help-handlers for details.
    --aot-path=PATH        List of additional directories to search for AOT images.

Install Mono on Windows | Mono

Mono Basics | Mono

vcpkg diff patch失敗と修正

PS C:\MyGitHub\vcpkg> .\vcpkg remove harfbuzz
The following packages will be removed:
    harfbuzz:x86-windows
Removing package harfbuzz:x86-windows...
Removing package harfbuzz:x86-windows... done
Purging package harfbuzz:x86-windows...
Some files in C:\MyGitHub\vcpkg\packages\harfbuzz_x86-windows were unable to be removed. Close any editors operating in this directory and retry.
Purging package harfbuzz:x86-windows... done

もう一度

PS C:\MyGitHub\vcpkg> .\vcpkg remove harfbuzz
The following packages are not installed, so not removed:
    harfbuzz:x86-windows
Package harfbuzz:x86-windows is not installed
Purging package harfbuzz:x86-windows...
Purging package harfbuzz:x86-windows... done
PS C:\MyGitHub\vcpkg> .\vcpkg.exe install harfbuzz
The following packages will be built and installed:
    harfbuzz:x86-windows
Starting package 1/1: harfbuzz:x86-windows
Building package harfbuzz:x86-windows...
-- CURRENT_INSTALLED_DIR=C:/MyGitHub/vcpkg/installed/x86-windows
-- DOWNLOADS=C:/MyGitHub/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/MyGitHub/vcpkg/packages/harfbuzz_x86-windows
-- CURRENT_BUILDTREES_DIR=C:/MyGitHub/vcpkg/buildtrees/harfbuzz
-- CURRENT_PORT_DIR=C:/MyGitHub/vcpkg/ports/harfbuzz/.
-- Using cached C:/MyGitHub/vcpkg/downloads/harfbuzz-1.5.1.tar.bz2
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch
-- Applying patch failed. This is expected if this patch was previously applied. <~~~~~~~~~~~~~~~~~~~~~~~
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch done
-- Configuring x86-windows-rel
-- Configuring x86-windows-rel done
-- Configuring x86-windows-dbg
-- Configuring x86-windows-dbg done
-- Build x86-windows-rel
-- Build x86-windows-rel done
-- Build x86-windows-dbg
-- Build x86-windows-dbg done
-- Performing post-build validation
-- Performing post-build validation done
Building package harfbuzz:x86-windows... done
Installing package harfbuzz:x86-windows...
Installing package harfbuzz:x86-windows... done
Elapsed time for package harfbuzz:x86-windows: 58.05 s
Total time taken: 58.05 s

修正前

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 492992e..5794d0e 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -31,6 +31,10 @@
 
 #include "hb-ft.h"
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
 #include "hb-font-private.hh"
 
 #include "hb-cache-private.hh" // Maybe use in the future?

修正後、"harfbuzz-1.5.1"を"src"の前につけてあげると、パッチが成功した。

diff --git a/harfbuzz-1.5.1/src/hb-ft.cc b/harfbuzz-1.5.1/src/hb-ft.cc
index 492992e..5794d0e 100644
--- a/harfbuzz-1.5.1/src/hb-ft.cc
+++ b/harfbuzz-1.5.1/src/hb-ft.cc
@@ -31,6 +31,10 @@
 
 #include "hb-ft.h"
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
 #include "hb-font-private.hh"
 
 #include "hb-cache-private.hh" // Maybe use in the future?
PS C:\MyGitHub\vcpkg> .\vcpkg.exe install harfbuzz
The following packages will be built and installed:
    harfbuzz:x86-windows
Starting package 1/1: harfbuzz:x86-windows
Building package harfbuzz:x86-windows...
-- CURRENT_INSTALLED_DIR= C:/MyGitHub/vcpkg/installed/x86-windows
-- DOWNLOADS=             C:/MyGitHub/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=  C:/MyGitHub/vcpkg/packages/harfbuzz_x86-windows
-- CURRENT_BUILDTREES_DIR=C:/MyGitHub/vcpkg/buildtrees/harfbuzz
-- CURRENT_PORT_DIR=      C:/MyGitHub/vcpkg/ports/harfbuzz/.
-- Using cached           C:/MyGitHub/vcpkg/downloads/harfbuzz-1.5.1.tar.bz2
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch done
-- Configuring x86-windows-rel
-- Configuring x86-windows-rel done
-- Configuring x86-windows-dbg
-- Configuring x86-windows-dbg done
-- Build x86-windows-rel
-- Build x86-windows-rel done
-- Build x86-windows-dbg
-- Build x86-windows-dbg done
-- Performing post-build validation
-- Performing post-build validation done
Building package harfbuzz:x86-windows... done
Installing package harfbuzz:x86-windows...
Installing package harfbuzz:x86-windows... done
Elapsed time for package harfbuzz:x86-windows: 1.031 min
Total time taken: 1.031 min