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/
Ichorio has joined #zig
_whitelogger has joined #zig
mahmudov has quit [Ping timeout: 265 seconds]
_whitelogger has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
traviss has joined #zig
ltriant has joined #zig
<traviss> first time building zig on a couple days old debian install and i'm getting this: https://paste.debian.net/1111242/ . any ideas?
<traviss> stage 1 build with no errors
<wilsonk> traviss: hmm...that syntax for async is old. Looks like you need to pull the newest zig
<wilsonk> oops, wait that happens here also
<wilsonk> one sec
<traviss> i asked the same on discord zig and they responded that stage 2 is still experimental. my bad
<wilsonk> well, it is but I thought it was a little more up to date...that syntax was removed a couple months ago IIRC
<traviss> yeah, i was confused. i was thinking it was some c++ for a while after reading the error
Ichorio_ has joined #zig
muffindrake has quit [Ping timeout: 276 seconds]
muffindrake has joined #zig
Ichorio has quit [Ping timeout: 264 seconds]
muffindrake has quit [Ping timeout: 246 seconds]
muffindrake has joined #zig
chemist69 has quit [Ping timeout: 246 seconds]
chemist69 has joined #zig
plumm has joined #zig
<plumm> hey, does anyone know here how to read the LLVM module errors? having a hard time parsing this line: { %toml.Value, i16 }* call fastcc void @toml.Value.fromFloat(%toml.Value* sret %0, %std.builtin.StackTrace* %error_return_trace, %std.mem.Allocator* %10, %"[]u8"* %3), !dbg !3512
saskwach has quit [Remote host closed the connection]
<wilsonk> plumm: any more context...a trace perhaps via pastebin?
THFKA4 has quit [Ping timeout: 245 seconds]
<plumm> it seems to have something to do with switching on an enum type and returning something, unsure
<plumm> nevermind haha, was forgetting the return value was in a try chain. thanks1
<plumm> I figured this out by noticing that the return type did not have an error set but the llvm function definition seemed to want one
muffindrake has quit [Quit: muffindrake]
muffindrake has joined #zig
ltriant has quit [Quit: leaving]
LargeEpsilon has joined #zig
LargeEpsilon has quit [Ping timeout: 265 seconds]
NiCad has joined #zig
<NiCad> How well does zig work with a C++ api?
<NiCad> Checking out the eosio platform.
NiCad has quit [Quit: Leaving]
FireFox317 has joined #zig
FireFox317_ has joined #zig
<FireFox317_> plumm: I think you should create a github issue for that including a reduction of the code that was causing the problem, because the zig compiler is generating invalid LLVM ir, which is always a bug regardless of how a program is written.
gustav_o has joined #zig
<bgiannan> I found that, most of the time, i have llvm ir errors when i forgot a `try` somewhere
<FireFox317_> Jup, but we don't want any llvm ir error to show up to the user, because the backend is just an implementation detail. They should all be handled by the zig compiler itself.
<gustav_o> are we talking about the bug where zig doesn't enforce `try` on functions that return slices?
FireFox317_ has quit [Remote host closed the connection]
<FireFox317> gustav_o: That is probably another bug that shows some llvm ir errors? We were talking about any bug that shows up llvm ir errors, most of them occur when someone forgets a `try`
<gustav_o> mm
<gustav_o> I've encountered the following one: https://github.com/ziglang/zig/issues/3422
<FireFox317> Yeah also that one should be a compile error and not show the llvm ir error.
<FireFox317> Regarding std docs: the current scrolling behaviour is a bit weird, because when you scroll down to click on a namespace, i.e. click on 'io' then it won't scroll back up when showing the page regarding the 'io (Struct' information.
qazo has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
<daurnimator> Anyone have a look at my earlier paste?
FireFox317 has quit [Remote host closed the connection]
mahmudov has joined #zig
chemist69_ has joined #zig
chemist69 has quit [Ping timeout: 264 seconds]
LargeEpsilon has joined #zig
LargeEpsilon has quit [Ping timeout: 268 seconds]
LargeEpsilon has joined #zig
chemist69_ has quit [Ping timeout: 276 seconds]
chemist69 has joined #zig
LargeEpsilon has quit [Ping timeout: 265 seconds]
gustav_o has quit [Remote host closed the connection]
samtebbs has joined #zig
<samtebbs> Does anyone know if it's possible to stop Zig from generating i386 SSE code?
<samtebbs> I'm running into an invalid opcode exception in qemu when an SSE register is used
FireFox317 has joined #zig
<samtebbs> I would like to be able to pass -mno-sse to llvm but apparently the -mllvm argument to zig is "unsupported"
<samtebbs> FireFox317: thanks, but I have to ask why this was enabled by default on freestanding
<samtebbs> I don't want to have to use a fork of Zig just to build my kernel :p
<FireFox317> samtebbs: I have no idea xd
<samtebbs> Yeah something to ask andrew :p
noonien has joined #zig
<noonien> hello folks
<noonien> why does zig require linux 3.16+?
<noonien> i can't find anything in the documentation/release notes
<Snektron> I suspect maybe some kernel functionality?
<Snektron> Try it and see if it works
<noonien> well, hehe, that's obvious, but i'm trying to see what exactly
<noonien> as far as i can tell, there isn't anything specific in zig code
<noonien> perhaps some library, or it's just the version of the kernel that's being tested
FireFox317 has quit [Remote host closed the connection]
<noonien> ##rust
<noonien> ooops, sorry about that
<mq32> samtebbs, funny that three people ran into this problem in the last week ^^
<mq32> i have probably the same problem when using 64 bit values on i386
<samtebbs> mq32: I think it was caused by https://github.com/ziglang/zig/pull/3536
<samtebbs> WHich seems to be doing the exact opposite of what the commit message suggests
<samtebbs> I think it needs reverting tbh as it doesn't make sense
<mq32> samtebbs, i think it's correct. it removes "sse" from "pentium4" by prepending a "-" in front of the feature name
<samtebbs> mq32: Oh so the minus disables it. I read it as a command line argument which enables it.
<daurnimator> noonien: I think because 3.16 is the oldest kernel that even vaguely gets LTS support from anyone
<noonien> oh, i see
<samtebbs> That freestanding check doesn't seem to be working as I'm getting SSE code when building for freestanding
<samtebbs> Ok I could be wrong here, a full rebuild doesn't have the SSE code
<pixelherodev> Important note regarding freestanding; if you have any C source file, they need to be built with SSE explicitly disabled also.
<pixelherodev> The `-sse` for freestanding I added only applies when compiling ZIg code, not with `zig cc` (and AFAIK not with `build-obj --c-source` either)
<pixelherodev> Not sure if that's the issue you're running into, but it definitely trapped me up for a bit
<pixelherodev> s/trapped/tripped/
<tgschultz> zig worked on 2.6 at one time. At least, the zig static binary we distribute did.
samtebbs has quit [Ping timeout: 252 seconds]
LargeEpsilon has joined #zig
mahmudov has quit [Ping timeout: 240 seconds]
LargeEpsilon has quit [Ping timeout: 268 seconds]
cow-orker has joined #zig
waleee-cl has joined #zig
mahmudov has joined #zig
neceve has joined #zig
mahmudov has quit [Remote host closed the connection]
neceve has quit [Ping timeout: 240 seconds]
mahmudov has joined #zig
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #zig
neceve has joined #zig
LargeEpsilon has joined #zig
LargeEpsilon has quit [Ping timeout: 265 seconds]
johnLate_ is now known as johnLate
samtebbs has joined #zig
casaca has quit [Ping timeout: 245 seconds]
casaca has joined #zig
mahmudov has quit [Remote host closed the connection]
wootehfoot has joined #zig
samtebbs has quit [Ping timeout: 276 seconds]
FireFox317 has joined #zig
mahmudov has joined #zig
<nrdmn> andrewrk: are you coming to 36c3?
neceve has quit [Read error: Connection reset by peer]
dimenus has joined #zig
<emekankurumeh[m]> can anyone windows check if zig fmt is successfully converting CRLF to LF, or is it giving you an error?
riba has joined #zig
<FireFox317> as mikdusan also had some trouble with sse in his kernel, maybe its a good idea to completely dissable sse for freestanding? I think the current change that pixelherodev made is only valid for x86_64
<FireFox317> My bad, it was samtebbs
Akuli has joined #zig
<andrewrk> pixelherodev, never mind, I took care of it just now
<D3zmodos> emekankurumeh If I run `zig fmt --check` on hello world from the docs it passes without issue with LF but gives the following with CRLF:
<D3zmodos> `hello.zig:1:1: error: expected '}', found invalid bytes
<D3zmodos> const std = @import("std"); `
<D3zmodos> (using 0.5.0 and the current/2019-10-27 master build)
<D3zmodos> (checked by toggling between fileformat=unix & dos in vim)
kllr_sbstn has joined #zig
marijnfs has joined #zig
<mq32> okay, i got the weirdest bug right now. i have a CPU crash that fixes "itself" if i compile with release-fast instead of debug
<mikdusan> sounds like some ub
<mq32> yeah, kinda
<mq32> i can track that down to "i use 64 bit integers"
<mq32> as soon as i do that, it will crash
<mikdusan> do you have any use of `undefined`?
<mq32> yes, 4 times
<mq32> two of the values are initialized with inline assembler
<mq32> 1 is the kernel stack array which is "undefined"
<mq32> and the last one is my VGA pixel backbuffer
<mq32> all 4 are global variables and aren't used in this place
<mikdusan> just shooting from the hip, debug builds fill the variable with a canary byte value 0xa so if you see that anywhere...
<mikdusan> another big diff is debug builds have bounds checking on slices. so if you have ub slice storage i could see that being an issue
<mq32> nah, that shouldn't be the problem
<mq32> it doesn't panic in debug build, but actually triple-fault
<mq32> Terminal.println("fail = {}", u64(0));
<mq32> this is the culprit line
<mq32> with
<mq32> Terminal.println("fail = {}", u32(0));
<mq32> it will work
<mikdusan> try putting a 4-byte string literal there. then change it to 8-byte.
<mq32> hm
<mq32> it seems like i hit some *magic* value
<mq32> now i have commented some code and now it only works in debug build, but not with release-fast anymore O.o
<mq32> but i got to go, will be back later, investigating
riba has quit [Ping timeout: 240 seconds]
riba has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<nrdmn> I could *really* use closures now
FireFox317 has quit [Remote host closed the connection]
tyler569 has quit [Ping timeout: 264 seconds]
tyler569 has joined #zig
riba has quit [Ping timeout: 265 seconds]
Akuli has quit [Quit: Leaving]
tyler569 has quit [Ping timeout: 246 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
traviss has quit [Quit: Leaving]
jjido has joined #zig
donpdonp has quit [Quit: ZNC 1.7.1 - https://znc.in]
plumm has quit [Read error: Connection reset by peer]
samtebbs has joined #zig
donpdonp has joined #zig
<pixelherodev> andrewrk, thanks! Sorry I didn't get to that in time
ltriant has joined #zig
<andrewrk> that should solve the issue for C files
<pixelherodev> Yeah, I was just overriding it in my Makefile :P
<pixelherodev> ` build-obj --c-source -mno-sse` worked for me even before that, glad I can remove that flag though
LargeEpsilon has joined #zig
<lunamn> should awaiting a heap-allocated frame still cause the async fn recursion compile error?
LargeEpsilon has quit [Ping timeout: 276 seconds]
samtebbs has quit [Ping timeout: 268 seconds]
tyler569 has joined #zig
<andrewrk> lunamn, that error occurs when zig hits a dependency loop trying to determine if a function should be async. if this happens it makes the function non-async, but then if it later finds out it must be async, then it gives this compile error
<andrewrk> the logic behind this can be improved
<andrewrk> a workaround would be to put this in the function: if (std.io.mode == .evented) { _ = @frame(); }
<andrewrk> (before the recursive reference)
<lunamn> andrewrk: trying to put that workaround but failing with same errors, I'm assuming that would go before allocation of the frame?
<andrewrk> you need zig to figure out to make a function async before it references anything else that will eventually reference the original function
<lunamn> was a bit confused with that since there's only one recursive call but it happens on a different function, but regardless, it compiles
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<lunamn> and it works! hooray!
THFKA4 has joined #zig
donpdonp has left #zig ["WeeChat 2.6"]
stratact has quit [Remote host closed the connection]
<lunamn> andrewrk: it isn't the same as musl's system calls, but it is close, (snipped unecessary syscalls off the link) https://clbin.com/X3uuH
<daurnimator> lunamn:why the fstat?
<daurnimator> lunamn:also FWIW use sendmsg not connect+write
<lunamn> daurnimator: to read the entire file into memory, it isn't efficient and I keep a note to check it out later
<andrewrk> lunamn, nice
dimenus has quit [Read error: Connection reset by peer]
<lunamn> I'd do the same thing musl does, which is binding, but last time I tried binding on another project, I hit compile errors
<andrewrk> with evented I/O, the poll() will be replaced with integration with std.event.Loop.instance
<daurnimator> otherwise down the track socket-reuse becomes a mess: https://marc.info/?l=linux-netdev&m=148903250120465&w=2
<daurnimator> lunamn: ^
<daurnimator> lunamn: better to just have a page-sized buffer in memory and take multiple reads in the rare situation that /etc/resolv.conf is larger than 4096 bytes...
kllr_sbstn has quit [Remote host closed the connection]
<lunamn> daurnimator: I'll check both those things, thanks
<andrewrk> according to https://clbin.com/jmraX musl uses socket(), bind(), and then sendto()
Ichorio_ has quit [Ping timeout: 264 seconds]
<andrewrk> the connect() and getsockname() calls appear to be part of a RFC 3484/6724 destination address selection implementation
<daurnimator> lunamn: I haven't had a look at your code yet; but ideally it should be written in a way that works for both UDP and TCP; but also lets us swap in DNS-over-TLS and DNS-over-HTTP.
<andrewrk> which is skipped if there are only IPv4 results
marijnfs has quit [Quit: WeeChat 2.6]
<lunamn> getAddressList only worries about fds and poll(), the rest is in their own place, though I don't have any answer to selecting which one to do for a user of getAddressList
<daurnimator> As I mentioned the other day, "getAddressList" as a function is an anti-pattern
<daurnimator> You need to have `connectToHost("example.com", 443)` and it does dns lookups and connect() all in one.
traviss has joined #zig
<andrewrk> we'll get there