Dotnet core on linux

I may be crazy, but I’m trying to get Rhino3DMIO to work under dotnet core on linux. It works on Windows, but it looks like it’s not finding the native dynamic library on linux. librhino3dmio_native.dylib is being copied into the bin directory when I build the project

Here is the error message I get when running some unit tests:

Failed
Error Message:
System.InvalidOperationException : Failed to read 3dm file /tmp/myfile.3dm.
Unable to load shared library ‘librhino3dmio_native’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibrhino3dmio_native: cannot open shared object file: No such file or directory
----> System.DllNotFoundException : Unable to load shared library ‘librhino3dmio_native’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibrhino3dmio_native: cannot open shared object file: No such file or directory
Stack Trace:

–DllNotFoundException
at UnsafeNativeMethods.StringHolder_New()
at Rhino.Runtime.InteropWrappers.StringHolder…ctor()
at Rhino.FileIO.File3dm.ReadWithLog(String path, String& errorLog)

System Details

I’m currently using dotnet 2.2 preview 3 tyring to work around some existing bugs in dotnet core 2.1.
I’m running RHEL 7.6

Hi @Brad_Campbell,

Doesn’t sound that crazy. :wink:

I’m asking around to see if anyone here has tried.

Just curious, why do you need Rhino3dmIo on Linux? What are you trying to do?

If I recall correctly, the Rhino3dmIO on GitHub requires openNURBS 5. Did you find this and build?

– Dale

We only compile Rhino3dmIO for Windowss, Mac, iOS and Android. We probably need to create another compile for android

I have an application that we were previously running on linux using mono. The application uses a Rhino file as part of its input. I’ve been porting it to dotnet core because I see a lot of benefit there (perfomance and maintainability). I’m using the nuget package for Rhino3mdIO.Desktop (this is probably important to mention here).

So is the librhino3dmio_native.dylib that ends up on linux actually the android or Mac version?

And, Steve, that would be great to get a linux build.

If you are using the “desktop” version from nuget, then the Mac version is what the dylib is.

We do have a native python package that runs on Linux if that is any help.

That doesn’t help with this particular problem, but that is very good to know! Is this what you are talking about: https://pypi.org/project/rhino3dm/#files (I don’t see a linux whl file there).

Yes, linux builds itself from source since there are so many different distributions out there. pip install rhino3dm should work just fine on Linux

Cool. Back to dotnet, are you able to add a linux build to the nuget package?

We’ll take a look. We may have to just target a specific set of popular versions of Linux

To decide which ones, I would suggest taking a look at this: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog . And +1 for RHEL 7. We also have some systems with Suse.

Is this something I could help with?

Hello!
I’d like to throw in my experience.
I’ve been trying to do exactly the same, namely to have a dotnet core linux project use rhino3dm … I had good experience with a dotnet core (even narrower, just dotnetstandard) project that worked both on linux and windows fine, without anything Rhino.
I then wanted to include rhinodm and got a windows dotnetstandard project to work that used rhino3dm. In order to make that work, I had to circumvent all nuget mechanisms and had to load the libraries “organically”. The result was good, a pure dotnetstandard project that uses rhino3dm!
Then, I tried to run that project on linux.
I finally figured out how to compile opennurbs by using clang and introducting quite few tweaks into the makefile.
Then, I tried to make a reasonable dotnet core project out of the .csproj files hidden within


and that’s where I’m stuck currently. But I already have the opennurbs shared object so that it feels as if I’m not too far anymore from the finish line.
Any help/remarks would be appreciated!

Cheers.

In the 6.15 code branch OpenNURBS already builds unmodified on Linux using Clang. Not sure what the timetable is to get that code into the public OpenNURBS repo, @will ?

It is very similar to the OpenNURBS branch used by the rhino3dm project. That OpenNURBS version works fine on Linux. I’ve used it already to create the import_3dm add-on for Blender to import 3dm files, works also on Linux.

I’ll try to get to it today… otherwise Monday!

Thank you for the answer.
I should have added that I had to use a Rhino 5 version of opennurbs because the remaining C++ files in the rhinocommon github repository linked above seem to be Rhino 5 only.
By the way, getting the old Rhino 5 version of opennurbs wasn’t easy, the McNeel download link redirects to Rhino 6, so I had to check out an old commit of louipc’s fork of opennurbs: https://github.com/louipc/opennurbs and only then could I compile at least the C++ source files of rhinocommon into the shared object.
So, I’m afraid the Rhino 6 version of opennurbs alone won’t be of much help because the remaining C++ files needed for the C# wrapper around opennurbs are unavailable for Rhino 6.
If I get it correctly, the new rhino3d github repo is Rhino 6 but it only targets javascript and python but does not provide the C# wrapper around opennurbs, as needed for a dotnet core project. So I’m reliant upon the old Rhinocommon github repo for the C# wrapper.

This is being worked on. I should have V6 .NET and C++ code for compiling V6 based Rhino3dmIo in the upcoming weeks

1 Like

I’ve just updated the public opennurbs repository (see #9). You should now be able to build with clang.

$ make -e CC="clang" CCC="clang++" LINKFLAGS="-luuid"

For Ubuntu 18.04 you can install build tools/dependencies using sudo apt install make clang uuid-dev. For Amazon Linux 2, sudo yum install make clang libuuid-devel.

One step closer to Rhino3dmIO running in .NET Core on Linux…

1 Like

Any update on when Rhino3dmIo will be available on .NET?

Will we be able to use the nuget package Rhino3mdIO.Desktop?