Skip to content

bun build --compile-produced executable does not run in NixOS (bun 1.3.12) #29290

@etinquis

Description

@etinquis

What version of Bun is running?

1.3.12+700fc117a

What platform is your computer?

NixOS 25.11 (Linux 6.12.62 x86_64 unknown)

What steps can reproduce the bug?

Repro available at https://github.com/etinquis/bun-build-fail/blob/main/flake.nix.

Clone repo and run with nix run .# -L.

Rolling version back to 1.3.11 in https://github.com/etinquis/bun-build-fail/blob/main/flake.nix#L30C88-L30C94 will allow the run to succeed.

What is the expected behavior?

1.3.11 result:

$ nix run .# -L
Hello, World!

What do you see instead?

1.3.12 result:

$ nix run .# -L
Could not start dynamically linked executable: /nix/store/jp29kf060vl7j2anb0d3sqx8ibhy6kns-bun-build-fail-1.0.0/bin/bun-build-fail
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

Additional information

ldd output from 1.3.12:

$ ldd ./result/bin/bun-build-fail 
        linux-vdso.so.1 (0x00007f0213b81000)
        libc.so.6 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libc.so.6 (0x00007f0213800000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib64/ld-linux-x86-64.so.2 (0x00007f0213b83000)
        libpthread.so.0 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libpthread.so.0 (0x00007f0213b76000)
        libdl.so.2 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libdl.so.2 (0x00007f0213b71000)
        libm.so.6 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libm.so.6 (0x00007f0213a89000)

1.3.11:

$ ldd ./result/bin/bun-build-fail
        linux-vdso.so.1 (0x00007f49f654c000)
        libc.so.6 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libc.so.6 (0x00007f49f6200000)
        /nix/store/pdwlyjkmc6icc0wb5gaw08m9ynqrg683-glibc-2.40-218/lib/ld-linux-x86-64.so.2 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib64/ld-linux-x86-64.so.2 (0x00007f49f654e000)
        libpthread.so.0 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libpthread.so.0 (0x00007f49f6541000)
        libdl.so.2 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libdl.so.2 (0x00007f49f653c000)
        libm.so.6 => /nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libm.so.6 (0x00007f49f6454000)

I can also reproduce this without the intermediate flake/bunnix/bun2nix, via building bun out of the nixpkgs repo directly with the changes in https://github.com/NixOS/nixpkgs/pull/508770/changes:

$ nix run .#bun -- build ~/Projects/bun-build-fail/main.ts --compile --outfile test && ./test
   [5ms]  bundle  1 modules
 [618ms] compile  test
Could not start dynamically linked executable: ./test
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions