fslaborg / RProvider

Access R packages from F#
http://fslab.org/RProvider/
Other
234 stars 69 forks source link

Add support for running on aarch64 architecture #263

Open kurt-mueller-osumc opened 1 year ago

kurt-mueller-osumc commented 1 year ago

Is your feature request related to a problem? Please describe.

I'd like to be able to use rprovider in net7.0 on my M1 Mac.

Describe the solution you'd like Update project to be net7.0 compatabile.

nhirschey commented 1 year ago

net7.0 projects can use net5.0 libraries. There are issues on windows, but mac should be fine.

What's the specific issue that you're encountering?

Bumping target framework to net7.0 blocks things still on net5.0, but keeping on 5.0 shouldn't affect 7.0. Unless there's something specific that you're running into?

AndrewIOM commented 1 year ago

Is there a specific issue - is this the one in #261? RProvider already supports .net 5+ and apple silicon macs

kurt-mueller-osumc commented 4 months ago

I have an example repo here: https://github.com/EverybodyKurts/rprovider-net8

Run this on an M1+ Mac in a docker container:

$ dotnet fsi script.fsx 
chmod: cannot access "'/home/vscode/.nuget/packages/rprovider/2.1.0/lib/net5.0/server/linux-x64/RProvider.Server'": No such file or directory
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
nhirschey commented 4 months ago

I don’t know docker, so take with a grain of salt: I think your dockerfile makes it think that it’s running on Debian Linux, hence looking for server/linux-x64/RProvider.Server. See here: https://github.com/devcontainers/images/tree/main/src/base-debian

If you change your dockerfile to think it’s on Mac, does that fix it?

kurt-mueller-osumc commented 4 months ago

Indeed, I am running a debian linux container on my m1 mac. dotnet build for most projects works just fine. The container also returns its underlying architecture as aarch64:

$ uname -a
Linux a1917383b162 6.6.12-linuxkit #1 SMP Thu Feb  8 06:36:34 UTC 2024 aarch64 GNU/Linux
kurt-mueller-osumc commented 4 months ago

Here is where the exe paths are specified:

https://github.com/fslaborg/RProvider/blob/008c08476d04eda984be5564e367f93954062f38/src/RProvider.DesignTime/RInteropClient.fs#L50

Supported runtimes:

https://github.com/fslaborg/RProvider/blob/008c08476d04eda984be5564e367f93954062f38/build.fsx#L72

Target frameworks:

https://github.com/fslaborg/RProvider/blob/008c08476d04eda984be5564e367f93954062f38/src/RProvider.Server/RProvider.Server.fsproj#L5

aarch64 is not on the list unfortunately.

nhirschey commented 4 months ago

Ok, so it sounds like it may not be an m1 macOS issue. It seems to be an arm64-Linux issue.

Can you use a macOS container on your m1 Mac? RProvider works on m1 Mac under macOS.

Probably also adding aarch64 to the list of server runtimes in build.fsx would fix that. Maybe try adding that line and building the library. If that makes it work then could submit it as a pr?

hmm, exe path also probably needs updating. Good point.

nhirschey commented 4 months ago

@kurt-mueller-osumc Your simplest solution is macOS host instead of Debian Linux.

nhirschey commented 2 months ago

@AndrewIOM this is why it's netstandard2.0: https://github.com/fslaborg/RProvider/pull/222

That was almost 3 years ago though so things could be different.

(sorry, just realized I put this in the wrong place. Should be on Kurt's PR).