NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.02k stars 14.03k forks source link

Bun crashes immediately #215517

Closed usdogu closed 1 year ago

usdogu commented 1 year ago

Describe the bug

Bun crashes immediately when launching

nixpkgs: master @ fab09085df1b60d6a0870c8a89ce26d5a4a708c2

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix run nixpkgs#bun

Expected behavior

Bun launching without error

Additional context

fish: Job 1, 'nix run nixpkgs#bun' terminated by signal SIGILL (Illegal instruction)

Notify maintainers

@DAlperin

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[dogu@nixos:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.89, NixOS, 23.05 (Stoat), 23.05.20230207.fab0908`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/ismzj4bksv54y4x2b9spfvk9mqhbcwf8-source`
kilianar commented 1 year ago

I tried running nix run github:nixos/nixpkgs?rev=fab09085df1b60d6a0870c8a89ce26d5a4a708c2#bun on x86_64-linux, but I wasn't able to reproduce the issue.

usdogu commented 1 year ago

weird,

[dogu@nebula:~]$ nix run github:nixos/nixpkgs?rev=fab09085df1b60d6a0870c8a89ce26d5a4a708c2#bun
Illegal instruction (core dumped)
kirillrdy commented 1 year ago

@usdogu works for me as well

nix run github:nixos/nixpkgs?rev=fab09085df1b60d6a0870c8a89ce26d5a4a708c2#bun
bun: a fast bundler, transpiler, JavaScript Runtime and package manager for web software.

  run       ./my-script.ts        Run JavaScript with bun, a package.json script, or a bin
  x         bun-repl              Install and execute a package bin (bunx)

  init                            Start an empty Bun project from a blank template
  create    next ./app            Create a new project from a template (bun c)
  install                         Install dependencies for a package.json (bun i)
  add       react                 Add a dependency to package.json (bun a)
  link                            Link an npm package globally
  remove    underscore            Remove a dependency from package.json (bun rm)
  unlink                          Globally unlink an npm package
  pm                              More commands for managing packages

  dev       ./a.ts ./b.jsx        Start a bun (frontend) Dev Server
  bun       ./a.ts ./b.jsx        Bundle dependencies of input files into a .bun

  upgrade                         Get the latest version of bun
  completions                     Install shell completions for tab-completion
  discord                         Open bun's Discord server
  help                            Print this help menu
nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.10, NixOS, 23.05 (Stoat), 23.05.20230209.ae87533`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - channels(kirillvr): `""`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

@usdogu have you tried in qemu built using nixos-rebuild build-vm ? that way maybe something in your configuration vs something with hardware type/version

usdogu commented 1 year ago

Fixed with the vm. Closing this since it's an issue in my side

AlexMouton commented 1 year ago

fwiw I am getting this as well using nixos on an i5 using @kilianar example

Thanks A

kirillrdy commented 1 year ago

@AlexMouton nixpkgs packages official binaries. try downloading from https://github.com/oven-sh/bun/releases/tag/bun-v0.5.7

unzip bun-linux-x64.zip
cd bun-linux-x64/
/nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib64/ld-linux-x86-64.so.2 ./bun
bun: a fast bundler, transpiler, JavaScript Runtime and package manager for web software.

  run       ./my-script.ts        Run JavaScript with bun, a package.json script, or a bin
  x         bun-repl              Install and execute a package bin (bunx)

  init                            Start an empty Bun project from a blank template
  create    next ./app            Create a new project from a template (bun c)
  install                         Install dependencies for a package.json (bun i)
  add       @shumai/shumai        Add a dependency to package.json (bun a)
  link                            Link an npm package globally
  remove    moment                Remove a dependency from package.json (bun rm)
  unlink                          Globally unlink an npm package
  pm                              More commands for managing packages

  dev       ./a.ts ./b.jsx        Start a bun (frontend) Dev Server
  bun       ./a.ts ./b.jsx        Bundle dependencies of input files into a .bun

  upgrade                         Get the latest version of bun
  completions                     Install shell completions for tab-completion
  discord                         Open bun's Discord server
  help                            Print this help menu

if that crashes for you, maybe report issue upstream

AlexMouton commented 1 year ago

thanks @kirillrdy

AlexMouton commented 1 year ago

0.5.7 working

kirillrdy commented 1 year ago

0.5.7 working

and can you reproduce the crash with 0.5.5 ?

kirillrdy commented 1 year ago

also 0.5.7 has landed in nixpkgs

nix run github:nixos/nixpkgs#bun -- --version
0.5.7

does that work ?

AlexMouton commented 1 year ago

ah wait.
at 0.5.7 bun-linux-64 crashes, bun-linux-64-baseline works. at 0.5.5...same

AlexMouton commented 1 year ago

anyway, not a nixpkgs thing then

NobbZ commented 10 months ago

Baseline is built on "Nehalim" support, the non-baseline requires Haswell.

And Haswell is from 4th gen of Intel Core-i$whatever IIRC.

So for any older you probably need baseline. I also think, that nixpkgs should actually use the baseline, as that is much closer on the "do not optimize for a certain microarchitecture" than using haswell.

Alternatively build from source, really using no further micro-architecture related optimisations.