Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on WSL (libc not linked) #16985

Closed
fel1x-developer opened this issue Feb 2, 2025 · 1 comment · Fixed by #16986
Closed

Build failure on WSL (libc not linked) #16985

fel1x-developer opened this issue Feb 2, 2025 · 1 comment · Fixed by #16986
Assignees
Labels
build An issue related to building or compiling

Comments

@fel1x-developer
Copy link
Contributor

fel1x-developer commented Feb 2, 2025

What version of Bun is running?

1.2.2+c1708ea6a

What platform is your computer?

Linux 6.12.8-WSL2-LTS+ x86_64 x86_64

What steps can reproduce the bug?

Edit vendor/zig/lib/std/mem.zig so extern "C" becomes extern "c"

I'm using Ubuntu 24.04 LTS with 6.12 LTS kernel

$ git clean -fdx # need a clean setup of zig
$ vim vendor/zig/lib/std/mem.zig # `extern "C"` to `extern "c"`
$ bun run build

oven-sh/zig#4 (comment)
@Jarred-Sumner says bun is linked to libc, but what I see is:

[0/2] Building src/*.zig for x86_64-linux-gnu
/home/minsoochoo/bun/vendor/zig/lib/std/mem.zig:1059:8: error: dependency on libc must be explicitly specified in the build command
extern "c" fn strlen(s: [*:0]const u8) usize;
       ^~~
referenced by:
    indexOfSentinel__anon_56466: /home/minsoochoo/bun/vendor/zig/lib/std/mem.zig:1066:16
    lenSliceTo__anon_57904: /home/minsoochoo/bun/vendor/zig/lib/std/mem.zig:964:43
    18 reference(s) hidden; use '-freference-trace=20' to see all references

probably build.zig issue?

What is the expected behavior?

build success

What do you see instead?

CMake Build
  $ cmake --build /home/minsoochoo/bun/build/debug
[0/2] Re-checking globbed directories...
[0/2] Building src/*.zig for x86_64-linux-gnu
/home/minsoochoo/bun/vendor/zig/lib/std/mem.zig:1059:8: error: dependency on libc must be explicitly specified in the build command
extern "c" fn strlen(s: [*:0]const u8) usize;
       ^~~
referenced by:
    indexOfSentinel__anon_56466: /home/minsoochoo/bun/vendor/zig/lib/std/mem.zig:1066:16
    lenSliceTo__anon_57904: /home/minsoochoo/bun/vendor/zig/lib/std/mem.zig:964:43
    18 reference(s) hidden; use '-freference-trace=20' to see all references
FAILED: bun-zig.o /home/minsoochoo/bun/build/debug/bun-zig.o
cd /home/minsoochoo/bun && /home/minsoochoo/bun/vendor/zig/zig build obj --cache-dir /home/minsoochoo/bun/build/debug/cache/zig/local --global-cache-dir /home/minsoochoo/bun/build/debug/cache/zig/global --zig-lib-dir /home/minsoochoo/bun/vendor/zig/lib --prefix /home/minsoochoo/bun/build/debug -Dobj_format=obj -Dtarget=x86_64-linux-gnu -Doptimize=Debug -Dcpu=haswell -Denable_logs=true -Dversion=1.2.2 -Dreported_nodejs_version=22.6.0 -Dcanary=1 -Dcodegen_path=/home/minsoochoo/bun/build/debug/codegen -Dcodegen_embed=false --prominent-compile-errors -Dsha=87281b6d48f8015c8d779a28d47bbc6a670aee58
ninja: build stopped: subcommand failed.
  cmake took 3.06 seconds
  Command exited: code 1
error: script "build:debug" exited with code 1
error: script "build" exited with code 1

Additional information

No response

@fel1x-developer fel1x-developer added bug Something isn't working needs triage labels Feb 2, 2025
@Jarred-Sumner
Copy link
Collaborator

Okay I think I understand what's going wrong

Our changes to zig should only be applying to the std lib version and not to the zig compiler version

@Jarred-Sumner Jarred-Sumner added build An issue related to building or compiling and removed bug Something isn't working needs triage labels Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build An issue related to building or compiling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants