Closed danielsue closed 7 months ago
Hi @danielsue I'm not sure what the exact issue is but in the past MacOS users have had issues running ApsimX when they were missing the .NET 6 runtime. Have a look at this issue: #7932
Hi @danielsue I'm not sure what the exact issue is but in the past MacOS users have had issues running ApsimX when they were missing the .NET 6 runtime. Have a look at this issue: #7932
Hi @ric394, thanks for your suggestion. I tried different .NET runtime version and also set the same SDK that are used to compile the code, unfortunately, it does not work.
BTW: i have no problem running APSIM 2024.1.7374.0 version downloaded from the website.
That's an interesting difference in your problem that the built version from the website is working (as previously that has also failed for macs at times).
Could the problem be that JetBrains is not linking correctly to the .net install? I'm not particularly familiar with Jetbrains so I wonder if there is a configuration setting that needs changing.
Another option may be to try using visual studio code on your mac and see if it can build. Once you install the c# and .net extensions for it, APSIM should build quite easily and you can check if that also fails to run the build.
I just tried Visual Studio for Mac. It is the same. The code can be compiled but cannot run. I also reinstalled dotnet 6 runtime, nothing changed. And then tried dotnet 7 runtime, nothing happened. When the code is launched, the following information is shown on Package Console. No error but 'The program '[1910] dotnet' has exited with code 0 (0x0).'
Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/ApsimNG.dll'. Symbols loaded. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/GLibSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Text.Encoding.CodePages.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/GtkSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/GioSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Drawing.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/AtkSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/APSIM.Shared.dll'. Symbols loaded. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Diagnostics.Process.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.ComponentModel.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/Microsoft.Win32.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.IO.Pipes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Net.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Net.Sockets.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Threading.ThreadPool.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Runtime.InteropServices.RuntimeInformation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Threading.Thread.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Diagnostics.Tracing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Memory.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Xml.XmlSerializer.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Private.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Xml.ReaderWriter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Private.Uri.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Collections.NonGeneric.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Runtime.Loader.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Diagnostics.TraceSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Text.RegularExpressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.ObjectModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Models.dll'. Symbols loaded. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Text.Encoding.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Reflection.Emit.ILGeneration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Reflection.Emit.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded 'Microsoft.GeneratedCode'. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Reflection.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Microsoft.CodeAnalysis.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Microsoft.CodeAnalysis.Workspaces.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Collections.Immutable.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/MathNet.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Data.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.ComponentModel.TypeConverter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Exception thrown: 'System.TypeInitializationException' in GtkSharp.dll Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Microsoft.CodeAnalysis.Features.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Microsoft.CodeAnalysis.CSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Microsoft.CodeAnalysis.CSharp.Features.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/System.Composition.TypedParts.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/System.Composition.Hosting.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/System.Composition.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/Users/dsu/apsim/ApsimX/bin/Debug/net6.0/System.Composition.AttributedModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.28/System.IO.MemoryMappedFiles.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[1910] dotnet' has exited with code 0 (0x0).
That at least rules out VS Code and JetBrains as a problem.
In VS code, can you click on the terminal and run: "dotnet --info" and paste that info here. I want to see if vscode is seeing the dotnet installs, and if so, what versions it is seeing.
@par456 Please note that I upgrade dotnet to 7.0 version when 6.0 version does not work properly. I haven't removed 7.0 version during this test.
.NET SDK: Version: 7.0.314 Commit: fadf699ea6
Runtime Environment: OS Name: Mac OS X OS Version: 12.5 OS Platform: Darwin RID: osx.12-x64 Base Path: /usr/local/share/dotnet/sdk/7.0.314/
Host: Version: 7.0.17 Architecture: x64 Commit: dff486f2d7
.NET SDKs installed: 2.1.4 [/usr/local/share/dotnet/sdk] 2.1.302 [/usr/local/share/dotnet/sdk] 5.0.201 [/usr/local/share/dotnet/sdk] 6.0.400 [/usr/local/share/dotnet/sdk] 6.0.419 [/usr/local/share/dotnet/sdk] 6.0.420 [/usr/local/share/dotnet/sdk] 7.0.100-rc.1.22431.12 [/usr/local/share/dotnet/sdk] 7.0.314 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.27 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.28 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-rc.1.22427.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.27 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.28 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-rc.1.22426.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: None
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
The only thing that really stands out to me in that list is the .Net 2.1 SDKs and runtimes being installed (I haven't seen those on any of the other build environments I've looked at). I don't have a mac to test this with (which is why it's been so hard to solve), but on my linux machine I only have the 6.0 sdk installed and it hasn't had any problems.
Sorry about having to get you to debug this for me, but would it be possible for you to completely uninstall all the .net libraries and then reinstalling just the 6.0 sdk from here: https://dotnet.microsoft.com/en-us/download/dotnet/6.0
Also, just check if you are on a x64 or ARM processor so that you have the right sdk. After that if it's still not building and running, do another dotnet --info and let me know what libraries it actually installed.
EDIT: Another suggestion I've been given is that .net may be working correctly, but it may not be finding the GTK3 library to draw the gui interface. So you may also need to install the GTK runtimes separately so that the build system can see it.
EDIT: Another suggestion I've been given is that .net may be working correctly, but it may not be finding the GTK3 library to draw the gui interface. So you may also need to install the GTK runtimes separately so that the build system can see it.
Hi @par456 , your suggestion works. After reinstalling GTK3, the code can be launched. Bother Jetbrains Rider and Visual Studio for Mac can work now. I don't know if anything wrong with GTK3 since the executable file download from the website works fine. Anyway, glad the problem is solved now.
Thanks,
Daniel
What happened?
I am able to compile APSIMX on both Windows and Mac. The Windows version was compiled using Visual Studio 2022 and the executable file can be launched without problem. On Mac, I use JetBrains Rider and the code was successfully compiled (at least rider indicates successfully built). However, when I am trying to open ApsimNG executable file, nothing happens. I tried 'dotnet run ./apsimNG' and i also tried double click, neither works. I don't have any problem in launch other GUI C# program compiled by Rider on the same computer. Any one has the same issue? Thanks.
About my mac: macOS Monterey, iMac Pro, Intel Xeon processor
What Operating System are you on?
MacOS