[Bug 1190681] New: Zig fails to build because of "Could NOT find lld (missing: LLD_LIBRARIES LLD_INCLUDE_DIRS) "
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 Bug ID: 1190681 Summary: Zig fails to build because of "Could NOT find lld (missing: LLD_LIBRARIES LLD_INCLUDE_DIRS) " Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: screening-team-bugs@suse.de Reporter: socvirnyl.estela@gmail.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Greetings! I have a few problems building zig in openSUSE Tumbleweed. **What I want to do** I want to successfully build zig in openSUSE Tumbleweed with llvm, clang, and lld provided by the distro's repositories. **Expected Outcome** Builds successfully **Actual Outcome** Failed to build **What I did** In `~/local/zig-0.8.1`, I use the following commands based on how others build zig: ```sh cmake -G Ninja -B build \ -DCMAKE_BUILD_TYPE=None \ -DCMAKE_INSTALL_PREFIX=$(llvm-config --prefix) \ -DZIG_PREFER_CLANG_CPP_DYLIB=ON . ``` ```sh ninja -C build ninja: Entering directory `build' [19/164] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o FAILED: CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o /usr/bin/c++ -I/home/uncomfy/local/zig-0.8.1/deps/SoftFloat-3e/source/include -I/home/uncomfy/local/zig-0.8.1 -I/home/uncomfy/local/zig-0.8.1/build -I/home/uncomfy/local/zig-0.8.1/src -I/home/uncomfy/local/zig-0.8.1/src/stage1 -std=c++14 -DZIG_LINK_MODE=Dynamic -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces -Wno-comment -MD -MT CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o -MF CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o.d -o CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o -c /home/uncomfy/local/zig-0.8.1/src/zig_llvm.cpp /home/uncomfy/local/zig-0.8.1/src/zig_llvm.cpp:67:10: fatal error: lld/Common/Driver.h: No such file or directory 67 | #include <lld/Common/Driver.h> | ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. [28/164] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1_main.cpp.o ninja: build stopped: subcommand failed. ``` **What I found out** Someone in Discord assisted me and gave me the link of the build logs. We found out that the reason it fails might be because of this line: ``` # These are only available as static libraries, which we don't ship. rm -rf %{buildroot}%{_includedir}/{clang-tidy,lld} ``` It means `/usr/include/lld` does not exist in llvm-devel. Thus, zig won't be able to build. **Why do I want to include those static libraries** Because some distributions already ship zig in their respective repositories, I want to also build zig succesfully and propose that it should be added in openSUSE's repos in the future. **What could be changed to remove the problem** Including the static libraries in the llvm-devel packages and the respective headers so that applications can build against these. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 William Brown <william.brown@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |william.brown@suse.com -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 Soc Virnyl Estela <socvirnyl.estela@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |socvirnyl.estela@gmail.com -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 Roman Lebedev <lebedev.ri@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugzilla.opensuse.or | |g/show_bug.cgi?id=1193892 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c1 Aaron Puchert <aaronpuchert@alice-dsl.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aaronpuchert@alice-dsl.net --- Comment #1 from Aaron Puchert <aaronpuchert@alice-dsl.net> --- We don't usually package static libraries (because of binary size and updates basically) and so far the case hasn't been very compelling for lld. The last time someone wanted to package Zig and stumbled into the same error (see comment on https://build.opensuse.org/package/show/devel:tools:compiler/llvm10), I noted that it's just calling the linker binary as library, so this might be replaced by launching the corresponding binaries. (The patch can still be found in https://build.opensuse.org/request/show/799663, though it doesn't seem to apply clean anymore. But afaics zig is still only using those very high-level functions that map the functionality of the linker binaries. [1] Also I'm not sure if the patch is production ready.) Discussed this with Andrew on IRC once, they want to have a single portable binary as compiler, ideally statically linked, which is why they're linking with lld libraries instead of invoking the binary. Which is of course a bit at odds with the philosophy of most Linux distributions. Not a problem though, Zig links with libLLVM.so just fine if we make it. But there isn't a real deep API for lld as for LLVM or Clang, so upstream seems to not bother about providing a dynamically linked version of liblld, as we'd want it here. And since we'll not get a single binary anyway, we might just not bother as well and launch the linker as a separate process. [1] https://github.com/ziglang/zig/blob/master/src/zig_llvm.cpp -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c2 --- Comment #2 from Aaron Puchert <aaronpuchert@alice-dsl.net> --- Just FYI, I still have my local branch of that attempt at packaging Zig, but I didn't submit it because I don't have the resources to maintain it. If you think you could use that as a starting point I might upload it again. (Seems the package has been removed...) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c3 --- Comment #3 from Soc Virnyl Estela <socvirnyl.estela@gmail.com> --- VERY LATE UPDATE!!! Hello Aaron Puchert. I did some digging around the patch you have before and successfully built zig-0.9.1. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c4 Aaron Puchert <aaronpuchert@alice-dsl.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |richard.palethorpe@suse.com --- Comment #4 from Aaron Puchert <aaronpuchert@alice-dsl.net> --- *** Bug 1202297 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c5 --- Comment #5 from Aaron Puchert <aaronpuchert@alice-dsl.net> --- (In reply to Soc Virnyl Estela from comment #3)
Hello Aaron Puchert. I did some digging around the patch you have before and successfully built zig-0.9.1.
Good to hear! If you still have it working, would you mind submitting it into a devel repository (devel:tools:compiler might be a good candidate) and perhaps even Factory? You're not the first to run into this issue, and if it's in the repository other people could use it and don't have to run into the same issues. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c6 --- Comment #6 from Soc Virnyl Estela <socvirnyl.estela@gmail.com> --- Hello again Aaron Puchert. Not sure why the build is failing on this patch. The code you have that I modified still works but LLD crashes or fails on stage 3. Link to build: https://build.opensuse.org/package/show/home:uncomfyhalomacro:devel:language... -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c7 --- Comment #7 from Aaron Puchert <aaronpuchert@alice-dsl.net> --- The signatures of the link functions changed, but you didn't change the signature of the replacement: we implement a function of type "bool (size_t, const char **, bool, void (*)(void *, const char *, size_t), void *, void *)", but we need functions of type "bool (int, const char **, bool, bool)". I was wondering why this compiles at all, but it seems the only usage is in Zig code, where the functions are declared as extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool; extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool; extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool; This of course is not binary compatible with the functions that we implement. I'll see if I can fix that. I've also wondered if we can build a stub library that pretends to be liblld. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 Ilja Sidoroff <ilja.sidoroff@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ilja.sidoroff@iki.fi -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c8 Soc Virnyl Estela <socvirnyl.estela@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #8 from Soc Virnyl Estela <socvirnyl.estela@gmail.com> --- Currently, openSUSE now ships with zig thanks to Aaron Puchert's patches and help. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1190681 http://bugzilla.opensuse.org/show_bug.cgi?id=1190681#c9 --- Comment #9 from Aaron Puchert <aaronpuchert@alice-dsl.net> --- That's good to hear! For what it's worth, I also made this into a "stub" library, but haven't packaged it yet: https://github.com/aaronpuchert/liblld-stub. -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com