Pages

Showing posts with label mono. Show all posts
Showing posts with label mono. Show all posts

Friday, October 2, 2020

Fedora 32 : Can be better? part 015.

In the evening I can spend my time with Fedora 32.

In the last few days I studied GTK # a bit.

I thought it would be useful for Linux users and those who use the language of the FASM assembler to have an editor.

Tonight I created this simple project this simple project named fasm_editor.

The objectives of this project are:

  • creating a functional editor;
  • implementation of running and compilation requirements;
  • settings specific to the Linux operating system;

I believe that this way Fedora Linux can be improved and become better.

Wednesday, September 30, 2020

Fedora 32 : Can be better? part 014.

The GTK documentation for C # is not very up to date, I tried to use a button to change a label and I failed first time. The Fedora team could improve this to develop the development side. Here's what I've managed to do so far with GTK.

I fixed the source code with this, but I would have preferred a better method:

my_Button.Clicked += delegate {
my_Label.Text = "Use delegate!";
};

Mono is a free and open source implementation of the .NET Framework.

The most popular build tool for Mono is NAnt.

NUnit is very useful for test driven development.

[root@desk mythcat]# dnf install mono-devel
Last metadata expiration check: 0:15:26 ago on Wed 30 Sep 2020 09:04:30 PM EEST.
Package mono-devel-6.6.0-8.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@desk mythcat]# dnf install nant
...
Installed:
  log4net-2.0.8-10.fc32.x86_64            nant-1:0.92-25.fc32.x86_64           
  nunit2-2.6.4-24.fc32.x86_64            

Complete!
[root@desk mythcat]# dnf install nunit nunit-gui
Last metadata expiration check: 0:02:09 ago on Wed 30 Sep 2020 09:27:18 PM EEST.
No match for argument: nunit-gui
Error: Unable to find a match: nunit-gui

Installing MonoDevelop:

[root@desk mythcat]# dnf install monodevelop
...
Installed:
  ORBit2-2.14.19-23.fc32.x86_64                                                 
  gamin-0.1.10-36.fc32.x86_64                                                   
  gnome-desktop-sharp-2.26.0-36.fc31.x86_64                                     
  gnome-sharp-2.24.2-25.fc32.x86_64                                             
  gnome-vfs2-2.24.4-30.fc32.x86_64                                              
  gnome-vfs2-common-2.24.4-30.fc32.noarch                                       
  gtk-sharp2-2.12.45-11.fc32.x86_64                                             
  gtk-sharp2-devel-2.12.45-11.fc32.x86_64                                       
  gtksourceview2-2.11.2-31.fc32.x86_64                                          
  libIDL-0.8.14-21.fc32.x86_64                                                  
  libbonobo-2.32.1-18.fc32.x86_64                                               
  libbonoboui-2.24.5-18.fc32.x86_64                                             
  libgnome-2.32.1-20.fc32.x86_64                                                
  libgnome-keyring-3.12.0-19.fc32.x86_64                                        
  libgnomecanvas-2.30.3-19.fc32.x86_64                                          
  libgnomeui-2.24.5-21.fc32.x86_64                                              
  mono-addins-1.1-13.fc32.x86_64                                                
  monodevelop-5.10.0-17.fc32.x86_64                                             
  vte-0.28.2-31.fc32.x86_64                                                     

Complete!

Install the .NET Core. This is a general-purpose, modular, cross-platform and open-source development Platform.

[root@desk mythcat]# dnf copr enable @dotnet-sig/dotnet
Enabling a Copr repository. Please note that this repository is not part
of the main distribution, and quality may vary.
...
Do you really want to enable copr.fedorainfracloud.org/@dotnet-sig/dotnet? [y/N]: y
Repository successfully enabled.
[root@desk mythcat]# dnf install dotnet
Copr repo for dotnet owned by @dotnet-sig             5.4 kB/s | 3.3 kB     00:00    
Package dotnet-3.1.108-1.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete! 

Let's start with a GTK project using the MonoDevelop I.D.E.

