-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MatterControl 2.x for Linux as an AppImage #3536
Comments
Thanks for the feedback and investigation. We'll look into this and report back |
Work has started at https://gitlab.com/probono/MatterControlAppImage but I will likely need some support from the devs. |
First build is available at https://gitlab.com/probono/MatterControlAppImage/-/jobs/83329584/artifacts/raw/MatterControl/bin/Release/MatterControl-x86_64.AppImage; it still has an issue though:
You can inspect the file's contents by running Can you tell what is going on here? This is the file that was used to produce it: |
I think this is where the problem is happening. Line 46 in e1836e5
MatterControl tries to find the location of it's executable and loads resources from the same directory. I don't know much about how AppImages work, but I'm guessing that while it's running inside of one it cannot get a valid path. |
Excellent, that must be it. I am using |
I think the code you posted above may break when used with
So, |
Running |
In the meantime I have simply commented out the line Line 46 in e1836e5
Now I need to keep However, I get when launching the
How would I debug this? Is it trying to load resources from somewhere else in addition to the Whereas the
and properly shows the Setup Wizard and application GUI. It seems to load |
I think you are on the right track. I know MatterControl loads a number of DLLs from the Release folder during startup. Sorry, I don't know enough about the startup process to help you further. |
|
We are. You can find the code in PluginFinder.cs, LoadAssembliesFromFileSystem Line #20, where we load and iterate all assemblies in the bin folder looking for plugins. If I was to guess, it seems likely that the call to GetExecutingAssembly runs into the same issue that you resolved last week. I believe both cases were put in place to work around problems on Mac where the exe in the AppBundle is in a different physical location than the product assemblies. |
You could try the following patch to see if it resolves the issue: |
Thanks. How do I apply this? |
I usually use git to apply. On my machine |
Which would be |
Where can I see how you are creating the Mac .app bundle? Currently getting
|
The Mac project would be even more confusing as it's essentially a wrapper around the normal solution which produces an exe with Xamarin.Mac bindings. Since your call stack suggests issues with libc/uname when running under the bundle, I'd try a less generic version of the OsInformationProvider to see if you can continue progressing forward. If it was me I'd replace the current WinformsInformationProvider with something like the following: using Microsoft.VisualBasic.Devices;
using System;
using System.IO;
namespace MatterHackers.Agg.Platform
{
public class WinformsInformationProvider : IOsInformationProvider
{
public WinformsInformationProvider()
{
this.OperatingSystem = OSType.X11;
var size = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size;
this.DesktopSize = new Point2D(size.Width, size.Height);
}
public OSType OperatingSystem { get; }
public Point2D DesktopSize { get; }
public long PhysicalMemory
{
get
{
var computerInfo = new ComputerInfo();
return (long)computerInfo.TotalPhysicalMemory;
}
}
}
} |
Also, rather than apply modifications to the source as ad-hoc steps in the yml file, might it be easier to build off of a named branch that tracks progress of this task? If you were building off of said branch, I could have thrown in the above troubleshooting step in response to your feedback and just kicked off another build for evaluation, without as much manual effort on your end. |
Please let me know the name of such a branch, then I can set it up accordingly. Thanks! |
I forked your project and have been working through various issues trying to get to a point where I could reference something. I don't believe I'll have anything today but I'll likely have some additional questions tomorrow. |
With a few caveats, I finally got a version of MatterControl to load via the generated AppImage. The icons aren't right and it wouldn't load until I put a local copy of the StaticData directory sitting next to the .AppImage file, but it's a start You can see the artifact and revised .yml file at: At first glance I believe whatever originally caused .Net to return the wrong paths on the GetExecutingAssembly calls is also causing .Net file system calls to escape the sandbox and get back to the normal filesystem. I'll keep investigating to make sure we're not doing anything funny, but baring that, is there anything special that might be required for .Net to see the packaged StaticData folder? |
That's great progress. Thank you.
You need to load it from a location that you construct from the location of the running executable itself. For now I had just commented out the line that changes the current working directory because due to my lack of .net knowledge I did not really know what I was doing there. Pseudo-code: Instead of
I think |
I can set about concatenating the current exe path with the relative paths previously used by the application but it feels like a step backwards. When we're run from any normal shell (Explorer, bash, Nautilus, Finder, etc..), the working directory is effectively the startup directory. The proposed workaround seems to be based on the premise that my application can no longer use relative paths from the working directory and must use absolute paths everywhere. That seems like a bit of a failure of AppImage to not match behavior that's consistent everywhere else and instead force a change in our application. Am I just thinking about this wrong? |
This might actually be more of an mkbundle issue, still researching and trying to understand. My main concern is if I drop support for relative paths and convert to computed absolute paths, I just have to do it everywhere. There's probably only a couple of places where we load content using relative paths but it's hard to know for sure and it's likely to break until they are all tracked down and updated. |
Realizing this was all discussed above, definitely should have tried using .CodeBase as suggested. Will work on some revisions and see how they perform |
I think it is no problem to keep the change directory if you would like to continue using that logic, it just doesn't feel very clean to me but maybe it's a matter of personal preference.
Understand. The only thing is that you need to change directory not to Alternatively we could have a small |
We already use a small launching script in the Debian package. This is
|
The reason for GetEntryAssembly versus GetExecutingAssembly I believe goes back to quirks on Mac where MatterControl is not the startup process and GetExecutingAssembly either had the wrong path or had null values in some contexts. At a glance I don't see details backing up that claim but I seem to recall working around problems in some platforms by switching away from GetExecutingAssembly. Continuing to test and troubleshoot... |
This, of course, is a major issue. The AppImage is supposed to run without the need of
Are you sure that this really the same issue? I suspect more that the plugins that are getting loaded from .dll files are not taken into account then Maybe we need to instruct it to process all *.dll files in the directory like mentioned in https://stackoverflow.com/a/27536070?
|
I just used GitLab as a matter of personal preference; it should be possible to achieve the same result by using Travis CI with GitHub. Let me know if I should do the conversion.
It should be easy to bundle a private
I assumed those are plugins loaded by the application at runtime, am I wrong? If no, they may be not needed after all... |
Maybe we are now at a point where we need someone with intimate Mono knowledge like @directhex to look into why |
|
This looks like a straight-forward occurrence of mono/mono#6187 - same complications with libc as detailed in that issue. I just haven't had any time yet to sort out how to pass the correct mkbundle parameters for this case and it didn't work the first few attempts I made. As far as plugins go, they likely will need to be considered by mkbundle to package their dependencies but that's a later stage issue, once some actually get added to the packaging process. @directhex - in mono/mono#6187 you guys discuss this problem and appear to suggest the solution is to pass |
@probonopd - no need to switch to Travis; using GitLab has been a great experience. We currently use AppVeyor, Travis with GitHub but I'm impressed with GitLab and appreciate working with and learning a new set of tools |
Getting segfaults on https://gitlab.com/probono/MatterControlAppImage/commits/master 790accc0 and 2fd59d2b. Not on 7f61806a but there Perhaps we need to bundle this .so and its "unusal" dependencies in the AppImage?
If only I knew the least bit about Mono... |
My takeaway from the 6187 issue was binding errors that appear on systems lacking Mono can initially be attributed to incorrect dllmaps, which should be mitigated with the I tried this, it didn't work but I'm hopeful that I simply did it wrong and/or the options conflict with other params being passed. I think we may also need to cross compile as well but for a Windows developer like myself, this all takes time to work through and I'm attempting to mix this task in with my existing workload, so it's slow going. Hopefully with a few more days we'll have a build that works on machines that lack Mono, for now I'm elated with the progress that's been made and the tasks that remain |
Thanks @jlewin for your great support of this feature request until here. I realize that it's an extra burden for you but I hope it will pay off in the end by many happy Linux users that will be able to get MatterControl easily. Interesting that bundling MatterSlicer seemed to have worked on the first attempt. Maybe @directhex can have another look at this at some time. |
Is there any more progress on this? Would love to have a Linux package. |
Dear probonopd, |
Hi @miguipda1 unfortunately I did not fully succeed yet to make an AppImage out of this application, partly because I don't really know anything about how Mono works. I guess I will need help from someone who knows Mono. I am still happy to help (I know AppImage really well). |
Hi @probonopd. I am familiar with Mono and Linux but not as much with AppImage creation. I've built MC 2.x beta on Linux in the past and even had to find my way around a timing issue happing inside AggSharp. Perhaps we can collaborate on this. Please let me know if I can be of any help. |
Hi @jimmy00784 thanks for offering your help. I'd be more than happy to work with you on this. To get started, can you have a look at https://gitlab.com/lewin76/MatterControlAppImage/-/jobs/84690721/artifacts/raw/MatterControl/bin/Release/MatterControl-x86_64.AppImage and see what is going wrong? You can inspect the contents of the AppImage by running it with the This is how the AppImage gets produced: |
@probonopd Initial findings:
The individual "Time to" messages are printed by MatterControl modules that are loaded at startup. |
Does |
@probonopd with strace, I get a similar unresponsive UI. There might be a timing issue here. I'll try and rebuild the code on my machine and see if I can replicate the issue. |
You can also run the tests on the extracted contents of the AppImage, although I doubt it'll make a big difference. |
If I recall correctly, a few months ago, I ran into a similar issue with a local build where the UI wouldn't respond in a similar fashion. It ended up being a small timeout value on the UI refresh. I had a bug report open for that issue as well. I'll rebuild again to see if that issue is still there. |
|
Local build runs without any issues. |
Follow each step from https://gitlab.com/lewin76/MatterControlAppImage/blob/master/.gitlab-ci.yml |
Just stumbled across this .NET Core AppImage example of how to deploy .NET Core (Mono) applications as an AppImage using Maybe it can be useful for MatterControl @jlewin @larsbrubaker? |
@probonopd - thanks for all your help on this issue and for continuing to staying interested in the solution. At first glace I'd think we can't compile to the netcoreapp3.1 framework/profile as we require Mono on Linux for Winforms support. Microsoft announced netcore Winforms support but it's only on Windows and they have yet to announce cross platform support. Further, Mono never kept up the Winforms effort and we've been plagued by Linux crashes due to poor support. It's plausible that the Winforms layer could be replace with GTK+ or similar however work on that has remained on the back burner for a long time. I'm no longer with MatterHackers but I remain interested in this option and may resume looking at it in the future and will definitely consider the netcore AppImage example if that happens, thanks. |
Thanks for the insights @jlewin - I don't even pretend to know all the subtle differences between the different Core and non-Core .NET and Mono implementations from Ximian, Xamarin, Microsoft, and whatnot (looks complicated, if not to say "like a giant mess" from the outside). But now that Microsoft itself owns Mono maybe the two will one day be merged altogether. |
Definitely, I believe that's already in the works and is what .NET 5 will be. Unfortunately Microsoft has only committed to .NET 5 Winforms support on Windows and from what I've gathered the prototype in Mono won't be in the .NET 5 Linux package. Maybe I have it wrong though. We only use Winforms as the OpenTK implementation seemed to provide decent cross platform support. agg-sharp can easily be revised to run on alternative windowing systems and hopefully a .NET 5 compatible one will emerge and this roadblock will be resolved. Ultimately Microsoft needs a cross platform 3D API for .NET and I remain hopeful that they secretly have support planned and coming in a near future release. So far though, that remains a fantasy. |
+1 for AppImage. hopefully avoiding installation of mono-complete, but fine either way. |
Any progress for Linux Mint 21 and matter control 2. for Linux support using appimage ? |
MatterControl 2.x for Linux can be built for Linux (I have done it today) but it is rather cumbersome.
Would you be interested in packaging MatterControl 2.x for Linux as an Providing an AppImage?
Doing so would have, among others, these advantages:
appimaged
--appimage-extract
parameterEspecially in the 3D printing world, the format has gained a lot of traction, with most of the important slicers and CAD packages shipping official AppImages of release and pre-release versions:
Here is an overview of projects that are already distributing upstream-provided, official AppImages.
I would invest time into making this happen but since my Mono knowledge is rather limited I would do this only if MatterHackers is interested in providing and supporting an official AppImage, and if someone from the MatterControl project would be willing to work with me along the way.
We could set up automated build using Travis CI for each git push.
The text was updated successfully, but these errors were encountered: