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

Zed fails to build on Chimera Linux #15902

Open
1 task done
yoctozepto opened this issue Aug 7, 2024 · 3 comments
Open
1 task done

Zed fails to build on Chimera Linux #15902

yoctozepto opened this issue Aug 7, 2024 · 3 comments
Labels
bug [core label] linux open source Open source community projects, contributions, etc platform support An umbrella label for all platforms

Comments

@yoctozepto
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I am trying to build Zed on Chimera Linux. Chimera Linux is a non-GNU Linux distribution, it runs entirely with musl libc and LLVM stack (including their libc++). I have installed the same required packages as suggested for Void Linux (package naming is mostly same between the two). cargo build built all the deps but fails to link the final zed binary. It shows (example with main at 9907742):

  = note: ld: error: undefined symbol: __start_linkme___GPUI_ACTIONS
          >>> referenced by 3pr1xjrb4bjlzugq6x7tejet4
          >>>               gpui-39036a172b51e725.3pr1xjrb4bjlzugq6x7tejet4.rcgu.o:(gpui::action::__GPUI_ACTIONS) in archive /home/radek/src/zed/target/debug/deps/libgpui-39036a172b51e725.rlib
          >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)

          ld: error: undefined symbol: __stop_linkme___GPUI_ACTIONS
          >>> referenced by 3pr1xjrb4bjlzugq6x7tejet4
          >>>               gpui-39036a172b51e725.3pr1xjrb4bjlzugq6x7tejet4.rcgu.o:(gpui::action::__GPUI_ACTIONS) in archive /home/radek/src/zed/target/debug/deps/libgpui-39036a172b51e725.rlib

          ld: error: undefined symbol: __start_linkm2___GPUI_ACTIONS
          >>> referenced by 3pr1xjrb4bjlzugq6x7tejet4
          >>>               gpui-39036a172b51e725.3pr1xjrb4bjlzugq6x7tejet4.rcgu.o:(gpui::action::__GPUI_ACTIONS) in archive /home/radek/src/zed/target/debug/deps/libgpui-39036a172b51e725.rlib
          >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)

          ld: error: undefined symbol: __stop_linkm2___GPUI_ACTIONS
          >>> referenced by 3pr1xjrb4bjlzugq6x7tejet4
          >>>               gpui-39036a172b51e725.3pr1xjrb4bjlzugq6x7tejet4.rcgu.o:(gpui::action::__GPUI_ACTIONS) in archive /home/radek/src/zed/target/debug/deps/libgpui-39036a172b51e725.rlib
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

Relevant software versions (including its Chimera release/build number after the dash, for reference):

LLVM 18.1.8-r6
Rust 1.80.0-r1
Cargo 1.80.0-r0

The same issue happens on main (9907742) and the latest release (v0.146.5).

Environment

(cannot run)

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

@yoctozepto yoctozepto added admin read bug [core label] labels Aug 7, 2024
@yoctozepto
Copy link
Author

Digging deeper, I found:

The following workarounds help (choose one):

  1. RUSTFLAGS="-Clink-arg=-z -Clink-arg=nostart-stop-gc" (basically implementing what the error message suggests as a workaround)
  2. RUSTFLAGS="-C link-dead-code" (hammer-like solution)

@notpeter notpeter added linux open source Open source community projects, contributions, etc platform support An umbrella label for all platforms and removed triage labels Aug 9, 2024
@someone13574
Copy link
Contributor

someone13574 commented Aug 26, 2024

This occurs when building GPUI with the rust nightly toolchain as well. (at least on x86_64 linux). The linker flags work to fix the issue.

@whypet
Copy link

whypet commented Sep 3, 2024

Both workarounds have fixed the issue for me partially, I had to disable dynamic linking for musl (#10990) and manually link libunwind as I was getting unresolved symbol errors related to unwinding (not sure why it wasn't already being linked). I added this line above cargo build ... to script/bundle-linux:

export RUSTFLAGS="${RUSTFLAGS} -Clink-arg=-z -Clink-arg=nostart-stop-gc -Ctarget-feature=-crt-static -Clink-args=-lunwind"

The gettext package is needed on Chimera Linux for that bundle script to be able to use envsubst.
I also removed the -d "\n" argument from the xargs command at line 118 because it isn't a valid option in FreeBSD/chimerautils xargs.

mikayla-maki pushed a commit that referenced this issue Feb 2, 2025
…4087)

This switches how actions are registered in GPUI from
[dtolnay/linkme](https://github.com/dtolnay/linkme) to
[dtolany/inventory](https://github.com/dtolnay/inventory), fixing the
linking error seen in #15902, which also occurs on nightly toolchains.
I'm not sure if that issue should be closed or not given the other
problems on Chimera though.

This also fixes zed-industries/create-gpui-app#10

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] linux open source Open source community projects, contributions, etc platform support An umbrella label for all platforms
Projects
None yet
Development

No branches or pull requests

4 participants