[mythcat@desk ProjectsCSharp]$ monodevelop 
I use a new solution from .NET with GTK# 2.0 Project template. The default source code is this:
using System;
using Gtk;

namespace MonoDevelopGTK_001
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Application.Init ();
			MainWindow win = new MainWindow ();
			win.Show ();
			Application.Run ();
		}
	}
}
The result is an simple window form. For a complex form with entry ,label and one button, you can see the next example:
using System;
using Gtk;

namespace MonoDevelopGTK_001
{
	
	class MainClass
	{
		public static void Main (string[] args)
		{
			// define here Entry and Button 
			Entry name;
			Button my_Button;

			Application.Init ();
			MainWindow win = new MainWindow ();
			// change the size of window
			win.SetDefaultSize (640, 480);
			// this will close application
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			// use of VBox or HBox
			VBox global_vbox = new VBox();
			win.Add(global_vbox);
			name = new Entry();
			global_vbox.PackStart(name, false, false, 0);
			win.Add(name);

			VBox label_vbox = new VBox();
			global_vbox.Add (label_vbox);
			//Define here a label and put some text in it.
			Label my_Label = new Label();
			my_Label.Text = "Hello World!";
			label_vbox.PackStart(my_Label, false, false, 0);
			//Add the label to the form
			win.Add(my_Label);

			VBox button_vbox = new VBox();
			global_vbox.Add (button_vbox);
			my_Button = new Button("Ok!");
			my_Button.Clicked += OnButtonClicked;
			button_vbox.PackStart(my_Button, false, false, 0);
			win.Add(my_Button);
			// ShowAll is used to see all labels, buttons
			win.ShowAll();
			//win.Show ();
			Application.Run ();

		}

		public static void OnButtonClicked (object obj, EventArgs args)
		{
			//Label my_Label = obj as Gtk.Label;
			Console.WriteLine ("Button Clicked !");

		}

		static void Window_Delete (object obj, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}
	}
}

Monday, December 3, 2018

The saga of build Librelancer over Mono, NuGET and Cake.

I wrote this article because it is a good way to understand beyond the errors encountered for Mono, NuGet and Cake.
I started the day with Fedora 29 installing the old Librelancer game:
Librelancer is a cross-platform, open source game engine re-implementing the 2003 space trading and combat game Freelancer. The engine comes with an editor for several of the game's file formats called LancerEdit.
See the official webpage.
Some errors are temporarily fixed, see:
TERM=xterm.
This error refers an issue open on Feb 13,2018,12:52 PM GMT+2, see here.
However, this is a great way to go through Fedora installations to avoid searching for GitHub issues and issues.
The default install of Cake with the version 0.30.0 will not solve the last error:
[root@desk Librelancer]# nuget  install Cake -Version 0.30.0 
Installing 'Cake 0.30.0'.
Successfully installed 'Cake 0.30.0'. 
Let's hope that problems will solve with time.
Below are the correct steps for going through the installation until the last error.
[mythcat@desk ~]$ git clone --depth=50 --branch=master https://github.com/Librelancer/Librelancer.git 
Cloning into 'Librelancer'...
remote: Enumerating objects: 3085, done.
remote: Counting objects: 100% (3085/3085), done.
remote: Compressing objects: 100% (1414/1414), done.
remote: Total 3085 (delta 2131), reused 2295 (delta 1639), pack-reused 0
Receiving objects: 100% (3085/3085), 7.97 MiB | 2.79 MiB/s, done.
Resolving deltas: 100% (2131/2131), done.
Checking out files: 100% (863/863), done.
[mythcat@desk ~]$ cd Librelancer/
[mythcat@desk Librelancer]$ ll
total 48
-rw-rw-r--.  1 mythcat mythcat 4912 Dec  3 11:23 build.cake
-rw-rw-r--.  1 mythcat mythcat 7439 Dec  3 11:23 build.ps1
-rwxrwxr-x.  1 mythcat mythcat 3210 Dec  3 11:23 build.sh
-rw-rw-r--.  1 mythcat mythcat   33 Dec  3 11:23 cake.config
-rw-rw-r--.  1 mythcat mythcat 1029 Dec  3 11:23 CMakeLists.txt
-rw-rw-r--.  1 mythcat mythcat 2768 Dec  3 11:23 Credits.txt
drwxrwxr-x.  4 mythcat mythcat   87 Dec  3 11:23 deps
drwxrwxr-x.  4 mythcat mythcat 4096 Dec  3 11:23 editoricons
drwxrwxr-x. 12 mythcat mythcat  208 Dec  3 11:23 extern
-rw-rw-r--.  1 mythcat mythcat 1166 Dec  3 11:23 LICENSE
-rw-rw-r--.  1 mythcat mythcat 1877 Dec  3 11:23 README.md
drwxrwxr-x.  2 mythcat mythcat   75 Dec  3 11:23 scripts
drwxrwxr-x. 15 mythcat mythcat 4096 Dec  3 11:23 src
drwxrwxr-x.  2 mythcat mythcat   29 Dec  3 11:23 tools

