oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.13k stars 2.76k forks source link

Musl LibC Support #918

Open theoparis opened 2 years ago

theoparis commented 2 years ago

What is the problem this feature will solve?

It will allow bun to be used in linux distributions such as Alpine Linux or BunOS. This could also potentially solve #255.

What is the feature you are proposing to solve the problem?

I have already attempted to implement this by creating a patched dockerfile, build.zig and makefile for building bun under alpine linux. However, it is missing proper FFI support, which seems to be an issue with the internals of bun (as FFI and static linking seems to work with deno).

What alternatives have you considered?

No response

benatkin commented 1 year ago

Found this closed issue that suggests JavaScript Core may run on musl https://bugs.webkit.org/show_bug.cgi?id=187485

brynne8 commented 1 year ago

I'm also using Alpine Linux and being unable to run bun.

dargmuesli commented 1 year ago

Please add a :+1: to the first post instead of adding "me too" comments :pray:

notramo commented 1 year ago

WebKit is shipped on some musl Linux distros, which implies support for JavaScriptCore.

Nyaa97 commented 1 year ago

Easy to compile against musl libc. I need motivation to write a "normal" patch, but its possible. This requires: add musl flag to tcc build in Makefile -fPIC in build.zig turn off checking GLIBC version in build.zig turn off force GLIBC in workaround-missing-symbols.cpp rebuild JSCore

If you are trying to build using only clang, some additional patches are required.

Tested and works well for musl+clang image

theoparis commented 1 year ago

Why was the above comment marked as "off topic"? It is showing a temporary solution to the issue and it would help contribute torwards a permanent fix in the future.

brynne8 commented 1 year ago

Easy to compile against musl libc. I need motivation to write a "normal" patch, but its possible. This requires: add musl flag to tcc build in Makefile -fPIC in build.zig turn off checking GLIBC version in build.zig turn off force GLIBC in workaround-missing-symbols.cpp rebuild JSCore

If you are trying to build using only clang, some additional patches are required.

Tested and works well for musl+clang image

Great. Could you please upload the binary so that I can temporarily use?

theoparis commented 1 year ago

It would be nice if you could send the patches as well.

Pyroglyph commented 9 months ago

I need motivation to write a "normal" patch

@Nyaa97 Would it not have been faster to type git diff and paste the result here instead of typing out all the steps?

That aside, do you still have your working code that you could share here?

madmoizo commented 3 weeks ago

This issue/feature request is the most upvoted and probably the most viewed by people trying to get Bun works on Alpine but lack an official statement from the core team about the plans around it.

Is the progress on this feature blocked by other issues? Is it complex/time consuming to do? Is it complex to maintain? Is it just low priority? Is it on the 2025 roadmap?

Thanks a lot, can't wait to use Bun on Alpine.

Nyaa97 commented 3 weeks ago

I have updated my patch to musl, but it still needs some tweaking If anyone is willing to help, I would be grateful musl branch

slogivewd commented 2 weeks ago

Im waiting the feature to be supported as well

madmoizo commented 1 week ago

Good news everyone!

Image

At some point, I will create a bot to match Jarred's tweet with github issues