wasmer icon indicating copy to clipboard operation
wasmer copied to clipboard

Please include Haiku Os

Open GatoAmarilloBicolor opened this issue 5 years ago â€ĸ 27 comments

Thanks for proposing a new feature!

Motivation

A clear and concise description of what the motivation for the new feature is, and what problem it is solving.

Haiku Os is a great operating system and with time and support it can become a opensource alternative to linux in desktop. Wasmer can be a great new skill with haiku.

Proposed solution

Please port wasmer to Haiku OS

A clear and concise description of the feature you would like to add, and how it solves the motivating problem.

Alternatives

A clear and concise description of any alternative solutions or features you've considered, and why you're proposed solution is better.

Additional context

Add any other context or screenshots about the feature request here.

GatoAmarilloBicolor avatar Jun 13 '19 16:06 GatoAmarilloBicolor

Hey! I've looked at Haiku in the past but don't have much context on it. It does seem very cool, and I'm all for diversity of systems and supporting smaller platforms.

Have you tried to compile Wasmer for Haiku? Do you have any information or experience about how much work it will be?

I'd surely like to support Haiku and am willing to put in some extra work to make it happen, but I don't know that we will have the usage to really justify much of a focused effort.

If you or other people interested in supporting Haiku are willing to work with us or advise us on what we'd need to do to have compatibility, then maybe we can figure out a way to have it working well on Haiku.

MarkMcCaskey avatar Jun 13 '19 18:06 MarkMcCaskey

I am not a hardcore programer but i am a very hardcore user, and understand some of the basic to help, and i am pleasure to help with that, right now i am trying to build it in my haiku updated, will update the this thread later with any results i get, thanks.

Haiku are very compatible with Posix, have some parts from FBSD kernel, but dont have a X11 server(is more similar to windows or mac than to linux or fbsd on it), it have a bash terminal, sometimes are not so hard to port if the libs are ported.

Right now it have a lot of ports on "haiku-depot" repository, have even openjdk, but we lack some software, i am using it in an alternative laptop lenovo what i have, and sometimes i give some of love testing, reporting and trying to port basic programs, if i can help i will do it with a lot of pleasure.

Haiku are ver fast Os, very optimized, basic and easy, is in the future a good opensource option for the desktop as i see, very more easy than any *nix for a final user but with a very powerful ambient.

GatoAmarilloBicolor avatar Jun 14 '19 04:06 GatoAmarilloBicolor

ok, right now i get that :

curl https://get.wasmer.io -sSfL | sh which: no wasmer in (.:/boot/home/config/non-packaged/bin:/boot/home/config/bin:/boot/system/non-packaged/bin:/bin:/boot/system/apps:/boot/system/preferences) Installing Wasmer!

            ###
            #####
    ###     ######
    ######  #############

#######

############################ ############################ ############################ ############################ ############################ ##################### ### ##################### ########### ### ######## ####

The OS (haiku) is not supported by this installation script.

I will look on the script to see what can i do.

GatoAmarilloBicolor avatar Jun 14 '19 04:06 GatoAmarilloBicolor

Hi https://t.me/haiku_os/9255

GatoAmarilloBicolor avatar Jun 14 '19 06:06 GatoAmarilloBicolor

Hi @skarmiglione we would love to get Wasmer in Haiku but our eng resources are now focused on other things.

We would love to accept contributions for it though, would you like to help us on bringing Wasmer to Haiku?

syrusakbary avatar Aug 05 '19 20:08 syrusakbary

