CentOS6.3にmonoとmono-winformsをインストール

/* RPMリポジトリの追加してyum */
[root@localhost ~]# vi /etc/yum.repos.d/mono.repo
/* 新規で以下の内容を書き込んで保存 */
[mono]
name=mono-project
baseurl=http://download.mono-project.com/download-stable/openSUSE_11.4
enabled=1
gpgcheck=0

[root@localhost ~]# yum install mono
~中略~
Installed:
  mono-core.i586 0:2.10.6-0.xamarin                                             

Complete!

[arvant@localhost ~]$ mono --version
Mono JIT compiler version 2.10.6 (tarball Thu Sep 15 13:40:09 EDT 2011)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
 TLS:           __thread
 SIGSEGV:       altstack
 Notifications: epoll
 Architecture:  x86
 Disabled:      none
 Misc:          debugger softdebug 
 LLVM:          supported, not enabled.
 GC:            Included Boehm (with typed GC and Parallel Mark)
 
/* とりあえず Hello,World をコンパイル&実行 */
[arvant@localhost ~]$ vi hello.cs
[arvant@localhost ~]$ gmcs hello.cs 
[arvant@localhost ~]$ mono hello.exe 
Hello Mono World
 
/* 次に winforms をインストール */
[root@localhost ~]# yum install mono-winforms
~中略~
Installed:
  mono-winforms.i586 0:2.10.6-0.xamarin                                         

Dependency Installed:
  mono-data.i586 0:2.10.6-0.xamarin   mono-data-sqlite.i586 0:2.10.6-0.xamarin  
  mono-web.i586 0:2.10.6-0.xamarin   

Complete!
 
/* Hello,Worldをコンパイルするが pkg-config へパスが通ってないのでコンパイルできず */
[arvant@localhost ~]$ gmcs hello.cs -pkg:dotnet
Package dotnet was not found in the pkg-config search path.
Perhaps you should add the directory containing `dotnet.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dotnet' found
error CS8027: Error running pkg-config. Check the above output.

/* 別の方法でHello,Worldをコンパイル */
[arvant@localhost ~]$ gmcs -r:System.Windows.Forms.dll winforms.cs
[arvant@localhost ~]$ mono winforms.exe 

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeWin32Classic ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.KnownColors ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: gdiplus.dll
~中略~

/* 例外発生 gdiplus.dll が見つからないらしい */
[root@localhost ~]# yum install libgdiplus
~中略~
Error: Package: libgdiplus0-2.10-30.2.i586 (mono)
           Requires: libpng14.so.14
Error: Package: libgdiplus0-2.10-30.2.i586 (mono)
           Requires: libpng14.so.14(PNG14_0)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
 
/* CentOSのリポジトリのlibpngに何か問題があるっぽい? */
/* バージョンが古いがmonoリポジトリ内にあるlibgdiplusをwget取得してインストール */
[root@localhost ~]# wget http://origin-download.mono-project.com/download-stable/openSUSE_11.4/i586/libgdiplus0-2.10-0.sle11.xamarin.i586.rpm
~中略~
[root@localhost ~]# yum install libgdiplus0-2.10-0.sle11.xamarin.i586.rpm 
~中略~
Installed:
  libgdiplus0.i586 0:2.10-0.sle11.xamarin                                       

Dependency Installed:
  glib2-devel.i686 0:2.22.5-7.el6                                               

Complete!
 
/* インストールできたので改めてコンパイル */
[arvant@localhost ~]$ gmcs -r:System.Windows.Forms.dll winforms.cs
[arvant@localhost ~]$ mono winforms.exe 
[arvant@localhost ~]$ 
/* winformsが正常にコンパイル&動作することを確認 */ 

libgdiplusのバージョンが古いのでwinformsを使わない時は削除しておいたほうがいいかも…

0 件のコメント: