Closed Linouth closed 2 years ago
I do not understand why the compiler does not grab the available system libraries, which do seem to have to correct symbols in them.
See https://github.com/ziglang/zig/issues/6469
./libs/zgl/c.zig:6:5: error: C import failed @cImport({ ^ ./zig-cache/o/fca946021a1176b5ad82bf37c8570071/cimport.h:1:10: note: 'epoxy/gl.h' file not found #include <epoxy/gl.h> ^ ./libs/zgl/zgl.zig:228:6: error: container '.zgl.c' has no member called 'glClear' c.glClear(@as(types.BitField, if (mask.color) c.GL_COLOR_BUFFER_BIT else 0) |
Do you have libepoxy headers (usually package libepoxy-dev
or smth.) installed on your system?
Yeah. I'm using Arch which has the headers included in the libepoxy
package.
Yeah. I'm using Arch which has the headers included in the
libepoxy
package.
Ok, maybe clearing cache will help you
$ rm -r ~/.cache/zig/ where-project/zig-cache/
Same issue.
Though, explicitly adding exe.addSystemIncludePath("/usr/include/");
gives the error ld.lld: error: unable to find library -lepoxy
. So it does seem that the compiler has trouble finding the lib and header files..?
Try this (and clear cache):
const exe = b.addExecutable("motorsim", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); exe.addPackagePath("glfw", "libs/mach-glfw/src/main.zig"); glfw.link(b, exe, .{}); exe.addPackagePath("zgl", "libs/zgl/zgl.zig"); exe.linkSystemLibrary("dl"); exe.linkSystemLibrary("epoxy"); exe.install();
Same include error.
Same include error.
Try this (and clear cache):
const exe = b.addExecutable("motorsim", "src/main.zig"); exe.addPackagePath("glfw", "libs/mach-glfw/src/main.zig"); glfw.link(b, exe, .{}); exe.addPackagePath("zgl", "libs/zgl/zgl.zig"); exe.linkSystemLibrary("dl"); exe.linkSystemLibrary("epoxy"); exe.setTarget(target); exe.setBuildMode(mode); exe.install();
It works for me without -Dtarget=blabla
etc.
That did it! I had no idea that setTarget
and setBuildMode
are place dependent in the build file??
Thanks!
I had mach-glfw and zgl working together nicely, but at some point linking started to fail with the following errors;
zig build --verbose-link
givesI am using Zig version
0.10.0-dev.3475+b3d463c9e
with the following in my build scriptIf I understand correctly, my libepoxy version depends on the GLIBC_2.34 symbols, while the included
libdl.so.2
file being linked hasGLIBC_2.2.5
. I do not understand why the compiler does not grab the available system libraries, which do seem to have to correct symbols in them.Setting the target with
-Dtarget=x86_64-linux-gnu.2.34
, as suggested to someone with the same problem, results inI do not know how to proceed right now. Someone in the Zig discord server had the same issue, and for him bulding libepoxy himself seemed to work. However, it should be able to use the installed system libraries.