ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<hlolli__> So far Zig falls under the category of underpromising and overdeliver. Besides healthy and polite modesty, seeing 1,4k tickets on github made me for sure misjudge Zig, I wonder if more people see it the same way from distance.
<marler8997> 1,4k tickets, what impression did that give you?
<hlolli__> That nothing works :)
<fengb> There’s a lot of bugs for sure
lunamn has quit [Quit: Ping timeout (120 seconds)]
lunamn has joined #zig
nvmd has quit [Quit: Later nerds.]
frmdstryr has joined #zig
<radgeRayden> something something people only complain about languages they actually use
<fengb> That’s Stroustup’s justification for C++ yes
<ifreund> of those issues many are about future features/enhancements
<ifreund> zig is a very ambitious project
<andrewrk> I think the ratio of open/close is interesting
<andrewrk> rust has 6,088 issues open but that's only 17% of their total issue count
<andrewrk> zig is at 33%
<ifreund> interesting
<ifreund> I feel like that has more to do with project age than anything else though
<andrewrk> good point
msingle has joined #zig
xackus has quit [Ping timeout: 256 seconds]
<hlolli__> that sounds good indeed, I have no idea what's inside those 1,4k tickets, it seems almost 50% of them are marked as milestones, so the bookkeeping seems good and the response rate high, something you don't get from compiler repos with too big and alienated community.
earnestly has quit [Ping timeout: 264 seconds]
<andrewrk> ifreund, got your 2 os bits fixes into 0.7.x branch
msingle has quit [Ping timeout: 272 seconds]
msingle has joined #zig
msingle has quit [Ping timeout: 260 seconds]
msingle has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
virkony has quit [Ping timeout: 244 seconds]
hnOsmium0001 has joined #zig
msingle has quit [Ping timeout: 272 seconds]
moinstar has quit [Remote host closed the connection]
hlolli_ has joined #zig
hlolli__ has quit [Ping timeout: 246 seconds]
a_chou has joined #zig
msingle has joined #zig
<pixelherodev> Age is probably the biggest factor
<pixelherodev> The percentage means little
<pixelherodev> If there is one critical bug, that can be worse than e.g. a dozen minor platform-specific issues, or grammatical mistakes in documentation, etc
<fengb> Luckily Zig has all of those bugs 🙃
<pixelherodev> lol
hlolli_ has quit [Ping timeout: 272 seconds]
tetsuo-cpp has joined #zig
tetsuo-cpp has quit [Remote host closed the connection]
tetsuo-cpp has joined #zig
frmdstryr has quit [Ping timeout: 240 seconds]
gpanders has joined #zig
jjsullivan has quit [Remote host closed the connection]
gpanders has quit [Quit: ZNC - https://znc.in]
lucid_0x80 has joined #zig
dumenci has joined #zig
lucid_0x80 has quit [Ping timeout: 256 seconds]
a_chou has quit [Quit: a_chou]
kristoff_it has quit [Ping timeout: 256 seconds]
msingle has quit [Ping timeout: 240 seconds]
tetsuo-cpp has quit [Ping timeout: 264 seconds]
adsr has joined #zig
CodeSpelunker has quit [Remote host closed the connection]
dumenci has quit [Ping timeout: 240 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<marler8997> what happened to the c_char c_uchar types?
tetsuo-cpp has joined #zig
lucid_0x80 has joined #zig
tetsuo-cpp has quit [Read error: No route to host]
knebulae has quit [Read error: Connection reset by peer]
knebulae has joined #zig
<andrewrk> accepted but not yet implemented
cole-h has quit [Ping timeout: 240 seconds]
xackus has joined #zig
lucid_0x80 has quit [Quit: Leaving]
skuzzymiglet has joined #zig
lucid_0x80 has joined #zig
moinstar has joined #zig
mokafolio has quit [Quit: Bye Bye!]
tane has joined #zig
mokafolio has joined #zig
earnestly has joined #zig
skuzzymiglet has quit [Ping timeout: 264 seconds]
jjido has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
shakesoda has joined #zig
<ifreund> andrewrk: thanks, you're the best
virkony has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
kristoff_it has joined #zig
diginet has quit [Quit: diginet has quit!]
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dumenci has joined #zig
lucid_0x80 has quit [Ping timeout: 264 seconds]
lltt has quit [Ping timeout: 272 seconds]
<ifreund> alexnask[m]: any chance zls could get "goto references" for struct fields?
swills has quit [Ping timeout: 260 seconds]
frmdstryr has joined #zig
jjido has joined #zig
wootehfoot has joined #zig
wjlroe has quit [Read error: Connection reset by peer]
wjlroe has joined #zig
moo has joined #zig
wootehfoot has quit [Ping timeout: 240 seconds]
moo has quit [Quit: Leaving]
wootehfoot has joined #zig
swills has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
riba has joined #zig
Ashpool has joined #zig
osa1 has quit [Quit: osa1]
HugoDan has joined #zig
osa1 has joined #zig
osa1 has quit [Client Quit]
<HugoDan> helloes
<ifreund> o7
riba has quit [Ping timeout: 265 seconds]
waleee-cl has joined #zig
osa1 has joined #zig
marnix has quit [Read error: Connection reset by peer]
<dominikh> are there any plans for Zig getting multiple return values?
marnix has joined #zig
<ifreund> i think better support for tuples would solve that use case
<dominikh> true
<dominikh> well, you'd probably also want destructuring assignment
osa1_ has joined #zig
marnix has quit [Read error: Connection reset by peer]
osa1 has quit [Quit: osa1]
marnix has joined #zig
<ifreund> yeah, I don't think that's likely to get accepted though tbh
<ifreund> there's discussion of this in some github issue, let me see if I can find it
<dominikh> then I'm not sure how better tuple support helps. I don't want to access the return values by index :/
<dominikh> at that point, returning structs would be superior
<ifreund> true
osa1_ is now known as osa1
<dominikh> zls question: I can't goto definition on any identifiers that are defined in another package. is that supposed to work?
<ifreund> dominikh: proposal for destructed assignment is still open: #3897
<dominikh> thanks!
<ifreund> dominikh: it should work if zls manages to read your build.zig and find the package
<dominikh> ifreund: hm, weird. my build.zig is pretty similar to yours; dependencies stuffed into a deps/ directory. and building obviously works, so the build.zig should be fine :D
HugoDan has quit [Ping timeout: 246 seconds]
<ifreund> I think it was working for me on my zig-wlroots branch of river, let me check
<Nypsie[m]> Works here as well. Do you see the build_runner.zig file pop in your directory quickly when zls is launched?
<dominikh> I do
<Nypsie[m]> Are you sure `zls.json` points to the right directories etc?
HugoDan has joined #zig
riba has joined #zig
<dominikh> not entirely? I only have a global zls.json, and the only thing that is pointed to is the zig lib path
<Nypsie[m]> I think that is fine, as it will use `PATH` to find the Zig executable
<Nypsie[m]> Hmmm
<dominikh> going to definitions of code in the same package is working just fine, FWIW
<dominikh> let me see if enabling debug output in zls yields anything of use
<Nypsie[m]> Btw, what editor? I had the same issue before in vscode, but that was me not having zls.json configured correctly
<dominikh> Emacs
HugoDan has quit [Ping timeout: 256 seconds]
<Nypsie[m]> Aaaah I see. I have no experience with that unfortunately.
HugoDan has joined #zig
Stephie has quit [Read error: Connection reset by peer]
<ifreund> dominikh: oh shit, destructuring is already accepted for tuples, see #498
riba has quit [Ping timeout: 260 seconds]
Stephanie has joined #zig
<dominikh> sweet
<kristoff_it> The preshow is live, Zig SHOWTIME starts in 20 mins! https://twitch.tv/kristoff_it
gpanders has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
radgeRayden has quit [Ping timeout: 264 seconds]
cole-h has joined #zig
crimson_penguin has quit [Ping timeout: 256 seconds]
crimson_penguin has joined #zig
aerona has joined #zig
skuzzymiglet has joined #zig
xackus has quit [Ping timeout: 265 seconds]
a_chou has joined #zig
<mla> im trying to figure out a hashmap with O(1) for lookup time that does no allocations; essentially what i want is something that allocates a large chunk of memory upfront and doesnt do any of this tombstone / management / other stuff
<mla> im working in realtime audio and initial tests with HashMap in std lib wernt great
<mla> does anyone know of something off the shelf / in std lib which might make sense for this?
<mla> lookups speed basically need to be as fast as array access of an element like mapvals[hashkey]
<mla> dunno maybe this is what ArrayHashMap does and im using it wrong
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Nypsie[m]> If the size is known you can use something like `initCapacity`. ArrayHashMap is backed by an array so if you do a lot of iterations over the hashmap, that could be faster for you.
<Nypsie[m]> `initCapacity` allocates all the memory needed for the given length, and then you can use `putAssumeCapacity` to insert elements without having to allocate. If the key is a string you can also look at `std.ComptimeStringMap`. If not, I believe there's a library around that does the same but for non-string keys.
TheLemonMan has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
<TheLemonMan> yo andrewrk, was @export what you had in mind? last time we talked about that was a while ago in #3971
<mla> Nypsie[m]: intersting, thanks hadnt realized about capacity, ill give it a try; i can assume a large chunk of capacity upfront i believe, biased toward loading lots into memory and having fewer cpu cycles
<andrewrk> TheLemonMan, you mean @extern? or changing topics to @export?
<TheLemonMan> @extern of course
<andrewrk> yeah the only problems with it as I see it are that it wouldn't work at a global scope (unless I read the implementation wrong)
<TheLemonMan> hm? why not?
wootehfoot has joined #zig
<andrewrk> TheLemonMan, the render* functions in codegen.cpp don't get run at compile time
<andrewrk> let me play with it
gpanders has quit [Ping timeout: 240 seconds]
<TheLemonMan> the only problem I see is that sometimes the compiler gets confused by @extern var initializers when they are defined at top-level
hlolli_ has joined #zig
Ashpool has quit [Read error: Connection reset by peer]
<andrewrk> TheLemonMan, here's my example code: https://clbin.com/RxLXI
<andrewrk> it gives me an error: cannot store runtime value in compile time variable at the @extern
gpanders has joined #zig
<andrewrk> it compiles fine if I move it into the function body
<TheLemonMan> yeah, no idea what's setting the variables to be ConstPtrMutComptimeVar
<andrewrk> well to make that work I think we would have to create a ZigFn* and set up a ZigValue with x_ptr set to it
<andrewrk> in ir_analyze_instruction_extern
<andrewrk> which is more annoying to implement than the way you did it
<andrewrk> in stage2, we model Value pointers as referencing Decls
<andrewrk> but the concept of anonymous Decls is more gracefully handled
<TheLemonMan> hmm, I wonder why it's only fucked up for global variables
<andrewrk> I should start the LLVM IR backend to motivate you to start caring about stage2 :)
msingle has joined #zig
<andrewrk> ir_render_extern is only called for function bodies
<TheLemonMan> :O
<TheLemonMan> that's really a whacky design choice heh
<andrewrk> why's that? there's plenty of stuff that only makes sense at runtime
<andrewrk> you're supposed to do that logic in ir_analyze_instruction_extern if you want to do it at comptime
<TheLemonMan> extern is not doing much at comptime, no? it acts as a variable declaration and weak symbols at comptime don't make much sense
<TheLemonMan> the ir_analyze part is creating a faux value that other IR can use, that should be enough to pull in the extern symbol iff it's used
<andrewrk> from stage1's perspective, the comptime thing that extern is doing is creating the LLVM IR global for the extern
<andrewrk> consider what happens if you take a pointer to a global extern
<andrewrk> that's a ZigValue with special == ConstValSpecialStatic, x_ptr set to the ZigFn* for the extern
<TheLemonMan> yeah, my idea was to model this with a ZigValue with special = ConstValSpecialRuntime so that the compiler considers it as completely opaque
<andrewrk> right. which is useful since it does unblock the project that I was working on, but to be more correct it would have to match the other code for how taking pointers to global variables works
<andrewrk> that's why we have to not only check if something is ConstValSpecialStatic but if it's a pointer, you also have to care about whether the pointer addressee is comptime or not
<andrewrk> because we have the concept that "this value is comptime known to point to that global variable" while the global variable's value is runtime known
msingle has quit [Ping timeout: 256 seconds]
<TheLemonMan> alright, that makese sense, I completely forgot the extra indirection layer
<TheLemonMan> what are you working on? I'm extremely curious
<TheLemonMan> especially since you mentioned the PIE PR
jjido has joined #zig
<andrewrk> the goal is to make a static linux executable that can open a window and do 3d graphics using vulkan/opengl - one that works on all distributions
<andrewrk> check out that code sample again: https://clbin.com/RxLXI
<andrewrk> right now (testing on nixos) it gets to the execve, and then I get a crash in glibc, I'm guessing which is due to the exe not being PIE
<andrewrk> oops, sent you the sample of it not working. here's the working one: https://clbin.com/DOUze
<andrewrk> so the idea here is to be able to distribute a game that runs on any linux as a simple binary tarball
<TheLemonMan> oh that's interesting, I wonder if it'll work
<andrewrk> I think it will! marler8997 did a PoC for using execve with a runtime-detected dynamic linker path and it worked with C code, so the next steps for zig are: (1) PIEs and then (2) detect wayland/x11/other and dlopen the appropriate .so
<marler8997> yup, got a PoC working to make sure it would work
hnOsmium0001 has joined #zig
HugoDan has quit [Ping timeout: 265 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<TheLemonMan> well the PIE part should be easy, the old PR only needs a few touch ups
<andrewrk> sweet
<TheLemonMan> it was not working on mips and some recently supported arches such as ppc64 and sparcv9
<TheLemonMan> but nobody cares about them so :shrug
dumenci has quit [Ping timeout: 240 seconds]
<andrewrk> marler8997, are you around to brainstorm some stuff?
<marler8997> sure
<andrewrk> ok so the goal is to use dlopen to call XInitThreads. Solving it on nixos first since that's where you and I both are
<marler8997> so, find so, dlopen, dlsym
<andrewrk> it's in Xlib.so. so the question is, how do we figure out which Xlib.so to open?
<marler8997> this is where I always go to find the loader logic to find so's: https://man7.org/linux/man-pages/man8/ld.so.8.html
<marler8997> but
<andrewrk> our trick to find the native dynamic linker is to look at the interp section of /usr/bin/env
<marler8997> that's what dlopen will do
<marler8997> wait, finding Xlib.so and the loader are 2 different problems
<marler8997> which one are we on?
<andrewrk> but /usr/bin/ has no graphical applications guaranteed to be there that we could use to figure out where Xlib.so is
<marler8997> you call dlopen first, if that fails, then you fall back to custom lookups
<marler8997> first, I think you would call dlopen with all possible names
<marler8997> dlopen will already check the ld.so.cache file, LD_LIBRARY_PATH, the elf runtime paths, letc
<marler8997> if you just pass it a name that is
<hlolli_> are there any builtin set types in zig? (with union/intersection/difference etc.)
<marler8997> custom lookups could be an optional addon if we don't think dlopen's logic doesn't handle all the cases, but I would first start with all the cases dlopen already supports
skuzzymiglet has quit [Ping timeout: 240 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
Jeanne-Kamikaze has joined #zig
<frmdstryr> Is there any way to lookup a field using a dotted name? Like `@field(obj, "one.two")`
<Nypsie[m]> I think `@field(obj, "one").two` will work
<frmdstryr> The field name is a string though... I can split it and use two @field calls, was wondering if there is anything in std.meta that does this
<Nypsie[m]> What do you mean with the field name is a string? You mean it's something like @"two" ?
<frmdstryr> Tring to build a template formatter so given a template and a context return the formated value.. ex "{{user.name}}"
<Nypsie[m]> Aaaaaaah gotcha
<Nypsie[m]> I think you'll have to handle this within your template parsing
<fengb> It doesn’t exist but you should be able to define one yourself
<fengb> Hmm... might be tricky due to returning a duck type >_>
<frmdstryr> I did something like this in python where it parsed the string into an ast tree then walked it, think that would work with zig?
<Nypsie[m]> I wouldn't see why not
jjido has joined #zig
<andrewrk> I think this is a smell
wootehfoot has joined #zig
msingle has joined #zig
<andrewrk> marler8997, ok so here's where I'm at: Xlib.so: cannot open shared object file: No such file or directory
<andrewrk> I'm typing this into a GUI IRC client, so it seems like there should be a way to figure out the RPATH of the currently executing graphical stuff
<andrewrk> for example, I'm not saying we should do this, but just to prove a point: if you looked at the running processes, noticed one was a known GUI application, then use that pid to find the exe location, then look at the ELF to find where Xlib.so is
msingle has quit [Ping timeout: 240 seconds]
Biolunar has quit [Quit: leaving]
msingle has joined #zig
CodeSpelunker has joined #zig
a_chou has quit [Quit: a_chou]
wootehfoot has quit [Read error: Connection reset by peer]
riba has joined #zig
Biolunar has joined #zig
msingle has quit [Ping timeout: 240 seconds]
crimson_penguin has quit [Ping timeout: 256 seconds]
crimson_penguin has joined #zig
<marler8997> andrewrk, that's an interesting idea
<marler8997> looking at /proc/*/maps could get you there
<marler8997> grep Xlib.so /proc/*/maps
<marler8997> this guy put together a nice on-liner to see all running so files on your system :) https://superuser.com/questions/310199/how-to-see-the-currently-loaded-shared-objects-in-linux
<marler8997> woops, I mean this: sudo grep -i \.so /proc/*/maps | awk '{print $6}' | sort | uniq
<earnestly> marler8997: (Be aware that hidepid exists on linux these days)
<marler8997> earnestly, haven't heard of that, does that just let you not list the pids from /proc?
<earnestly> (Also use of grep is unnecessary there: awk '/\.so/ {...}', but SO/SU is usually pretty bad at shell)
<earnestly> marler8997: First thing documented here: https://man7.org/linux/man-pages/man5/proc.5.html
<earnestly> It may not matter if you only care about the entries owned by the user, but it there it is
<marler8997> what's the full command without grep?
<earnestly> marler8997: the same, just with the pattern matching done in awk itself. Although also bear in mind that awk * or grep * is exposed to ARG_MAX limits
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<marler8997> I'm not seeing how to make the full, command, can you show me?
<earnestly> I did above?
<marler8997> does awk take filenames?
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<earnestly> Yeah
<marler8997> how do you limit it to the 6th column and filter by ".so" though?
<earnestly> I showed you
<marler8997> got it: sudo grep -i \.so /proc/*/maps | awk '{print $6}' | sort | uniq
<marler8997> woops
<marler8997> sudo awk '/\.so/ {print $6}' /proc/*/maps | sort | uniq
<marler8997> cool
<marler8997> I didn't know awk supported filtering like that
<earnestly> marler8997: sort has -u, which obviates the need for uniq
<earnestly> marler8997: awk is a pattern {action} language
<earnestly> Default action is to print the record
<marler8997> You can really get so much more done if you know your command-line tools well, always good to learn more
<marler8997> anyway, the point here is that's the only kernel mechanism I can think of to query what ".so" files are running in the system, /proc/*/maps
<marler8997> not sure if there are any others
<earnestly> marler8997: Also in the maps format the last column can be addressed via $NF instead of $6, if the intention is actually to extract the last column. If it doesn't matter that it's sorted you can do: sudo awk '/\.so/ {seen[$NF]++} END {for(lib in seen) print lib}' /proc/*/maps
<marler8997> *kernel interface (not kernel mechanism)
<marler8997> based on maps format, I belive $6 is what we want
<marler8997> its' an optional column, in which case you don't want to get the previous column
<marler8997> there's other edge cases to though
<earnestly> marler8997: In which case replace $NF with $6
jjido has joined #zig
<marler8997> dang you know your awk
<marler8997> do you find the time that you spent learning awk has helped your workflows alot? do you use it alot?
<earnestly> Yes, it's incredibly useful (as is jq)
<earnestly> But I try to only use it according to its strengths (like everything)
<marler8997> which are?
<earnestly> formats which are conducive to interrogation based on well defined regions and patterns. You wouldn't really want to use it on something like HTML/XML
cren has joined #zig
<earnestly> (You could, but it would become bothersome)
<earnestly> marler8997: (In the above case I'd probably stick with sort -u instead of using the inherent properties of hash tables. It's clearer and less surprising)
<marler8997> earnestly, you're saying "sort -u" is different than "sort | uniq"?
<earnestly> marler8997: It's the same
<earnestly> (Except one less subshell and process)
<marler8997> huh?
<marler8997> "stick with sort -u instead of using inherent properties of hash tables"/
<earnestly> marler8997: Instead of using the seen[] trick
<marler8997> oh!
frmdstryr has quit [Ping timeout: 260 seconds]
<marler8997> yeah I don't understand awk enough to understand your awk example :)
frmdstryr has joined #zig
<marler8997> actually, now that I've looked at it again I see...seen is a hash table, END means that block of code runs for all lines then once it's done, you loop over your hash table and print the entries
<marler8997> wow awk is crazy
<earnestly> The END block is run once all lines (records don't have to be a 'line') have been seen (there's also a BEGIN block)
<marler8997> Oh, so the END is just labeling the last block of code as "run me at the end"
<earnestly> Yeah, it's where perl inherited it from
<marler8997> wait, are END and BEGIN patterns? So it's just awk 'pattern block pattern block pattern block..."?
frmdstryr has quit [Ping timeout: 272 seconds]
frmdstryr has joined #zig
<earnestly> They reserved
<earnestly> They're*
<earnestly> marler8997: Brain Kernighan (the K in awk) did a talk on it which can be found on youtube if you want
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<frmdstryr> Can this work somehow? https://zig.godbolt.org/z/7dcbKc
<frmdstryr> Not sure why it doesn't just copy i into offset then compare at runtime
lltt has joined #zig
<marler8997> inline for([_]u32{0, 1, 2}) |x| {
<marler8997> var i = x;
<frmdstryr> I want to keep every branch there
<marler8997> {0, 1, 2, 3, ...}
<marler8997> you gonna make me type all 9 digits :)
<frmdstryr> yes :) haha
<marler8997> lol
<frmdstryr> oh so if the var is above the inline for it works
<marler8997> yeah
<marler8997> could also do this: inline for ("\x00\x01\x02...") |x| {
<novaskell> `inline while` ?
<frmdstryr> It needs all the branches but should just be able to jump directly to the index on the second run if that makes sense
<frmdstryr> anyways using var works so thanks
jjido has joined #zig
marnix has quit [Ping timeout: 260 seconds]
<torque> you can do inline for ("0123...") |c| { var offset = c - '0'; ...} also, I believe
<torque> doesn't work too well if you ever want double digit numbers, tough
<torque> though
earnestly has left #zig ["WeeChat 3.0-dev"]
cren has quit [Quit: cren]
riba has quit [Ping timeout: 240 seconds]
<andrewrk> marler8997, we could detect the various window managers. For example on my system xfdesktop is running, and it maps in libGL.so.1
<andrewrk> bingo
<andrewrk> not sure how to do it for vulkan yet...
<andrewrk> what window manager are you using?
<dominikh> note that for X11, many window managers will have absolutely no need for OpenGL or Vulkan
<andrewrk> hmm that is indeed a problem. although I think on such systems they might have a more standard file system hierarchy to find the drivers
<dominikh> you can run cwm on NixOS ;)
<shakesoda> andrewrk: the pre-glvnd libgl?
<andrewrk> dominikh, in this case what would be the best way to find the vulkan driver?
<shakesoda> i remember something to the effect of libOpenGL being preferred now and libGL being a compat shim
<shakesoda> might be misremembering
<shakesoda> this might be irrelevant, i don't have full context
<andrewrk> shakesoda, either way, the strategy does find opengl, because it gives us the path to the directory that has all the files from libglvnd
<dominikh> I have no idea :( I can only tell you that on X11, the window manager's primary task really is just to manage windows, it doesn't have to do any rendering on its own by default. complex ones may do rendering, many won't.
<shakesoda> on another note: i have a program here that crashes zig 0.7 trying to compile it (works with 0.6)
<shakesoda> haven't yet tried to reduce it
<andrewrk> there is still time to get it into the 0.7.1 milestone
<shakesoda> it might be reproducible with zig-vulkan-triangle
<shakesoda> hmmm, you updated that two days ago, so probably not
<andrewrk> dominikh, worst case scenario, we could detect nixos, and run `nix-shell -p vulkan-loader --run path/to/an_exe_that_prints_NIX_LDFLAGS`
frmdstryr has quit [Ping timeout: 272 seconds]
xackus has joined #zig
jjido has quit [Quit: Textual IRC Client: www.textualapp.com]
<dominikh> andrewrk: does /run/opengl-driver/ help?
<andrewrk> what does yours have? mine has these: https://clbin.com/eGf1N
<andrewrk> I'll test if opening libvulkan_intel.so will accomplish the goal
<andrewrk> hm well first I need to get a window open
<dominikh> stracing vkcube, it opens both libvulkan_intel and libvulkan_radeon here. there's probably some system to that
<marler8997> andrewrk, I actually run headless, everything goes through a remote X server
<andrewrk> you don't play video games that way do you?
<marler8997> just doom :)
<marler8997> but no
<dominikh> andrewrk: fwiw, you're sort of trying to do the work of the vulkan loader here (finding the correct driver to load for a given device), but the loader does other work, too, such as loading validation layers. so loading a driver itself is probably not the best approach in the long run.
<andrewrk> yeah that's exactly right
<andrewrk> I wonder if the loader supports being compiled statically
GuerrillaMonkey has joined #zig
<marler8997> like, including loader into a static executable?
<andrewrk> yeah
<marler8997> wait, are you talking about elf loader or this vulkan loader thing?
<dominikh> as for how the loader actually finds /run/opengl-driver/, the relevant nix packages patch RUNPATH (both for opengl and for vulkan)
<dominikh> (pkgs/build-support/add-opengl-runpath/setup-hook.sh)
Jeanne-Kamikaze has quit [Ping timeout: 246 seconds]
<dominikh> https://github.com/KhronosGroup/Vulkan-Loader/issues/343 – Re-enable static linking of Loader
<andrewrk> what is this @driverLink@/lib
<dominikh> see the .nix file in the same folder
GuerrillaMonkey has quit [Ping timeout: 265 seconds]
<andrewrk> AH
<andrewrk> I think vulkan-loader will work statically compiled
<dominikh> what I don't understand is what the benefit of a fully statically linked binary is when you just end up implementing your own dynamic loader of sorts? wouldn't it be easier to just try and find the system loader, then pass control to it?
<dominikh> I'm pretty sure you talked about that before
<dominikh> (the whole "look at /usr/bin/env to find the dynamic loader" thing)
<andrewrk> the benefit is giving users a tarball to download that works everywhere with no installation steps
<andrewrk> windows users already have this ability
<dominikh> right, but you could achieve the same with a basic loader that finds the actual loader, then uses that?
<andrewrk> what if there is no actual loader installed?
<marler8997> no loader *mind blown*
<dominikh> then people probably don't use that system to run opengl or vulkan :P
<marler8997> I suppose that is possible
<andrewrk> my system runs opengl and vulkan but there is no loader installed
<marler8997> I think it was pixelherodev who was talking to me about systems that are completely statically compiled
<dominikh> what system is that?
<andrewrk> I would have had to put "vulkan-loader" into the global set of packages to install
<andrewrk> nixos
<marler8997> nixos has loaders
<andrewrk> yes but they are opt-in
<marler8997> all loaders are opt in
<dominikh> so vkcube is statically linked?
iguessthislldo has joined #zig
<andrewrk> when you install vkcube through the nixos package manager, it brings in vulkan-loader: https://clbin.com/RODlA
<andrewrk> I'm talking about running a downloaded binary without using the system package manager
<dominikh> right, fair enough
<marler8997> the only potential issue I see is that I wonder if you could make a loader that would work on all distributions...
<marler8997> or at least...how complicated that loader would be, I'm sure it can be done
<dominikh> I'm not sure the comparison with Windows holds, though. most of that is dynamic loading and making darn sure your installer includes all its dependencies. a far cry from a single binary and not needing the loader
<marler8997> windows is just easy because all versions work the same, they all support CreateProcess and the os will handle loading
<marler8997> on linux it's implemented in userspace, which is the distro, so there are N versions
<marler8997> for most linux systems, finding the loader will be good enough, but if you want to support systems without a loader, I suppose you have to include a loader as well
<marler8997> no choice
skuzzymiglet has joined #zig
<marler8997> the nixos loader is 184K, so I suppose it's reasonable to assume the cost to BYOL (bring your own loader) is 184K of extra disk space per executable
skuzzymiglet has quit [Read error: No route to host]
skuzzymiglet has joined #zig
iguessthislldo has quit [Remote host closed the connection]
a92 has joined #zig
skuzzymiglet has quit [Read error: Connection reset by peer]
xackus has quit [Ping timeout: 272 seconds]
<pixelherodev> marler8997: assuming that's the smallest possible
kristoff_it has quit [Ping timeout: 256 seconds]
isolier has quit [Read error: Connection reset by peer]
isolier has joined #zig
<marler8997> pixelherodev, it was you talking about statically compiled distros right? what was the distros you mentioned?
skuzzymiglet has joined #zig
<andrewrk> marler8997, I have vulkan-loader compiled statically and it works
<andrewrk> it's just some copy+pasted files and 27 lines in the zig-window build.zig
<andrewrk> the only thing left before I have a working demo is to figure out the xcb API to open a window and activate the vulkan surface