[mythcat@desk Librelancer]$ git submodule update --init --recursive
Submodule 'extern/BulletSharpPInvoke' (https://github.com/AndresTraks/BulletSharpPInvoke) registered for path 
'extern/BulletSharpPInvoke'
Submodule 'extern/Collada141' (https://github.com/Librelancer/Collada141) registered for path 
'extern/Collada141'
Submodule 'extern/FontConfigSharp' (https://github.com/CallumDev/FontConfigSharp.git) registered for path 
'extern/FontConfigSharp'
Submodule 'extern/ImGui.NET' (https://github.com/mellinoe/ImGui.NET) registered for path 'extern/ImGui.NET'
Submodule 'extern/SharpFont' (https://github.com/Robmaister/SharpFont.git) registered for path 'extern/SharpFont'
Submodule 'extern/StbSharp' (https://github.com/rds1983/StbSharp) registered for path 'extern/StbSharp'
Submodule 'extern/bullet3' (https://github.com/bulletphysics/bullet3) registered for path 'extern/bullet3'
Submodule 'extern/cimgui' (https://github.com/Extrawurst/cimgui) registered for path 'extern/cimgui'
Submodule 'extern/lidgren-network-gen3' (https://github.com/lidgren/lidgren-network-gen3) registered for path 
'extern/lidgren-network-gen3'
Submodule 'extern/nvidia-texture-tools' (https://github.com/castano/nvidia-texture-tools) registered for path 
'extern/nvidia-texture-tools'
Cloning into '/home/mythcat/Librelancer/extern/BulletSharpPInvoke'...
Cloning into '/home/mythcat/Librelancer/extern/Collada141'...
Cloning into '/home/mythcat/Librelancer/extern/FontConfigSharp'...
Cloning into '/home/mythcat/Librelancer/extern/ImGui.NET'...
Cloning into '/home/mythcat/Librelancer/extern/SharpFont'...
...
[mythcat@desk Librelancer]$ export GITHUB_TOKEN=[secure]
Check your mono version 
[mythcat@desk Librelancer]$ mono --version
Mono JIT compiler version 4.8.0 (Stable 4.8.0.520/8f6d0f6 Wed Sep 20 21:27:10 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       normal
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

[root@desk Librelancer]# rpm --import https://packages.microsoft.com/keys/microsoft.asc
[root@desk Librelancer]# wget -q https://packages.microsoft.com/config/fedora/27/prod.repo
[root@desk Librelancer]# ls
build.cake  cake.config     deps         LICENSE    scripts
build.ps1   CMakeLists.txt  editoricons  prod.repo  src
build.sh    Credits.txt     extern       README.md  tools
[root@desk Librelancer]# vim prod.repo 
[root@desk Librelancer]# mv prod.repo /etc/yum.repos.d/microsoft-prod.repo
[root@desk Librelancer]# chown root:root /etc/yum.repos.d/microsoft-prod.repo
[root@desk Librelancer]# dnf update
packages-microsoft-com-prod                      48 kB/s | 156 kB     00:03    
Last metadata expiration check: 0:00:01 ago on Mon 03 Dec 2018 11:52:11 AM EET.
Dependencies resolved.
Nothing to do.
Complete!

[root@desk Librelancer]# dnf search dotnet-sdk
Last metadata expiration check: 0:01:05 ago on Mon 03 Dec 2018 11:52:11 AM EET.
=========================== Name Matched: dotnet-sdk ===========================
dotnet-sdk-2.1.x86_64 : Microsoft .NET Core SDK 2.1.500 2.1.500
dotnet-sdk-2.1.200.x86_64 : Microsoft .NET Core SDK - 2.1.200 2.1.200
dotnet-sdk-2.1.201.x86_64 : Microsoft .NET Core SDK - 2.1.201 2.1.201
dotnet-sdk-2.1.202.x86_64 : Microsoft .NET Core SDK - 2.1.202 2.1.202
dotnet-sdk-2.1.300-rc1-008673.x86_64 : Microsoft .NET Core SDK 2.1.300 - rc1
                                     : 2.1.300-rc1-008673

[root@desk Librelancer]# dnf install dotnet-sdk-2.1.202.x86_64 
Last metadata expiration check: 0:02:18 ago on Mon 03 Dec 2018 11:52:11 AM EET.
Dependencies resolved.
================================================================================
 Package                 Arch    Version     Repository                    Size
================================================================================
Installing:
 dotnet-sdk-2.1.202      x86_64  2.1.202-1   packages-microsoft-com-prod   96 M
Installing dependencies:
 aspnetcore-store-2.0.0  x86_64  2.0.0-1     packages-microsoft-com-prod   24 M
 aspnetcore-store-2.0.3  x86_64  2.0.3-1     packages-microsoft-com-prod  7.9 M
 aspnetcore-store-2.0.5  x86_64  2.0.5-1     packages-microsoft-com-prod  1.6 M
 aspnetcore-store-2.0.6  x86_64  2.0.6-1     packages-microsoft-com-prod  9.3 M
 aspnetcore-store-2.0.7  x86_64  2.0.7-1     packages-microsoft-com-prod   24 k
 aspnetcore-store-2.0.8  x86_64  2.0.8-1     packages-microsoft-com-prod  8.5 M
 aspnetcore-store-2.0.9  x86_64  2.0.9-1     packages-microsoft-com-prod  956 k
 dotnet-host             x86_64  2.1.6-1     packages-microsoft-com-prod   45 k
 dotnet-hostfxr-2.0.9    x86_64  2.0.9-1     packages-microsoft-com-prod  182 k
 dotnet-runtime-2.0.9    x86_64  2.0.9-1     packages-microsoft-com-prod   24 M

Transaction Summary
================================================================================
Install  11 Packages

Total download size: 173 M
Installed size: 173 M
Is this ok [y/N]: y
...
Complete!

This will fix a bug : 
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Console' threw an exception.
[mythcat@desk Librelancer]$ TERM=xterm


[mythcat@desk Librelancer]$ ./build.sh 
Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

[root@desk Librelancer]# dnf install nuget.x86_64 

The dotnet come with this:

[root@desk Librelancer]# dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.500
 Commit:    b68b931422

Runtime Environment:
 OS Name:     fedora
 OS Version:  29
 OS Platform: Linux
 RID:         fedora.29-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.500/

Host (useful for support):
  Version: 2.1.6
  Commit:  3f4f8eebd8

.NET Core SDKs installed:
  2.1.202 [/usr/share/dotnet/sdk]
  2.1.500 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Let's test again:
[mythcat@desk Librelancer]$ ./build.sh 
Feeds used:
  https://api.nuget.org/v3/index.json

Restoring NuGet package Cake.0.30.0.
WARNING: Unable to find version '0.30.0' of package 'Cake'.
  https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request
  Error: TrustFailure (Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED)
  Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

Unable to find version '0.30.0' of package 'Cake'.
  https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request
  Error: TrustFailure (Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED)
  Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

Could not restore NuGet tools.

[root@desk Librelancer]# cat /etc/ssl/certs/* >ca-bundle.crt
[root@desk Librelancer]# TERM=xterm
[root@desk Librelancer]# cert-sync ca-bundle.crt
Mono Certificate Store Sync - version 4.8.0.0
Populate Mono certificate store from a concatenated list of certificates.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

Importing into legacy system store:
I already trust 0, your new list has 129
Certificate added: CN=ACCVRAIZ1, OU=PKIACCV, O=ACCV, C=ES
Certificate added: C=ES, O=FNMT-RCM, OU=AC RAIZ FNMT-RCM
Certificate added: C=IT, L=Milan, O=Actalis S.p.A./03358520967, CN=Actalis Authentication Root CA
Certificate added: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root
...
129 new root certificates were added to your trust store.
Import process completed.
[root@desk Librelancer]# rm ca-bundle.crt
rm: remove regular file 'ca-bundle.crt'? y

[mythcat@desk Librelancer]$ ./build.sh 
Feeds used:
  https://api.nuget.org/v3/index.json

Restoring NuGet package Cake.0.30.0.
  GET https://api.nuget.org/v3-flatcontainer/cake/0.30.0/cake.0.30.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/cake/0.30.0/cake.0.30.0.nupkg 53ms
Installing Cake 0.30.0.
Adding package 'Cake.0.30.0' to folder '/home/mythcat/Librelancer/tools'
Added package 'Cake.0.30.0' to folder '/home/mythcat/Librelancer/tools'
Install failed. Rolling back...
Error: One or more errors occurred.
    Could not load type 'NuGet.Packaging.PackageArchiveReader' from assembly 'NuGet.Packaging, 
Version=4.7.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Thursday, February 9, 2017

Dealing with Mono under Fedora 25.

As you know the new Fedora come with dnf tool options you can use to define a DNF repository ( see link ).
This can be a problem for new users if want to install the mono development tools because they can get this error:
...
warning: /var/cache/dnf/download.mono-project.com_repo_centos-beta_-36cf85be8e79dffc/packages/mono-devel-4.8.0.483-0.xamarin.1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID d3d831ef: NOKEY
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Public key for mono-devel-4.8.0.483-0.xamarin.1.x86_64.rpm is not installed


To fix that error you just need to use this commands:

[root@localhost mythcat]# rpm  --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
[root@localhost fedora25_test001]# dnf config-manager --add-repo http://jenkins.mono-project.com/repo/centos/
Adding repo from: http://jenkins.mono-project.com/repo/centos/
[root@localhost fedora25_test001]# dnf update
[root@localhost mythcat]# dnf install mono-devel

...

[root@localhost mythcat]# dnf install monodevelop

Now you can start the monodevelop with this command:

[mythcat@localhost ~]$ monodevelop

I make a simple mono GTK# window into few steps:
The result of project come with this files:

[mythcat@localhost ~]$ cd fedora25_test001/
[mythcat@localhost fedora25_test001]$ ll
total 100408
-rw-rw-r--. 1 mythcat mythcat     4163 Feb  5 23:17 Assembly-CSharp.csproj
-rw-rw-r--. 1 mythcat mythcat     4163 Feb  5 23:17 Assembly-CSharp-vs.csproj
drwxr-xr-x. 2 mythcat mythcat      228 Feb  5 23:17 Assets
-rw-rw-r--. 1 mythcat mythcat     1452 Feb  5 23:17 fedora25_test001-csharp.sln
-rw-rw-r--. 1 mythcat mythcat     1448 Feb  5 23:17 fedora25_test001.sln
drwxr-xr-x. 4 mythcat mythcat     4096 Feb  5 23:39 Library
drwxr-xr-x. 2 mythcat mythcat     4096 Feb  5 23:39 ProjectSettings
drwxrwxr-x. 6 mythcat mythcat      143 Feb  5 23:18 test_Data
-rwxr-xr-x. 1 mythcat mythcat 49128408 Feb  5 23:18 test.x86
-rwxr-xr-x. 1 mythcat mythcat 53652633 Feb  5 23:18 test.x86_64