#error: "epoxy/gl.h" file not found

1 messages · Page 1 of 1 (latest)

uneven nebula
#

Hey. I'm using Manjaro Linux.

In my build.zig I have the following:

    exe.linkLibC();
    exe.linkSystemLibrary("m");
    exe.linkSystemLibrary("glfw");
    exe.linkSystemLibrary("epoxy");
    exe.linkSystemLibrary("z");

And in some part of my code I have a @cImport like so:

pub usingnamespace @cImport({
    @cInclude("stdio.h");
    @cInclude("math.h");
    @cInclude("time.h");
    @cInclude("epoxy/gl.h");
    @cInclude("GLFW/glfw3.h");
});

When I try to build it, it's telling me that it can't find either glfw or epoxy, which is strange, considering I have both installed.

It's also saying another thing:

/usr/lib/zig/lib/std/os.zig:148:24: error: root struct of file 'c' has no member named 'fd_t'
pub const fd_t = system.fd_t;
                 ~~~~~~^~~~~

Am I doing something wrong?

I'm using zig 0.11.0-dev.2358+43a6384e9

wraith dragon
#

@uneven nebula Does linking C source with them work?

#

the fd_t is weird and I have no clue

uneven nebula
#

linking C source with them?

wraith dragon
#

epoxy and GLFW

uneven nebula
#

how would I go ahead and test that?

wraith dragon
#

oh wait this is about includes

uneven nebula
#

yeah

wraith dragon
#

no clue sorry

uneven nebula
#

no problem

wraith dragon
sage gust
#

the cIncludes translate to #include <file.h> so you'd need to provide exe.addIncludePath("/path/to/those"); (if they aren't in a standard location?)

wraith dragon
#

I think they might just not have development packages?

sage gust
#

possible

uneven nebula
#

am I not including them already in the build.zig?

wraith dragon
# uneven nebula damn

try compiling this:

#include <epoxy/gl.h>

int main(void) {
    epoxy_gl_version();
}

put it in file.c then
cc file.c -lepoxy

uneven nebula
#

one sec

#

it worked

#

it isn't returning anything when running

#

but that is to be expected

wraith dragon
#

yeah, so this is a Zig thing

sharp oyster
#

linkSystemLibrary asks the linker to link with binaries that are in the system path. It does not add those paths to find C headers that are used by @cImport.

wraith dragon
#

no idea then, sorry

sharp oyster
#

You need addIncludePath to do that.

uneven nebula
wraith dragon
uneven nebula
#

so what would I give as parameters for the addIncludePath?

sharp oyster
sharp oyster
wraith dragon
uneven nebula
#

probably /bin somewhere

#

let me see

sharp oyster
wraith dragon
uneven nebula
wraith dragon
#

Does Zig not use the system include paths?

uneven nebula
#

found epoxy in /usr/include

sharp oyster
wraith dragon
uneven nebula
#

das what I did

#

I'll try building

sharp oyster
#

Nothing is added to the build unless you explicitly say so, to be clear.

#

C include paths included.

uneven nebula
#

glfw3 not found

#

this is on my end

#

gimme a sec

#

there

#

GLFW/glfw3.h should be it

#

okay it worked, now I have other bugs, but it's ok

#

at least this one was solved

#

thanks guys

sharp oyster
#

Welcome o7 😄

sage gust
#

🎆

wraith dragon
sharp oyster
#

Or so is my general impression, at least.

uneven nebula
#

now uh

#

I only hav eone last problem

#
pub const fd_t = system.fd_t;"```
#

this I have no idea about

#

should I simply try to update zig and hope it goes away?

#

updated, same error though

wraith dragon
sharp oyster
#

Or rather

#

More precisely

#

Including their source in your project source.

wraith dragon
#

sounds like it'd bloat your distribution quite a bit omw to ship GTK and all its dependencies with my source

sharp oyster
#

This is one of the reasons why I would likely never use GTK if I can at all avoid it 🤣
I want to be able to maintain my code, and be able to address things easily, etc; all of which is affected by this.

wraith dragon
#

where is os used?

uneven nebula
#

nowhere

wraith dragon
uneven nebula
#

it's not telling me

sage gust
#

is there more to it? what with -freference-trace?

#

its wasi

uneven nebula
#

the only time I even came close to mentioning os stuff is when I did the target thing, told it was wasm32 and freestanding

wraith dragon
uneven nebula
#

it told me now

#

" onInit: src/quad-part.zig:18:28"

sage gust
uneven nebula
#

now the thing is it's not telling me more than that, I'll try to see what it is doing

#

"error: wasm-ld: entry symbol not defined (pass --no-entry to suppress): _start"

#

ok this one should be easy

sharp oyster
#

The advantage is that you have more control over what code is actually being used in your program.

#

And being static, it makes it easier to support more systems.

#

Things like one binary for all Linuxes, etc.

#

There's a lot of things involved in the equation here, of course.

wraith dragon
sharp oyster
wraith dragon
uneven nebula
#

I had a pub var inside onInit that I was initializing

sharp oyster
uneven nebula
#

I had

pub var something: someType = undefined;
...
export fn onInit() void {
    something = someType.init();
    ...
}
sharp oyster
uneven nebula
#

well I removed that

#

from onInit

#

and it didn't complain anymore

#

it's complaining about something else now

sharp oyster
#

Odd.

uneven nebula
#

error: wasm-ld: entry symbol not defined (pass --no-entry to suppress): _start

#

what do I put in build.zig to tell pass --no-entry ?

sharp oyster
#

You build a library instead of an exe, if you're not already.

#

Specifically a dynamic library in WASM's case.

uneven nebula
#

I wasn't because last time it didn't work

#

do I just change the addExecutable to addSharedLibrary?

#

or do I make it a static one?

#

o

#

it worked

#

it pooped out a library now

#

weird, 1-2 hours ago it didn't

#

earlier it would build invalid wasm objects

#

now it works?

#

hey

#

I'm not saying no

#

it seems to function

#

thanks a lot guys

#

this saved my ass