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/
Mulugruntz has joined #zig
plumm has joined #zig
<plumm> mikdusan, have you tried compiling zig on Big Sur yet? A couple of users have reported that the dylib changes break the build. I've fixed it by trying to not add the linked libraries to the cache hash for the compiler id (because it uses _dyld_image_count, and the linked system libraries no longer exist on the file system); I'm not sure the
<plumm> rationale behind that but it's gotten zig working on Big Su
<plumm> Big Sur*, someone is testing the same fix on Catalina
<plumm> andrewrk that change might not be all that needs to change, when running the zig compiler on Big Sur, lld complains about an unknown library for `-lSystem`
iii has quit [Quit: leaving]
ur5us has quit [Ping timeout: 260 seconds]
<mikdusan> plumm: haven't tried Big Sur yet. not sure I will prior to general release.
<plumm> mikdusan do you have any insight about the inclusion of `-lSystem`?
<plumm> I thought it was always linked by default
<mikdusan> I've only heard a few experiences here and there but nothing concrete.
<mikdusan> if I understand correctly, catalina being `10.15`, big sur will be `11.0` and that's the first bump in rev major. probe scripts fun time :)
<plumm> Big Sur will be 10.16 for intel, 11.0 for arm
<mikdusan> oh my
<leeward> It's OS XI now?
<plumm> `lj->args.append("-lSystem");` is what is causing problems, but removing it leads to a bunch of symbols being undefined in cache objects
<plumm> I guess for arm yeah
<fengb> macOS
<fengb> The X is dead :(
<leeward> It had a good run.
<mikdusan> plumm: curious, what does `otool -L /bin/ls` output for you?
<plumm> uh
<plumm> damn kiwichat
<plumm> "/usr/lib/libutil.dylib""/usr/lib/libncurses.5.4.dylib""/usr/lib/libSystem.B.dylib"
<mikdusan> this is on big sur?
ur5us has joined #zig
<plumm> yes
<plumm> but also calling stat on the libSystem there is no file found
<andrewrk> macos is asking for a lot of volunteer effort to be spent on supporting it, while being proprietary and pretty hostile to developers
<andrewrk> apple better watch its back
<mikdusan> and re: "lld" complaints, I have to guess, but smells like lld for llvm 11.x or somesuch will likely add support for big sur, and our 10.0 version is poo about it
<plumm> mikdusan considering CLT and Xcode ship with lld (llvm ig), is it possible to override the linker used?
<mikdusan> zig embeds the linker (I hope I am not misremembering). but you could eyeball zig's link command line, and try to substitute with Xcode 12 beta's lld manually.
<plumm> yeah im looking for where Xcode's lld is rn
<mikdusan> ie: get zig to show the full lld command line
<plumm> possible, trying now
epmills has joined #zig
<mikdusan> speaking of which, here's a good comparison to do; make a hello.c and `clang -### -o hello hello.c` on catalina, and repeat same on big sur and see if there are any special args during compile or link phases
<plumm> I don't have a Catalina install available to me right now, will ask someone
<plumm> wtf
<plumm> its definitely llvm10's lld, cause the included ld with Xcode uses -lSystem too
<mikdusan> and what are you seeing for zig's lld verbose usage (when it fails with -lSystem)
<mikdusan> ie: can you post command line
<plumm> apparently you can set the path to the linker, so that's good
<plumm> how do I view the verbose version?
<plumm> oh —verbose-link
<plumm> uh -lsystem should be there this is just the version of the compiler I built without it 1s
<plumm> I tried using the dynamic linker provided by Xcode but run into a missing __tlv_bootstrap
<mikdusan> what's the error you get for unmodified `zig build-exe hello.zig` on big sur?
<mikdusan> ah found #5715
<plumm> can't believe I just did all of that when it was there in the issue tracker
<plumm> big L
<mikdusan> plumm: try building a zig exe with `zig build-exe --cache off`
<mikdusan> (unmodified zig)
daurnimator has quit [Ping timeout: 260 seconds]
<plumm> missing lsystem
<plumm> oh
<plumm> run doesn't work, build-exe does
<plumm> (with the Xcode ld)
<mikdusan> also sanity check: does big sur still use case-insensitive filesystem?
<fengb> Probably
<plumm> that's dependent on the drive
<mikdusan> default apfs install
<plumm> should be sensitive?
<fengb> I tried formatting case sensitive once and broke a lot of things
<fengb> Userland is very insensitive
<plumm> its not sensitive by default
<mikdusan> ok
gazler has quit [Ping timeout: 240 seconds]
<mikdusan> I don't want to be predicting problems were there are none, but if system dylibs are no longer available via filesystem interface,
<mikdusan> custom macho code (ie. not using apple's dlopen/dlsym API) is a non-starter
<andrewrk> that's the same as status quo
<andrewrk> the std lib unconditionally relies on libc on macos
<mikdusan> presumably llvm/lld/10.x has macho stat/symbol code that doesn't use dlopen/dlsym ?
<andrewrk> during link time?
<mikdusan> yes link time
<andrewrk> there's no need to dlopen/dlsym at link time, just need to make a macho file that declaratively lists the dynamic libraries it wants
<andrewrk> we can even do this cross compiling no problem
<mikdusan> sure "undefs" linking against dylibs sounds plausible. but lld needs to find the library in a fs search path
<mikdusan> so until it learns that it needs to check for file exist via dlopen it will fail
gazler has joined #zig
<andrewrk> gotcha
<andrewrk> I think realistically the main thing we're going to want to dynamic link is libsystem which we should have a hard coded path to
<andrewrk> that, and frameworks. everything else should eventually be handled statically by the package manager
<andrewrk> so I don't think this changes much really. apart from making the cache id stop looking at those libs
<mikdusan> my understanding is beyond the zig caching issue:
daurnimator has joined #zig
<mikdusan> >> lld complains about an unknown library for `-lSystem`
<andrewrk> seems like a bug in lld which will be fixed before big sur comes out
waleee-cl has quit [Quit: Connection closed for inactivity]
<plumm> andrewrk makes sense
_Vi has quit [Ping timeout: 256 seconds]
_Vi has joined #zig
plumm has quit [Ping timeout: 245 seconds]
halbeno has quit [Quit: Leaving.]
halbeno has joined #zig
<pixelherodev> Never have I hated the internet more than I do right this second
<pixelherodev> QTWebEngine takes more time to build than LLVM, Clang, and GCC put together and *then* some
<pixelherodev> Probably more than all three put together times four
Mulugruntz has quit [Quit: ZZZzzz…]
dongcarl has quit [Read error: Connection reset by peer]
aerona has joined #zig
Mulugruntz has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
opDispatch has quit [Quit: Konversation terminated!]
epmills has quit [Remote host closed the connection]
<andrewrk> local variables working enough to test the register allocator: https://clbin.com/0FFW9
aerona has quit [Quit: Leaving]
_whitelogger has joined #zig
cole-h has quit [Quit: Goodbye]
craigo has quit [Ping timeout: 240 seconds]
lemmi has quit [Ping timeout: 240 seconds]
lemmi has joined #zig
data-man has joined #zig
<data-man> andrewrk Are the packed structs compatible with C's bit fields?
nmeum has quit [Remote host closed the connection]
nmeum has joined #zig
<andrewrk> I need to double check some things to give a confident answer, but I believe the answer is: zig's packed structs are more well defined, and they are compatible with most C implementations, which leave bit fields implementation defined
<data-man> So translate-c should translate bit-fields to packed structs? Ideally :)
<daurnimator> data-man: no!
<daurnimator> packed bitfields are quite different to extern bitfields
<data-man> So, what is the best way to translate C's bitfields to Zig?
marnix has joined #zig
<data-man> I need Linux perf API. Benchmarks and so on...
marnix has quit [Ping timeout: 240 seconds]
dermetfan has joined #zig
data-man has quit [Quit: Konversation terminated!]
owl_000 has joined #zig
<owl_000> const std = @import("std").debug.print;
<owl_000> here we declare a global constant named std, and then used @import buil in function (@ indicates it) to bring print function in our scope.
<owl_000> here std is collection of modules, debug is a module and print is a function of that module
<owl_000> am i right?
<owl_000> oh, and assign print function in std constant. the name of const can be anything. but the convention is using function name which is being assigned
<owl_000> so `const print = @import("std").debug.print;`
<andrewrk> data-man, yes, ideally :)
marnix has joined #zig
data-man has joined #zig
<data-man> But daurnimator said "no!" :)
owl_000 has quit [Quit: Leaving]
gazler has quit [Quit: Leaving]
data-man has quit [Quit: Konversation terminated!]
ifreund has quit [Read error: Connection reset by peer]
ifreund has joined #zig
ur5us has joined #zig
craigo has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
ducdetronquito has joined #zig
<ducdetronquito> Hello there !
<ducdetronquito> Noob question: I would like to run the unit tests in `std.http.headers`. How would you do that ?
<ducdetronquito> I tried to run `zig test lib/std/http/headers.zig`, but I end up with compilation warning with the relative imports :/
<ifreund> well, zig build test-std will run all the std tests
<ifreund> not sure how to run a specific one
data-man has joined #zig
<data-man> I always replace @import("../std.zig") to @import("std") in tests :)
data-man has quit [Client Quit]
<ducdetronquito> Thanks Ifreund and data-man, I will try both strategies ;) !
nycex has quit [Remote host closed the connection]
nycex has joined #zig
<ifreund> I think we should techkically be using @import("std"); everywhere in the std now
<ikskuh> ifreund: is there a reason to do so?
<ikskuh> i don't think that's a good idea
<ifreund> well, as demonstrated in this case it would make running indidual tests work
layneson has joined #zig
epmills has joined #zig
data-man has joined #zig
<data-man> rg --stats -F \"std\" 171 matches, rg --stats -F "std.zig" 263 matches
data-man has quit [Quit: Konversation terminated!]
layneson has quit [Ping timeout: 246 seconds]
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
marnix has quit [Ping timeout: 256 seconds]
layneson has joined #zig
marnix has joined #zig
marnix has quit [Client Quit]
epmills has quit [Remote host closed the connection]
layneson has quit [Ping timeout: 260 seconds]
dongcarl has joined #zig
dermetfan has quit [Ping timeout: 260 seconds]
waleee-cl has joined #zig
nikita` has joined #zig
dermetfan has joined #zig
craigo has quit [Ping timeout: 258 seconds]
haliucin1s has quit [Ping timeout: 256 seconds]
dch has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
blueberrypie has joined #zig
dch has joined #zig
Mulugruntz has quit [Ping timeout: 246 seconds]
cole-h has joined #zig
Mulugruntz has joined #zig
marnix has joined #zig
xackus has joined #zig
marnix has quit [Ping timeout: 256 seconds]
ducdetronquito has quit [Remote host closed the connection]
dermetfan has quit [Ping timeout: 260 seconds]
trilead has joined #zig
trilead has quit [Remote host closed the connection]
dermetfan has joined #zig
wootehfoot has joined #zig
FireFox317 has joined #zig
<FireFox317> hey andrewrk, i saw the register allocation demo you sent on irc yesterday, and i was wondering why the arguments of the function are defined as statements in the ZIR block. Was there some reasoning behind this?
marnix has joined #zig
<andrewrk> FireFox317, yes, the arguments need the same mechanism that all instructions have, with respect to being allocated somewhere (in a register or on the stack). giving them each an instruction line makes it possible to reference them and deal with them the same as other instructions
<FireFox317> Ah i see! Thanks :)
Mulugruntz has quit [Quit: ZZZzzz…]
haliucinas has joined #zig
<andrewrk> FireFox317, as an example, a parameter might be passed in as the %rdi register but then due to calling another function, %rdi has to be used as *that* function's parameter. but we still reference the original parameter later. so the value has to be "moved" from %rdi to somewhere else (probably the stack) so that it can be referenced later
<andrewrk> and now I suspect that is why the machine code instruction is called "move" even though it copies data
haliucinas has quit [Read error: Connection reset by peer]
haliucinas has joined #zig
haliucinas has quit [Read error: Connection reset by peer]
haliucinas has joined #zig
<pixelherodev> andrewrk: I mean, in most cases, you're overwriting or ignoring the old value afterwards, so yeah
<FireFox317> Interesting stuff for sure
<FireFox317> Funny that you discovered why the instruction is named mov :P
<andrewrk> I didn't used to be able to read assembly, but it's funny how generating machine code forces you to learn heh
<leeward> It really does.
<leeward> Oh, I don't know if I told you: The msp430 code to read-modify-write an IO register that Zig generates is more efficient than what GCC or LLVM generate.
<andrewrk> interesting, I wonder why, considering zig (stage1) uses LLVM
<scientes> leeward, IO register
<scientes> that means volatile
<scientes> so LLVM and GCC both are really careful
<leeward> memory mapped IO
<scientes> you could teach them to be better however
<scientes> yeah, well that is not what those compiler are designed for
<scientes> you are probably better just using inline assembly
<leeward> They both generate mov <mmio>, <reg>; op <reg>, <mmio>
<leeward> No, this is from Zig code doing |= on a volatile pointer.
procnto has quit [Ping timeout: 244 seconds]
<leeward> er, that second instruction was op <constant>, <reg>
<andrewrk> how can you do better than mov <mmio>, <reg>; op <reg>, <mmio> ? that seems ideal
<leeward> then another move
betawaffle has quit [Ping timeout: 244 seconds]
<leeward> I was looking at both at the same time. Zig does it in 1 instruction: bis <constant>, <addr>
<leeward> bis is msp430 for "or"
betawaffle has joined #zig
procnto has joined #zig
<leeward> I'll stop being obscure: "mov.b &addr, r15; bis.b #1, r15; mov.b r15, &addr" vs. "bis.b #1, &addr"
<leeward> Zig does the 3-instruction version with xor, though, which is interesting.
<leeward> To the same address, even.
<andrewrk> indeed
<leeward> I wonder if Zig's annotating the llvm IR in a way that C doesn't.
<leeward> The xor is also in a loop.
marnix has quit [Ping timeout: 246 seconds]
<leeward> Unfortunately, I can't get clang to emit something that links without modification. It's assuming all kinds of false things about my system and I haven't had time to dig into all of them yet.
marnix has joined #zig
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
marnix has quit [Ping timeout: 240 seconds]
FireFox317 has quit [Ping timeout: 264 seconds]
craigo has joined #zig
ur5us has joined #zig
geemili has joined #zig
geemili has left #zig [#zig]
<Sahnvour> andrewrk: do you have a precise idea of the hashmap benchmarks you want, or should I contribute the ones I ported from the C++ blogpost of Martin Ankerl ?
epmills has joined #zig
shrumo has joined #zig
<shrumo> hello, people. Just discovered zig and wanted to give it a test. Is there some general place where I can find code samples?
reductum has joined #zig
<ikskuh> hey shrumo
<ikskuh> read the stdlib, and search github for "zig" tag
<ifreund> shrumo: not sure what exactly you're looking for, there is a list of community projects on the wiki
<ikskuh> there are a lot of projects out there
<ifreund> there is also https://ziglearn.org/
<ikskuh> damn, ifreund :D
<ikskuh> too fast
layneson has joined #zig
<waleee-cl> oohh, it had an added chapter now (nr 3)
<shrumo> I'll check out the community projects, then. Cheers
<epmills> hey, all.
<epmills> i'm implementing format for a struct and wanted some advice on the specifier.
<epmills> if i have say a dozen formats, does it make more sense to (1) assign a rather non-mnemonic single character specifier or (2) use a multi-character more mnemonic one?
<epmills> a good example would be time formats, like RFC822, RFC1123, RFC1123Z, StampMilli, etc.
nikita` has quit [Quit: leaving]
<ifreund> I'd default to a multi-character, more informative specifier for custom types
<epmills> ifreund: is "RFC1123Z" too much? should i shorten to say "r1z" or similar? seems like a tough balance.
<ifreund> personally I'd go with the full shebang, it makes things immediately clear what is going on
layneson has quit [Ping timeout: 240 seconds]
<epmills> ifreund: cheers!
<leeward> There's a chapter 3?
<leeward> Ooh, zbs!
<leeward> Documentation on ZBS that exists! It's a miracle!
<leeward> I've been lazy about finishing 5800
<leeward> ifreund: Wow, that's way better than what existed when I first looked.
<leeward> I think it was just "here are 2 examples that use it. Go learn."
<ifreund> that's about what I remeber from when I got started
nycex has quit [Remote host closed the connection]
nycex has joined #zig
<ifreund> hmm, apparently river stopped building on freebsd :( https://github.com/ziglang/zig/issues/5892
<andrewrk> Sahnvour, any kind of coverage you want to add is welcome
wootehfoot has quit [Read error: Connection reset by peer]
reductum has quit [Quit: WeeChat 2.8]
<Sahnvour> okay I think I'll do that then
st4ll1 has quit [Ping timeout: 240 seconds]
<shrumo> I tried to be clever and not learn properly by reading the docs and jumping straigt into compiling examples and I found something awkward along my journey.
<shrumo> First I got this: expected type '*std.io.writer.Writer(std.fs.file.File,std.os.WriteError,std.fs.file.File.write)', found 'std.io.writer.Writer(std.fs.file.File,std.os.WriteError,std.fs.file.File.write)'
<shrumo> So I decided to pluck std.io.writer.Writer as the argument and I got this:
<shrumo> error: container 'std.io' has no member called 'writer'
<shrumo> fn mainInner(stderr: *std.io.writer.Writer) !void {
frmdstryr has quit [Ping timeout: 256 seconds]
<ifreund> shrumo: if you're using 0.6.0 writer is still called OutStream
<shrumo> (also, thanks to the person that did zang.vim, because it fixes errors by itself (automatically translated `var` to `anytype`))
<epmills> shrumo: yea, ran into that this week as well.
<shrumo> ifreund: thanks.
<ifreund> that would be zig fmt that fixed the error, which the vim plugin invokes
<ifreund> whenever breaking language changes are made and it is feasible to do so, zig fmt is taught how to update the syntax
knebulae has quit [Read error: Connection reset by peer]
<shrumo> cool stuff, thanks to zig fmt person as well then.
epmills has quit [Remote host closed the connection]
xackus has quit [Ping timeout: 246 seconds]
_Vi has quit [Ping timeout: 256 seconds]
reductum has joined #zig
knebulae has joined #zig
apeiro has joined #zig
dch has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
rooke has quit [Ping timeout: 264 seconds]
dermetfan has quit [Ping timeout: 260 seconds]
shrumo has left #zig [#zig]
rooke has joined #zig
blueberrypie has joined #zig
dch has joined #zig
reductum has quit [Quit: WeeChat 2.8]
layneson has joined #zig