termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.91k stars 2.97k forks source link

[Package]: Bun #11188

Open leap0x7b opened 2 years ago

leap0x7b commented 2 years ago

Package description

Bun is a new JavaScript runtime with a native bundler, transpiler, task runner and npm client built-in.

Home page URL

https://bun.sh

Source code URL

https://github.com/oven-sh/bun

Packaging policy acknowledgement

Additional information

No response

joshcangit commented 2 years ago

Bun now supports Linux aarch64. From oven-sh/bun#75.

However, downloading and using it results in error.

bash: ./bun: No such file or directory

That's because it will need to be an Android aarch64 build.

Same if using npm to install.

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for bun@0.5.6: wanted {"os":"darwin,linux","arch":"arm64,x64"} (current: {"os":"android","arch":"arm64"})
npm ERR! notsup Valid OS:    darwin,linux
npm ERR! notsup Valid Arch:  arm64,x64
npm ERR! notsup Actual OS:   android
npm ERR! notsup Actual Arch: arm64

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2023-02-10T08_22_51_052Z-debug-0.log
EAGLE1309 commented 2 years ago

Bun has released support for aarch64 so I hope this will get added soon!

SunPodder commented 1 year ago

Any update?

PeterHackz commented 1 year ago

you should use grun (glibc for termux) to run bun aarch64, use grun ./bun ...

holiq commented 1 year ago

you should use grun (glibc for termux) to run bun aarch64, use grun ./bun ...

How to get the grun(glibc), i have try to pkg install glibc and it not found

2096779623 commented 1 year ago

How to get the grun(glibc), i have try to pkg install glibc and it not found

https://wiki.termux.com/wiki/Switching_package_manager

https://github.com/termux-pacman/glibc-packages

Maxython commented 1 year ago

How to get the grun(glibc), i have try to pkg install glibc and it not found

https://wiki.termux.com/wiki/Switching_package_manager

https://github.com/termux-pacman/glibc-packages

If you only want to use pacman for the gpkg-dev repo, then it is not necessary to completely switch to pacman as the default package manager.

holiq commented 1 year ago

It's work, thanks @2096779623 @Maxython

joshcangit commented 1 year ago

Maybe bun should be added to the TUR repository.

SunPodder commented 1 year ago

Bun cannot be added to termux yet. I don’t know what’s that grun thing is. But I tried building bun and it requires latest zig which has some breaking changes from what we have in termux. Ig we need to update zig first.

This is the error

./build.zig:51:9: error: no member named 'source' in struct 'std.build.Pkg'
[460](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:461)
        .source = pkgPath("src/bun_redirect.zig"),
[461](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:462)
        ^
