Giter Site home page Giter Site logo

Comments (8)

BratishkaErik avatar BratishkaErik commented on May 14, 2024

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 ziglang/zig#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?

from zgl.

Linouth avatar Linouth commented on May 14, 2024

Yeah. I'm using Arch which has the headers included in the libepoxy package.

from zgl.

BratishkaErik avatar BratishkaErik commented on May 14, 2024

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/

from zgl.

Linouth avatar Linouth commented on May 14, 2024

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..?

from zgl.

BratishkaErik avatar BratishkaErik commented on May 14, 2024

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();

from zgl.

Linouth avatar Linouth commented on May 14, 2024

Same include error.

from zgl.

BratishkaErik avatar BratishkaErik commented on May 14, 2024

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.

from zgl.

Linouth avatar Linouth commented on May 14, 2024

That did it! I had no idea that setTarget and setBuildMode are place dependent in the build file??
Thanks!

from zgl.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.