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

rusty_v8 0.104.0 build failure #1587

Open
chenrui333 opened this issue Aug 22, 2024 · 11 comments
Open

rusty_v8 0.104.0 build failure #1587

chenrui333 opened this issue Aug 22, 2024 · 11 comments

Comments

@chenrui333
Copy link

👋 trying to build the latest deno 1.46.0 release, but run into some build issue with rusty_v8 0.104.0. The error log is as below:

error build log
    --- stderr
    ninja: error: '../../../../../../../opt/homebrew/opt/llvm/lib/clang/20/lib/darwin/libclang_rt.osx.a', needed by 'obj/v8/libv8_libbase.a', missing and no known rule to make it
    thread 'main' panicked at /private/tmp/deno-20240822-12060-mwfxfo/rusty_v8/build.rs:969:3:
    assertion failed: ninja(&gn_out_dir, maybe_env).arg(target).status().unwrap().success()
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  error: failed to compile `deno v1.46.0 (/private/tmp/deno-20240822-12060-mwfxfo/deno/cli)`, intermediate artifacts can be found at `/private/tmp/deno-20240822-12060-mwfxfo/deno/target`.
  To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/10507035952/job/29108048297?pr=181980
relates to Homebrew/homebrew-core#181980

@devsnek
Copy link
Member

devsnek commented Aug 22, 2024

@chenrui333 at a guess, ensure that homebrew's llvm contains libclang_rt.osx.a?

ninja: error: '../../../../../../../opt/homebrew/opt/llvm/lib/clang/20/lib/darwin/libclang_rt.osx.a', needed by 'obj/v8/libv8_libbase.a', missing and no known rule to make it

@chenrui333
Copy link
Author

chenrui333 commented Aug 22, 2024

yeah, we have it

$ fd libclang_rt.osx.a /opt/homebrew/Cellar/
/opt/homebrew/Cellar/llvm/18.1.8/lib/clang/18/lib/darwin/libclang_rt.osx.a

but that is under 18

@devsnek
Copy link
Member

devsnek commented Aug 22, 2024

Sounds like you need to ensure your llvm 20 installation has the needed components or switch to using your llvm 18 installation?

@avindra
Copy link
Contributor

avindra commented Aug 22, 2024

getting a similar error (in opensuse)

ninja: error: '../../../../../../../../usr/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a', needed by 'obj/v8/libv8_libbase.a', missing and no known rule to make it
thread 'main' panicked at build.rs:965:3:
assertion failed: ninja(&gn_out_dir, maybe_env).arg(target).status().unwrap().success()

@devsnek
Copy link
Member

devsnek commented Aug 22, 2024

I googled and found this, perhaps your llvm distributions need to be updated: https://stackoverflow.com/questions/76936217/how-to-build-libclang-rt-builtins-a

@chenrui333
Copy link
Author

llvm 20 is not the latest release

image

any how that both llvm18 and 20 can be supported? if not, that would be the one supporting llvm18?

@devsnek
Copy link
Member

devsnek commented Aug 24, 2024

I don't think the version matters, i think the issue is that you have built llvm without compiler-rt enabled. If you want the compiler-rt requirement removed you will need to implement patches in the upstream chromium repo which we could then pull into rusty_v8.

@nathanwhit
Copy link
Member

nathanwhit commented Aug 30, 2024

I looked into this, I believe the issue is that the build assumes you're using clang version 20, even when you set a custom clang base path. So then it looks for that static library under the incorrect path.

We should probably be detecting the clang version and passing it along in build.rs.

For now, to fix the build you can try adding the env var

GN_ARGS='clang_version=18 use_lld=false'

(assuming the version in homebrew is 18, which it currently is).

The use_lld=false arg may not be necessary, but I found that locally I needed it to get the build working.

@felixonmars
Copy link

While packaging for Arch, we encountered this as well. Unfortunately the above workaround didn't work for us because our compiler-rt (which was built separately as a package) installs the file as /usr/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a, which here it looks for /usr/lib/clang/18/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a.

Any idea how can I get around this?

@devsnek
Copy link
Member

devsnek commented Sep 3, 2024

@felixonmars
Copy link

felixonmars commented Sep 3, 2024

I see, thanks for the hint. Hacking this into the Rust building process is much more frustrating though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants