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/
jsb has quit [Quit: .]
jsb has joined #zig
Bernstein has quit [Remote host closed the connection]
xackus_ has quit [Ping timeout: 252 seconds]
bitmapper has joined #zig
zenkuro has quit [Ping timeout: 240 seconds]
Poorchop has joined #zig
cr1901_modern has quit [Ping timeout: 245 seconds]
cr1901_modern has joined #zig
<cr1901_modern> Hmmm, a different/related question: If there a convention for how to write a build.zig for a library that depends on another library? lib.addPackage doesn't seem to be working for me
Guest91421 is now known as notzmv
<andrewrk> in what way is it not working?
<cr1901_modern> Given this build.zig I wrote, when I run "zig build" from the repo root, I get "cannot find zig-matrix".
<cr1901_modern> One thing I'm possibly doing wrong- addStaticLibrary might not be appropriate.
<andrewrk> you have your default step run your tests, and you don't map the package into your test artifact
<andrewrk> you probably want setBuildMode and addPackage on your test artifact too
<cr1901_modern> Okay, that solved my issue :)
<andrewrk> happy hacking :)
<cr1901_modern> >Zig supports arbitrary bit-width integers
<cr1901_modern> This makes things very interesting (in a good way)...
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
notzmv has quit [Ping timeout: 240 seconds]
cr1901_modern has left #zig [#zig]
SLWW has joined #zig
SLWW_ has quit [Ping timeout: 268 seconds]
earnestly has quit [Ping timeout: 240 seconds]
recalloc has joined #zig
notzmv has joined #zig
aigoo has quit [Read error: No route to host]
aigoo has joined #zig
klltkr has joined #zig
klltkr has quit [Client Quit]
nycex has quit [Remote host closed the connection]
nycex has joined #zig
dyeplexer has joined #zig
SLWW_ has joined #zig
SLWW has quit [Read error: Connection reset by peer]
bollu has joined #zig
<bollu> Hello :)
sord937 has joined #zig
ur5us__ has quit [Ping timeout: 250 seconds]
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
squeek502 has joined #zig
TheLemonMan has joined #zig
dyeplexer has quit [Ping timeout: 252 seconds]
dyeplexer has joined #zig
notzmv has quit [Ping timeout: 245 seconds]
pretty_dumm_guy has joined #zig
pretty_dumm_guy has quit [Client Quit]
dyeplexer has quit [Ping timeout: 268 seconds]
pretty_dumm_guy has joined #zig
haliucin1s has quit [Remote host closed the connection]
earnestly has joined #zig
haliucinas has joined #zig
wilsonk_ has joined #zig
cole-h has quit [Ping timeout: 245 seconds]
wilsonk__ has joined #zig
dyeplexer has joined #zig
wilsonk has quit [Ping timeout: 265 seconds]
wilsonk_ has quit [Ping timeout: 240 seconds]
Snektron has joined #zig
wilsonk_ has joined #zig
dyeplexer has quit [Ping timeout: 245 seconds]
wilsonk has joined #zig
wilsonk__ has quit [Ping timeout: 240 seconds]
wilsonk_ has quit [Ping timeout: 260 seconds]
dyeplexer has joined #zig
jzelinskie has quit [Read error: Connection reset by peer]
eddyb[legacy] has quit [Ping timeout: 246 seconds]
ovf has quit [Read error: Connection reset by peer]
Bernstein has joined #zig
jzelinskie has joined #zig
eddyb[legacy] has joined #zig
ovf has joined #zig
ur5us__ has joined #zig
notzmv has joined #zig
drp has quit [Ping timeout: 268 seconds]
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
SLWW has joined #zig
SLWW_ has quit [Ping timeout: 246 seconds]
mikdusan1 has quit [Remote host closed the connection]
leon-p has joined #zig
kwilczynski has joined #zig
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
ur5us__ has quit [Ping timeout: 250 seconds]
klltkr has joined #zig
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zenkuro has joined #zig
koakuma has joined #zig
SLWW_ has joined #zig
SLWW has quit [Ping timeout: 252 seconds]
mikdusan has joined #zig
koakuma has quit [Quit: Leaving.]
koakuma has joined #zig
<koakuma> TheLemonMan, I tried deleting all the cache folders but I'm still stuck at the same error (and generated file)
<koakuma> Any idea what's going on?
<koakuma> Also zig cc -E -dM -xc /dev/null gave me this: https://gist.github.com/koachan/8ebe2c5c1d37ea116b6d6ffeeed1f314
<TheLemonMan> hello koakuma, I've pushed a couple of PRs that need some testing on your sparc machine :)
<TheLemonMan> #8622 should solve the problem with the compiler not detecting the correct cpu
<TheLemonMan> the output of zig cc looks sane, clang is working as intended
<TheLemonMan> but none of those flags is being output by translate-c :\
<TheLemonMan> try nuking the cache in ~/.cache/zig and run `zig translate-c --verbose-cc ./test/stage1/behavior/translate_c_macros.h`
xackus_ has joined #zig
<koakuma> Also I'm pulling your code now, will test if it works
leon-p has quit [Quit: leaving]
leon-p has joined #zig
<TheLemonMan> it's somehow skipping every single macro, try applying this (untested) patch https://gist.github.com/LemonBoy/fb3d563428d175bcfc572c23fc9f81bb
betawaffle has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
fengb has joined #zig
plumm has quit [Quit: Textual IRC Client: www.textualapp.com]
plumm has joined #zig
klltkr has joined #zig
waleee-cl has joined #zig
<koakuma> TheLemonBoy, regarding your gist, I see an `iter 0 0` line before the Zig code, but nothing really changed
<TheLemonMan> great, time to check where the macros are getting lost then
cole-h has joined #zig
zenkuro has quit [Ping timeout: 246 seconds]
zenkuro has joined #zig
<TheLemonMan> koakuma, sorry about the missing parameter, I forgot to git add the modified file before pushing
<TheLemonMan> does it work once you add that back?
<TheLemonMan> the missing macro problem can be debugged if you have built LLVM with debug symbols
<TheLemonMan> because -detailed-preprocessing-record is being passed to clang but no detail is recorded
<ikskuh> TheLemonMan, andrewrk: curious question: i have potential access to a (bad) MIPS machine (my old router) and a pretty strong PowerMAC. would those be of use for zig dev?
<TheLemonMan> running every now and then the CI suite on the powermac would be helpful, I keep testing most of the non-x86 binaries using qemu
<ikskuh> yeah that's what i thought
<ikskuh> 1.5 Gigs are enough? /o\
<TheLemonMan> of ram?
<ikskuh> yeah
<ikskuh> it's not my machine, but belongs to a friend of mine
<ikskuh> cool thing is we could still do a multiboot with some BSDs and linux :)
<TheLemonMan> probably not :\ unless you chop the std test suite in smaller blocks
<ikskuh> hmm
<ikskuh> (wouldn't be a bad thing either, right?)
<TheLemonMan> nope, that'd also be useful to overcome the lld bug when linking huuge mips binaries
<ikskuh> and OOM in CI probably too?
<TheLemonMan> the CI has something like 6G of ram, we're running at nearly max capacity
<TheLemonMan> every now and then andrewrk prunes some tests to free some ram heh
<ikskuh> what is also *a bit* annoying is that the first failing test crashes the test runner
drp has joined #zig
<koakuma> I tried to build a debug version once, but the build process ate so much memory that half my processes died from the OOM-killer mess :(
<koakuma> Ah, sadly my LLVM builds are in release mode
<plumm> maybe invoking ub is a bad test harness issue
<koakuma> Also, TheLemonMan, with added `.sparcv9` parameter, it builds but it's still segfaulting for me
<TheLemonMan> segfaulting where?
<koakuma> When running a program compiled with it
<koakuma> The compiler correctly detected the CPU model as "&Target.sparc.cpu.niagara2", but the featureset is still empty
<koakuma> I'll post the full show-builtin dump in the PR comments
<TheLemonMan> ah good catch, I'm dumb and assumed the Feature api would pick that up
<TheLemonMan> gimme a few mins and I'll amend that PR
<koakuma> Ah okay
Akuli has joined #zig
ugla has joined #zig
<TheLemonMan> koakuma, done!
<koakuma> Okay, rebuilding!
<TheLemonMan> have you checked #8618? the missing flushw was causing the stack walker to crash and burn while trying to print a stack trace
<koakuma> Oh, will do after done with #8622
marijnfs has joined #zig
jmiven has quit [Quit: reboot]
jmiven has joined #zig
kiedtl has joined #zig
<kiedtl> how would I coerce the expression '[_]f64{ v1, v2, v3 }' to []const f64? Shouldn't this be coerced automatically?
<Nypsie> The address of an array will coerce to a slice, so: &[_]f64{v1, v2, v3}
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
jeang3nie has joined #zig
<kiedtl> For the statement 'var foo = 0.0;', what does the error 'variable of type 'comptime_float' must be const or comptime' mean? That the variable has to be const in order to be assigned a float literal?
<ikskuh> kiedtl: "0.0" has the type comptime_float
<ikskuh> which is a type of undefined size (it's only usable at comptime)
<ikskuh> and you cannot declare runtime variables of it
<ikskuh> so yeah, you either need a concrete type (f64) or a "comptime var" (which behaves like a runtime constant)
<kiedtl> Hm, so type annotations should be enough...?
<ikskuh> yep
<ikskuh> var foo: f64 = 0.0;
<kiedtl> huh, thanks
<recalloc> Hi, I'm wrapping a C library and I can't find any `c_float`. Should I use `f32` instead?
xackus_ has quit [Remote host closed the connection]
xackus_ has joined #zig
<marijnfs> cool, a new zig-showtime
<marijnfs> any suggestion whats the most interesting talk?
<andrewrk> f32 is guaranteed to be 32-bit floating point (23-bit mantissa) IEEE-754-2008 binary32
<recalloc> I see that, but I don't know whether C `float` is guaranteed to be 32-bit floats.
<kiedtl> I believe it is
<recalloc> @typeOf(someCFunc) shows that Zig translates it to `f32`, so I've been using it for now.
mikdusan has quit [Quit: WeeChat 3.0.1]
jeang3nie has quit [Quit: WeeChat 3.1]
<plumm> recalloc https://ziglearn.org/chapter-4/ this is also helpful
<kiedtl> Does zig still support compiling *.zig into .o files suitable for linking by a C compiler with other .o files generated from C code? I'm trying to do that right now with `zig build-obj` but gcc complains about missing __zig_probe_something and the zig.o file not being compiled with PIE
<recalloc> Looked at that before, searching for "float" shows no rsults
<recalloc> I suppose I could add a feature request to the docs appending floats to the type list.
nvmd has joined #zig
jeang3nie has joined #zig
<andrewrk> "float" appears many times on https://ziglang.org/documentation/master/ ?
<andrewrk> kiedtl, for the second problem, -fPIC
<andrewrk> kiedtl, for the first problem, there will be other ways to solve this but for now I suggest -fno-stack-check
<recalloc> Yeah, ziglean Chapter 4 shows no results for float, but the documentation does. I caught nothing about C floats in the master doc, though.
<recalloc> I think I'll go for what @TypeOf casts C's float into for now. Maybe C floats have a much more consistent width than C ints.
<andrewrk> they do
<kiedtl> andrewrk: Thanks, that fixes both error... except this one error that I didn't notice before: undefined reference to __muloti4
<ifreund> recalloc: I don't know of any target where C's float/double don't match zig's f32/f64
<andrewrk> recalloc, did you notice the "C Equivalent" table column?
<andrewrk> I tried to make this real obvious
<recalloc> andrewrk: yes, that table has no flaots
<andrewrk> ???
<recalloc> Unless I'm really blind
<recalloc> Ahhh okay!
<andrewrk> kiedtl, hmm ok so gcc's compiler-rt (aka libgcc) is missing __muloti4. I think that's actually a gcc bug. but can be worked around by additionally linking in the compiler-rt that zig provides
<recalloc> I'm blind then, my bad. It wasn't in Chapter 4 in the C primitive types table which I looked at most, but the master documetnation with all primitive types have it
<kiedtl> andrewrk: Hm. Thanks, I'll try that until I can rewrite the Makefile into a build.zig
<andrewrk> kiedtl, I think this issue will be the best solution: https://github.com/ziglang/zig/issues/7264 until then you'll need some kind of workaround
<kiedtl> Thanks, I see
<andrewrk> kiedtl, try this: stop passing -fno-stack-check and start passing -fcompiler-rt
<andrewrk> I also suggest build-lib rather than build-obj for this use case
dyeplexer has quit [Remote host closed the connection]
<kiedtl> andrewrk: yup, that works. Thanks again!
<andrewrk> np
<andrewrk> kiedtl, also to be clear you don't need #7264, you're using the intended best solution for the use case :)
<andrewrk> I forgot that it was already hooked up to work correctly for build-lib
<kiedtl> Ah, ok
jeang3nie has quit [Ping timeout: 240 seconds]
Stephanie is now known as Stephie
<kiedtl> What's the idiomatic way to compare two structs of the same type for equality?
<g-w1> deep equality?
<g-w1> /// Compares two of any type for equality. Containers are compared on a field-by-field basis, /// where possible. Pointers are not followed.
<g-w1> ^ std.meta.eql
<kiedtl> Oh, thanks, that'll be useful
<kiedtl> Eh, the fields are only integral, so shallow/deep is all the same to me
<g-w1> look at the impl, its pretty nice :)
* kiedtl looks at impl
<kiedtl> ...wow. What monster did I open
sord937 has quit [Quit: sord937]
<andrewrk> idk if I would call std.meta.eql "idiomatic"
<andrewrk> idiomatic is to define what equality means to your application and use that function
pretty_dumm_guy has joined #zig
ur5us__ has joined #zig
<g-w1> on this topic, would it be wise to make std.mem.eql or meta.eql use this heuristic too? https://github.com/ziglang/zig/issues/8625
<ikskuh> andrewrk: how do i specify the entry point of a zig program precisely? *thinking*
<andrewrk> ikskuh, export whatever entrypoint you want
<ikskuh> we want to build a package that provides a "generic" entry point
<ikskuh> and have the root file export "pub fn main()"
<ikskuh> will that conflict with std somehow?
<ikskuh> (on freestanding)
<andrewrk> g-w1, no, too fancy, let the applications do that logic instead of putting it in std lib. IMO std.meta.eql is already pushing it
<g-w1> ohh, but for testing you want good output, makes sense
<g-w1> like not "this is false", but actually showing the values
<andrewrk> ikskuh, you want a package that is an alternative to start.zig? that should already be possible, via `comptime { _ = @import("the-package"); }`
<ikskuh> hmm
<ikskuh> okay, so that is needed
<ikskuh> because this won't do the trick, right?
<andrewrk> you need global `comptime{ _ = micro; }`
<ikskuh> main() is not referenced nor exported, thus it isn't doing anyways
<andrewrk> consider if the application had a build flag to toggle between 2 competing micro packages
<andrewrk> comptime { _ = if (build_options.foo) @import("micro-zig") else @import("your-stinky-competitor") }
<ikskuh> that shouldn't be a problem, i mean "micro-zig" is specified on the command line anyways ;)
<ikskuh> but the question is: will that conflict with std?
<ikskuh> because std will be used as well
<ikskuh> and that also checks for main(), right?
<ikskuh> or only on non-freestanding targets?
teratorn has joined #zig
<g-w1> are you using build-exe ?
<ikskuh> g-w1: that doesn't matter :D "zig build" also just specifies the package on the CLI :D
<g-w1> i meant instead of build-lib or build-obj :P
<andrewrk> ikskuh, start.zig does nothing for freestanding, check the logic: https://github.com/ziglang/zig/blob/528a83dd6b0d73e450fca9594846fde233aa2e7a/lib/std/start.zig#L36-L66
<ikskuh> thanks!
<andrewrk> feel free to suggest modifications to this logic
<ikskuh> if we find something, we'll report :)
<ikskuh> oh and again: zig is awesome :D
<ikskuh> comptime and type manipulation is brilliant
<ikskuh> andrewrk: same question for the panic function. where does it get called? builtin.zig?
<andrewrk> yes
<andrewrk> so the use case is providing a default panic function, yes? that's something we might need to come up with an idea to solve
<ikskuh> yeah
<andrewrk> pub const panic = micro.panic;
<andrewrk> this is the null hypothesis
<g-w1> would that also reference micro? so you don't need comptime { _ = micro; }
<andrewrk> yes it would
<ikskuh> andrewrk: yeah
<ikskuh> was just asking where that reference comes from
<andrewrk> coincidentally, this is how stage1 internally creates a dependency on start.zig :)
<g-w1> using the panic?
<andrewrk> yes
<g-w1> oh, cool
<andrewrk> compilation kicks off with semantic analysis on `std.builtin.panic`
<ikskuh> :D
ifreund1 has joined #zig
ifreund has quit [Ping timeout: 260 seconds]
<recalloc> When wrapping a C function that writes to a *Type and returns a success code, is it idiomatic to wrap it into a fn(*Type) !void, or bring the Type out and make it a fn() !Type ?
<recalloc> I see the stdlib has idioms like DataType.init(...) !DataType, which makes me wonder whether my wrapper should take the extra step going there.
<ikskuh> recalloc: that depends on the semantics ;)
<recalloc> Here's my specific case: a C function int SDL_GetResource(int index, SDLResource *resource) that returns 0 on success, <0 on error.
ur5us__ has quit [Ping timeout: 245 seconds]
l1x has quit [Quit: Connection closed for inactivity]
<plumm> recalloc i just make a function that interprets the exit code as a zig error and wrap my calls with that
<recalloc> I see. I'll probably do that for now, thakns!
Akuli has quit [Quit: Leaving]
maximum_yellow has joined #zig
jeang3nie has joined #zig
maximum_yellow is now known as op_4
notzmv has quit [Ping timeout: 260 seconds]
<op_4> did ziglang.org drop linux-armv7a builds, or only for master?
SLWW has joined #zig
SLWW_ has quit [Ping timeout: 265 seconds]
mikdusan has joined #zig
<xackus_> op_4 I don't think there were ever master armv7a builds on the website
<op_4> xackus_: well that answers that, thanks
ifreund1 is now known as ifreund
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Bernstein has quit [Remote host closed the connection]
klltkr has joined #zig
klltkr has quit [Client Quit]
nvmd has quit [Quit: Later nerds.]
ifreund has quit [Quit: WeeChat 3.1]
ifreund has joined #zig
leon-p has quit [Quit: leaving]
xackus_ has quit [Read error: Connection reset by peer]
xackus has joined #zig
xackus_ has joined #zig
xackus has quit [Ping timeout: 265 seconds]
xackus__ has joined #zig
xackus_ has quit [Ping timeout: 265 seconds]
jeang3nie has quit [Ping timeout: 240 seconds]