[462](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:463)
./build.zig:323:32: note: called from here
[463](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:464)
        try addInternalPackages(
[464](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:465)
                               ^
[465](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:466)
./build.zig:207:43: note: called from here
[466](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:467)
pub fn build(b: *std.build.Builder) !void {
[467](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:468)
                                          ^
[468](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:469)
./build.zig:178:79: error: no member named 'mode' in struct 'std.fs.file.OpenFlags'
[469](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:470)
    var runtime_out_file = try std.fs.cwd().openFile("src/runtime.out.js", .{ .mode = .read_only });
[470](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:471)
                                                                              ^
[471](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:472)
./build.zig:12:9: error: no member named 'addIncludePath' in struct 'std.build.LibExeObjStep'
[472](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:473)
    step.addIncludePath("src/deps");
[473](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:474)
        ^
[474](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:475)
./build.zig:320:20: note: called from here
[475](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:476)
        addPicoHTTP(obj, false);
[476](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:477)
                   ^
[477](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:478)
./build.zig:207:43: note: called from here
[478](https://github.com/SunPodder/termux-packages/actions/runs/4214755107/jobs/7315425240#step:6:479)
pub fn build(b: *std.build.Builder) !void {

https://devlog.hexops.com/2023/zig-0-11-breaking-build-changes/

nacho00112 commented 1 year ago

Any updates? I need the package too

holiq commented 1 year ago

Any updates? I need the package too

If see from Bun release, it can install with npm, but idk it work on termux or not

joshcangit commented 1 year ago

No, bun must be built from source into a package to be able to be installed in Termux.

Using npm will error out if used to install bun that way.

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for bun@0.6.9: wanted {"os":"darwin,linux","cpu":"arm64,x64"} (current: {"os":"android","cpu":"arm64"})
npm ERR! notsup Valid os:   darwin,linux
npm ERR! notsup Actual os:  android
npm ERR! notsup Valid cpu:  arm64,x64
npm ERR! notsup Actual cpu: arm64

npm ERR! A complete log of this run can be found in: /data/data/com.termux/files/home/.npm/_logs/2023-06-20T05_55_23_614Z-debug-0.log
PeterHackz commented 1 year ago

No, bun must be built from source into a package to be able to be installed in Termux.

Using npm will error out if used to install bun that way.

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for bun@0.6.9: wanted {"os":"darwin,linux","cpu":"arm64,x64"} (current: {"os":"android","cpu":"arm64"})
npm ERR! notsup Valid os:   darwin,linux
npm ERR! notsup Actual os:  android
npm ERR! notsup Valid cpu:  arm64,x64
npm ERR! notsup Actual cpu: arm64

npm ERR! A complete log of this run can be found in: /data/data/com.termux/files/home/.npm/_logs/2023-06-20T05_55_23_614Z-debug-0.log

I just downloaded it from their releases and it work ig. idk how I got grun, I installed it over a year ago. but it provides glibc runtime iirc Screenshot_20230620-090734

neuthral commented 1 year ago

thanks @Maxython got it working and made an alias alias bun='grun ~/.bun/bin/bun'

n-ce commented 11 months ago

Bun cannot be added to termux yet. I don’t know what’s that grun thing is. But I tried building bun and it requires latest zig which has some breaking changes from what we have in termux. Ig we need to update zig first.

Latest version of zig is available on termux now. zig_Termux

SunPodder commented 11 months ago

Bun cannot be added to termux yet. I don’t know what’s that grun thing is. But I tried building bun and it requires latest zig which has some breaking changes from what we have in termux. Ig we need to update zig first.

Latest version of zig is available on termux now. zig_Termux

Yeah I have looked into it. Currently there's no official way to cross compile bun. Moreover, building bun requires a pre-built bun executable. So there's no way to build it on-device either.

SunPodder commented 11 months ago

@HaccerCat @holiq does grun bun install work for you? I'm using bun 1.0.0 and it doesn't work.

bun install glob
bun add v1.0.0 (822a00c4)

 installed glob@10.3.4 with binaries:
  - glob

Failed to install 41 packages
error: AccessDenied installing bun-types
error: AccessDenied installing glob
error: AccessDenied installing foreground-child
error: AccessDenied installing jackspeak
error: AccessDenied installing minimatch
error: AccessDenied installing minipass
error: AccessDenied installing path-scurry
error: AccessDenied installing cross-spawn
...
PoneyClairDeLune commented 11 months ago

According to the official docs...

Bun must be installed to compile Bun

Bun depends on ESBuild

Wow, just wow. Why the heck don't the Bun devs directly use ESBuild to bundle and minify those files instead?

Maxython commented 11 months ago

@HaccerCat @holiq does grun bun install work for you? I'm using bun 1.0.0 and it doesn't work.

bun install glob
bun add v1.0.0 (822a00c4)

 installed glob@10.3.4 with binaries:
  - glob

Failed to install 41 packages
error: AccessDenied installing bun-types
error: AccessDenied installing glob
error: AccessDenied installing foreground-child
error: AccessDenied installing jackspeak
error: AccessDenied installing minimatch
error: AccessDenied installing minipass
error: AccessDenied installing path-scurry
error: AccessDenied installing cross-spawn
...

Try this:

bun install --backend=copyfile glob
romanovj commented 11 months ago

@HaccerCat @holiq does grun bun install work for you? I'm using bun 1.0.0 and it doesn't work.

bun install glob
bun add v1.0.0 (822a00c4)

 installed glob@10.3.4 with binaries:
  - glob

Failed to install 41 packages
error: AccessDenied installing bun-types
error: AccessDenied installing glob
error: AccessDenied installing foreground-child
error: AccessDenied installing jackspeak
error: AccessDenied installing minimatch
error: AccessDenied installing minipass
error: AccessDenied installing path-scurry
error: AccessDenied installing cross-spawn
...

that's because bun tries to create hardlinks

PeterHackz commented 11 months ago

@HaccerCat @holiq does grun bun install work for you? I'm using bun 1.0.0 and it doesn't work.

bun install glob
bun add v1.0.0 (822a00c4)

 installed glob@10.3.4 with binaries:
  - glob

Failed to install 41 packages
error: AccessDenied installing bun-types
error: AccessDenied installing glob
error: AccessDenied installing foreground-child
error: AccessDenied installing jackspeak
error: AccessDenied installing minimatch
error: AccessDenied installing minipass
error: AccessDenied installing path-scurry
error: AccessDenied installing cross-spawn
...

I did not try 1.0 and actually did not use bun since a long time, but last time I used bun install I got a kernel or syscall error I forgot 😆

holiq commented 11 months ago

@HaccerCat @holiq does grun bun install work for you? I'm using bun 1.0.0 and it doesn't work.

bun install glob
bun add v1.0.0 (822a00c4)

 installed glob@10.3.4 with binaries:
  - glob

Failed to install 41 packages
error: AccessDenied installing bun-types
error: AccessDenied installing glob
error: AccessDenied installing foreground-child
error: AccessDenied installing jackspeak
error: AccessDenied installing minimatch
error: AccessDenied installing minipass
error: AccessDenied installing path-scurry
error: AccessDenied installing cross-spawn
...

No bro, I haven't tried it

kaushiksahu18 commented 5 months ago

It's work, thanks @2096779623 @Maxython

Can u please tell me also, what I have to do.

I am very beginner in linux (in termux too)

Please provide step by step guide, (commends if possible)

# my state
bun
exec: Failed to execute process '/data/data/com.termux/files/home/.bun/bin/bun': The file exists and is executable. Check the interpreter or linker?