I looked into this in a purely personal capacity this weekend (Wasmer doesn't have the resources to prioritize this right now) and here's what I found:

  1. We'd need to update the region crate to support Haiku using BeOS style areas
  2. We'd need to add various types and functions to the libc crate: things like pthread_getattr_np, ucontext_t, etc. All of the things missing should exist on Haiku, just need to add them to the libc crate
  3. Compilation with Rust seemed to be causing some problems. I ran beta2 in VirtualBox with 8GB of RAM and 6 CPU cores and some dependencies when building wasmer took an extremely long time compile (> 30 minutes)

There may be more blockers but I think there shouldn't be anything major blocking it. We don't have the resources to add support for these things ourselves right now but we'd love to accept any PRs adding Haiku support to Wasmer once those blockers are resolved.

MarkMcCaskey avatar Dec 21 '20 15:12 MarkMcCaskey

Here some threads on the Haiku Os phorum.

https://discuss.haiku-os.org/t/rust-and-wasmer-how/10170

https://discuss.haiku-os.org/t/bytecode-alliance-could-bring-a-stampede-of-new-users/9039

GatoAmarilloBicolor avatar Dec 23 '20 09:12 GatoAmarilloBicolor

(Wasmer doesn't have the resources to prioritize this right now)

I came across the thread and opened up an issue in the Haikuports repository in order to bring more exposure to this, thanks for the assistance!

n0toose avatar Dec 23 '20 20:12 n0toose

Thanks for forwarding links to the two threads I started on the Haiku Discourse forum. I like lightweight OS options and I'd like to see Haiku trounce Ubuntu with it's thread affinity and speed! I'll be following this issue with great interest!

SamuraiCrow avatar Dec 24 '20 01:12 SamuraiCrow

(Haiku developer here.)

Compilation with Rust seemed to be causing some problems. I ran beta2 in VirtualBox with 8GB of RAM and 6 CPU cores and some dependencies when building wasmer took an extremely long time compile (> 30 minutes)

This may just be a VirtualBox problem. Haiku is known to have bad SMP performance in VirtualBox due to terrible ICI latencies, which is not an issue in QEMU/KVM, VMware, or just about any other VM software (or for that matter, bare metal.)

We'd need to update the region crate to support Haiku using BeOS style areas

Haiku has support for mmap, mlock, madvise, etc. While these due use Haiku-style "areas" internally (and the kernel generally "thinks" in those terms), most ported applications just use mmap et al. and not "areas" directly, so unless you have some specific need only areas can satisfy, feel free to just use the POSIX APIs.

We'd need to add various types and functions to the libc crate: things like pthread_getattr_np, ucontext_t, etc. All of the things missing should exist on Haiku, just need to add them to the libc crate

I think @kallisti5 and @nielx have done most of the work to get libc up and running on Haiku; they may be able to shed light on why those are not yet available (or maybe they in fact are?)

waddlesplash avatar Dec 24 '20 03:12 waddlesplash

libc should be working. We have had some minor issues with socket2/net2, but those should be resolved the next time these crates see a release (and all crates dependent on them update :grimacing: )

I do find random crates that are broken for various reasons (mio comes to mind) , but generally it's just non-OS-agnostic stuff that needs tweaked.

kallisti5 avatar Dec 24 '20 13:12 kallisti5

Region 2.2.0 currently fails but Region 3.0.0 is out. Does it break compatibility?

SamuraiCrow avatar Aug 20 '21 16:08 SamuraiCrow

I think we should be good to update to Region 3.0.0 :)

syrusakbary avatar Aug 20 '21 16:08 syrusakbary

Thanks! v3.0.0 seems to be a little more cross-platform.

SamuraiCrow avatar Aug 20 '21 16:08 SamuraiCrow

đŸĨŗ

n0toose avatar Aug 20 '21 16:08 n0toose

Region still seems to be the culprit under Haiku. It uses os::QueryIter from the same crate but Linux running the same version of Rust doesn't complain a bit. I'll have to look into this farther.

SamuraiCrow avatar Aug 21 '21 22:08 SamuraiCrow

Adding Haiku support to Region is underway. It compiles under the Haiku version of Rust but isn't debugged yet.

SamuraiCrow avatar Aug 26 '21 01:08 SamuraiCrow

Update:

My Haiku support for Region now passes half of the unit-tests.

SamuraiCrow avatar Sep 01 '21 10:09 SamuraiCrow

Nice!

syrusakbary avatar Sep 01 '21 10:09 syrusakbary

Bad News

The first try was a fluke that it completed all the unit tests at all. I've tried several variants and using the POSIX compatibility layer where possible gets closer than without but the query functions of the page tables aren't part of the POSIX standard. It looks like I'll have to invent my own compatibility layer for that function.

SamuraiCrow avatar Sep 30 '21 19:09 SamuraiCrow

We find this in quite a few ports to Haiku. Lots of non-POSIX, "linux only" api usages that hide until you try the code on Haiku.

The bright side is generally there are POSIX api calls that can accomplish the same task and the Linux-only api calls are generally just helpers to combine a few POSIX calls. Overall software gets a lot more portable once it runs on Haiku because of this.

kallisti5 avatar Sep 30 '21 19:09 kallisti5

Ok. I hope there are a few helper functions. Currently I was basing my code off the FreeBSD or OpenBSD version but I can also look at the Linux version.

SamuraiCrow avatar Sep 30 '21 19:09 SamuraiCrow

Update

After a code review by @nielx, the non-POSIX layer, native call branch of the Region crate is back on track! Haiku's Area subroutines are almost working and a B_BAD_ADDRESS error is being consistently returned by the allocator during most of the failing unit tests. I hope I can get this worked out. It's looking good.

SamuraiCrow avatar Oct 08 '21 03:10 SamuraiCrow

During the Haiku Coding Sprint last week, MMU_Man and I discovered the B_BAD_ADDRESS error was the result of passing Null to an unused pointer parameter. Now the error no longer occurs but only one more unit test clears in the Region crate.

SamuraiCrow avatar Nov 01 '21 01:11 SamuraiCrow

Thanks to another code review by @nielx, the area_for() function has been replaced by a hash lookup in my port of the region crate. The Haiku function was returning error messages when encountering Protection::NONE so now it is no longer used. One dependency has been introduced though: the lazy_static crate. Duplicating its functionality wouldn't have been worth it.

SamuraiCrow avatar Dec 05 '21 21:12 SamuraiCrow

After having added the DashMap crate dependency to reduce out a mutex, the Region crate still fails 16 unit tests but, recalling that Wasmer was designed with an older version of Region, I tried it with the current Wasmer sources and cargo build was successful on the first try now. Apparently the problems in the Region crate were from new 3.0 features that don't affect Wasmer.

EDIT

Building lib/vm/src with cargo build fails with an unsupported platform error. Now I start the actual port.

SamuraiCrow avatar Jan 13 '22 17:01 SamuraiCrow

The VM crate now compiles on my fork.

SamuraiCrow avatar Jan 13 '22 20:01 SamuraiCrow

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 13 '23 20:01 stale[bot]

You're stale stale bot 🍞

kallisti5 avatar Jan 13 '23 21:01 kallisti5

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 15 '24 01:01 stale[bot]