Open TeamPuzel opened 3 months ago
I got no output before but now there's this:
error: (store ): Failed to load build configuration for file:///home/lua/Projects/adwaita-test/build.zig (error: error.RunFailed)
error: (store ): Failed to execute build runner to collect build configuration, command:
/home/lua/Toolchains/zig/zig build --build-runner /home/lua/.cache/zig/build_runner/21872970afd69e48a0847077e5196711/build_runner.zig
Error: error: FileNotFound
error: (store ): Failed to load build configuration for file:///home/lua/Projects/adwaita-test/build.zig (error: error.RunFailed)
Okay, I figured out what causes the issue (kind of) I renamed the folder with cross compilation shared libraries and zls magically started working again.
It is used like so:
if (!target.query.isNative()) {
if (target.result.cpu.arch == .x86_64) {
exe.addLibraryPath(b.path("cross/x86_64/usr/lib64"));
exe.addIncludePath(b.path("cross/x86_64/usr/include"));
} else if (target.result.cpu.arch == .aarch64) {
exe.addLibraryPath(b.path("cross/aarch64/usr/lib64"));
exe.addIncludePath(b.path("cross/aarch64/usr/include"));
}
} else {
exe.addLibraryPath(.{ .cwd_relative = "/usr/lib64" });
exe.addIncludePath(.{ .cwd_relative = "/usr/include" });
}
I don't know what zls is even doing, commenting this out entirely does not fix the issue. Where is it even getting the paths to the cross compilation libraries from.
Could you post the entire log output of ZLS? Ideally with a debug build.
i had the same thing happen, im still learning zig so i thought i wrote some bad code, checked it over and over again XD
Could you post the entire log output of ZLS? Ideally with a debug build.
Unfortunately I was already on the macOS 15 beta and I would like to avoid booting into linux until I am sure it's not going to break :( Still, there was no other log output besides some startup information, so I will have to build zls in debug mode.
I just tested your project on my Arch Linux system and everything worked. I didn't even need to install any missing system dependencies.
Running ZLS's custom build runner with zig build --build-file ~/repos/Crates/build.zig --build-runner ~/repos/zls/src/build_runner/0.12.0.zig
yielded the following output:
The final Zig file can then be produced with the following command:
zig translate-c header.h -I /usr/local/include -I /usr/include/x86_64-linux-gnu -I /usr/include -I/usr/include/libadwaita-1 -I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/graphene-1.0 -I/usr/lib/graphene-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/fribidi -I/usr/include/appstream -I/home/techatrix/repos/Crates/cross/x86_64/usr/include -I/home/techatrix/repos/Crates/cross/aarch64/usr/include
The first three include paths are added by default on Linux.
// header.h
#include <libadwaita-1/adwaita.h>
Maybe it was using some cached data from earlier x86 cross compilation? I tried deleting both the local and global cache and it didn't help, it only started working again after I renamed that folder. It then kept working even after renaming it back.
You do seem to have these in the output:
"/home/techatrix/repos/Crates/cross/x86_64/usr/include",
"/home/techatrix/repos/Crates/cross/aarch64/usr/include"
So if headers for the wrong architecture were to be found first, wouldn't that cause an issue?
So if headers for the wrong architecture were to be found first, wouldn't that cause an issue?
I believe that is possible. I do not have a Crates
directory so this could explain why I don't have such an issue.
I'm having the exact same issue. Running ZLS 0.13.0 on Ubuntu 23.10
EDIT: adding an include path to the module does not work, but adding the same include path to an exe makes it work.
Zig Version
0.13.0 (compiled from source a few days ago)
Zig Language Server Version
0.14.0-dev.1+c5ceadf
Client / Code Editor / Extensions
VSCode
Steps to Reproduce and Observed Behavior
I was working on an application and at some point zls stopped working correctly with this error. I've been working on the build.zig for a while so I didn't notice, so I do not know what started causing it. Code suggestions completely stopped working for gtk libraries.
The code is available here https://github.com/TeamPuzel/Crates
I am using Fedora 40 on aarch64 (M2 Mac)
Expected Behavior
This error is incorrect, building with zig works perfectly fine.
Relevant log output
No response