Building MacOS 10.8 source code on 10.6 - c#

I am trying to build SparkleShare on Mac.
I have Mac OS 10.6
SparkleShare claims to run on Snow Leopard (10.6) or later
SparkleShare contains calls to NSUserNotification, a class which is Available in OS X v10.8 and later
Monodevelop throws an error:
error CS0246: The type or namespace name `NSUserNotification' could not be found. Are you missing a using directive or an assembly reference?
In Monodevelop, when I begin typing MonoMac.Foundation.NSUser, the only suggested item is NSUserDefaults, NSUserNotification is not suggested.
Is this kind of cross-compilation possible?
I can't upgrade to 10.8 because I also want to check how the user experience is on 10.6.

Run:
git clone https://github.com/mono/monomac
git clone https://github.com/mono/maccore
cd monomac
make
It should generate MonoMac.dll. Copy it to wherever your MonoMac.dll is, restart Monodevelop, the project should now build fine.

I just had a look at MonoMac's source code, and NSUserNotification is a recent addition, it has been added three months ago: https://github.com/mono/monomac/commit/2c4a8c639254705e0dde1ce32f4e49cfcb72187e.
These are the generated files:
NSUserNotification.g.cs
NSUserNotificationCenter.g.cs
NSUserNotificationActivationType
NSUserNotificationCenterDelegate.g.cs
As a workaround for older MonoMac versions, you can simply copy these into your code.

Related

Unity ML Agents Package Manager is not importing Actuator script

I want to test the Unity ML example "3D Ball". So, I set up environment:
Imported the ML Agents Package by Unity Package Manager.
Copied the ML Agent example Assets from Unity's official GitHub to My Project File.
Then, I opened the example scene and played that scene. But every code which contains "using Unity.MLAgents.Actuators" fails with the following error:
Assets\test.cs(5,22): error CS0234: The type or namespace name 'Actuators' does not exist in the namespace 'Unity.MLAgents' (are you missing an assembly reference?)
So, I've tried to find MLAgents.Actuator module's source code. But I didn't find anything yet.
Someone said Actuator Module is applied after ML Agent 1.0.3, but I imported the lasted version (v. 1.0.4).
How can I import the ML Agents package properly? Every YouTube tutorial does not show the problem I've encountered.
Here is my environment:
Unity version: Unity 2020.1.0f
ML Agents version: version 1.0.4
ML Agents example: version Release 7
Update the package to a 1.4.0-preview or later (depending on your Unity version, you may need to change some package manager settings to be able to see preview packages).
Get the examples from a tag that corresponds to the 1.0.x package, for example com.unity.ml-agents_1.0.6
You have to manually install it from the repository you cloned.
I added the project from "Unity Hub" rather than inserting asset folder to a new project.
And then everything works fine. Even the preview packages like
[com.unity.ml-agents.extensions": "file:../../com.unity.ml-agents.extensions]
added automatically to the project from my project directory!
If you need to use the 1.0.x pacakage, make sure you're getting the examples from a compatible version (not the master branch). For example, here's the 1.0.2 tag: github.com/Unity-Technologies/ml-agents/tree/…. Looks like 1.03 and 1.0.4 tags are missing but I'll update them tomorrow. – celion Sep 27 '20 at 20:27
Celion had the right answer
I have the same problem, I am very new to Unity. I figured out it is something with the versioning. You need to use the proper version of the package. By installing from the Unity Registry, I was not able to install the last version.
I just install the package from the Disk. Here follow the Install the com.unity.ml-agents Unity package. It fixed my problem.
Unity.MLAgents.Actuators this package is in preview till this date, if you want to use this package you need to update your MLAgents package from package manager.

Building cmake generated UWP windows desktop project results in error MC6000 (missing WindowsBase, ...)

I created a simple Windows UWP solution with windows visual studio 2019.
I did not make any changes to it but closed visual studio.
Then I wrote a simple cmake file for it.
However, it fails in "cmake --build" like this:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(268,9):
error MC6000: Project file must include the .NET Framework assembly
'WindowsBase, PresentationCore, PresentationFramework' in the reference list.
[App1\out\App1.csproj]
When I add the requested .NET files with VS_DOTNET_REFERENCES property, there is a different error:
App1\MainPage.xaml(9,5): error MC3074: The tag 'ThemeResource' does not exist
in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.
Line 9 Position 5. [App1\out\App1.csproj]
I also tried adding all and combinations of these calls to CMakeLists.txt but they did not have any effect:
set_property (SOURCE "App.xaml" PROPERTY VS_XAML_TYPE "ApplicationDefinition")
target_compile_options (App1 PRIVATE "/langversion:default")
set_property (TARGET App1 PROPERTY DOTNET_TARGET_FRAMEWORK_VERSION "v4.7.2")
set_property (TARGET App1 PROPERTY WIN32_EXECUTABLE TRUE)
I cannot overcome these problems.
I generate and compile the solution like this:
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -S . -B out
cmake --build out
Cmake version is 3.14.19050301-MSVC_2.
The source files are here, including the original by visual studio created solution files and my written CMakeLIsts.txt file.
Expected result would be a cmake compiling solution which looks as much as possible like the native solution.
Probably there is just a simple error but I cannot find it.

DebugAdapter bin folder not found on path "....vscode/extensions/ms-vscode.csharp-0.3.7/coreclr-debug/debugAdapters/OpenDebugAD7.exe."

OS: Windows 10
dotnet-cli:
Version: 1.0.0-beta-001598
Commit Sha: 7582649f88
This is after following the instructions here for C# debugging. Does it work yet for windows?
According to the error message, it looks like you did not install the C# extension as per the instructions https://microsoft.gallery.vsassets.io/items?itemName=ms-vscode.csharp
Open your command pallet and verify that the correct version is installed. Or, if it is, remove it and try installing again

mono mcs 'Winforms Hello World' gives compile error CS006: Metadata file 'cscompmgd.dll' could not be found

I'm new to linux and mono. I installed mono to a new Raspberry Pi machine using
sudo apt-get install mono-complete.
I also did the update and upgrade using apt-get.
I then followed the helloWorld examples in the Mono Basics page in mono-project website:
http://www.mono-project.com/docs/getting-started/mono-basics/
I managed to build and run the first 'Console Hello World' example using the following:
mcs hello.cs
mono hello.exe
However, when I tried the next example 'Winforms Hello World', I encountered the following error when running 'mcs hello.cs -pkg:dotnet':
error CS0006: Metadata file 'cscompmgd.dll' could not be found
However, it works if i use gmcs instead of mcs.
I googled here and there but no luck.
I can find a link to this file 'cscompmgd.dll' in '/usr/lib/mono/2.0' directory in my Raspberry Pi.
The installed mono version is 3.2.8 (returned by using 'mono --version').
Does anyone know why it works with gmcs but it doesn't work with mcs?
Thank you.
Solved by adding the -lib: option like this:
mcs helloWinforms.cs -pkg:dotnet -lib:/usr/lib/mono/2.0
Solution with adding
-lib:/usr/lib/mono/2.0
was not the best in my case (it broke a dependency on some 4.0 elements, specifically 'System.Threading').
Dirty, but works
Another, very dirty solution is to copy the
/usr/lib/mono/2.0/cscompmgd.dll
to your project folder (or wherever the Makefile is) and add
-r:cscompmgd.dll
when compiling (or add the filename after list of other included libraries specified by '-r').
There is probably a way to do that without copying the file, but that is beyond my capabilities.
So you end up with:
mcs helloWinforms.cs -pkg:dotnet -r:cscompmgd.dll

Beginner ILNumerics: install under VS2012

I am very much interested in ILNUmerics and would like to try the free version, but I am having troubles.
I have started with a console application and was trying to run the 'hello ilnumerics'console application but I noticed that VS fails to find MKL libraries.
I am using VS2012 under Windwos 8 (through Bootcamp on a MacBook Pro mid 2010; should it be relevant); I have installed the NuGet Packages extension from the Project solution. Then right-click on references in the solution explorer, 'Manage Nu Get Packages', fron online/search found ilnumerics in various versions. I chose 'ILNumerics' and install. I got 'ILNumerics' and 'ILNumerics.Native' added to my project. Then I can see ILNumerics under 'References' in Solution Explorer and also get two new folders /bin32/ and /bin64/ they both contain two DLLs named: libiomp5md.dll and mkl_custom.dll. I have checked their
'Copy to Ouput Directory' property and they are all set to 'Copy if newer'.
Apparently mkl_custom is not found. I write the following code, taken from the quickstart guide:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ILNumerics;
namespace ConsoleApplication3
{
class Program : ILMath
{
static void Main(string[] args)
{
ILArray<double> A = array<double>
(new double[] { 1,1,1,1,1,2,3,4,1,3,6,10,1,4,10,20} ,4, 4);
ILArray<double> B = counter(4, 2);
ILArray<double> Result = linsolve(A, B);
Console.Out.WriteLine("A: " + Environment.NewLine +
A.ToString());
Console.Out.WriteLine("B: " + Environment.NewLine + B.ToString());
Console.ReadKey();
}
}
}
and I get this exception:
An unhandled exception of type 'System.DllNotFoundException' occurred in ILNumerics.dll
Additional information: Unable to load DLL 'mkl_custom': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
If I do not invoke linsolve the ToString method of ILArray does work: if I comment // ILArray Result = linsolve(A, B);
I get the two matrices printed on the screen.
I have also tried to compute the determinant of a matrix and got the same exception: apparently any time I call mkl_custom VS is not capable to find it.
Any help/hint, please?
Also, is it necessary to install ILNumerics through NuGet on any project added to the solution? Would it be possible to install it locally once for all and then add the reference if necessary?
Two options:
1) Make sure, all binaries are accesible as intended: ILNumerics uses AnyCPU targets and chooses the platform dependend subfolder by adding the "bin32" / "bin64" directories to the PATH envoronment variable on startup. Possibly there is something failing on your machine? You can make sure by placing the correct binaries (depending on your platform) directly into the output path manually.
2) In case the error persists: mkl_custom.dll depends on some other dlls itself. One (libiomp5md.dll) is delivered with the ILNumerics nuget package. Others are expected to exist on your system: KERNEL32.DLL and MSVCR110.DLL. Make sure, you have these! If the kernel dll was missing -> call it a miracle and reinstall your system. If the msvcr110 is missing -> go here and install the "Visual C++ Redistributable for Visual Studio 2012".
In case the problem persists, you may file a bug on the ILNumerics bugtracker, because, the runtime should be there, as you wrote you are using VS2012. Possibly it is a versioning problem though.
EDIT: Since version 4.0 ILNumerics does not deploy the native binaries in bin32/ bin64/ subfolder anymore but installs all native dependencies systemwide into the GAC and System32/WOW folders. The old scheme will still work (for compatibility with old projects) though. But it is not necessary anymore to deal with any dependancies for ILNumerics explicitly. They should simply be found at runtime.
Like numbers303 said, ILNumerics.dll can't find a required dependency. You can brute force fixing this dependency by copying the required DLLs to the same directory as the ILNumerics.dll as a post build step, but I think there's a more elegant solution.
A VS2010 .NET console solution gets created by default with the x86 configuration. Compiling and running the ILNumerics example Hello ILNumerics! code with this configuration results in a DLL not found exception (mkl_custom.dll).
Re-targeting the solution via configuration manager to 'Any CPU' fixed the issue for me:
In Solution Explorer, right click on the solution and select properties. Select Configuration Properties and click on the Configuration Manager... button in the upper right hand corner. Make sure that the project that uses ILNumerics has the 'Any CPU' selected. If 'Any CPU' isn't available as a selection, select '' from the pulldown and create an 'Any CPU' platform based on your current platform. Usually this just means accepting the default in the 'New Project Platform' dialog. You'll probably also want to modify the 'Active solution platform:' to contain an 'Any CPU' target as well.
Rebuild/run.
In my case it helped to install "Visual C++ Redistributable for Visual Studio 2012" although I work with Visual Studio 2010 with the corresponding "Visual C++ Redistributable for Visual Studio 2010" installed. Which worked fine as long as the mkl_custom.dll is not needed. But colleagues of mine dosn't have this problem without having the 2012 Redistributable installed.

Categories