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/
ifreund has quit [Ping timeout: 246 seconds]
ur5us has quit [Ping timeout: 246 seconds]
ur5us has joined #zig
ur5us has quit [Quit: Leaving]
ur5us has joined #zig
ifreund has joined #zig
doublej472 has joined #zig
<Bekwnn> hmm, anyone have a good example of building a c program in build.zig?
<Bekwnn> currently just getting this mix of iob_func, cxa_guard_acquire, cxa_guard_release, and chkstk_ms being undefined https://i.imgur.com/S5upfwQ.png
<Bekwnn> (when trying to use the make file provided with cimgui)
ifreund has quit [Quit: WeeChat 2.7.1]
ifreund has joined #zig
<andrewrk> Bekwnn, does imgui depend on libc++?
mmx870 has quit [Quit: Ping timeout (120 seconds)]
<shakesoda> Bekwnn: you libc++abi
<shakesoda> * you need
mmx870 has joined #zig
<jwh> andrewrk: ah just saw your comment on issue 4682
<jwh> (zig assumes libstdc++)
<Bekwnn> hmm, I have mingw but I think it's having difficulty picking up the right files
<jwh> andrewrk: its abyss in this case (experimental)
<Bekwnn> I'll check build.zig mentioned in the issue, thanks
<andrewrk> jwh, what's the correct way to link against c++ on that system?
<jwh> -lc++ should be enough, clang is built with libc++ as stdlib also
<jwh> as the default rather
ifreund has quit [Ping timeout: 264 seconds]
<andrewrk> hmm, I'm not sure how zig can detect that it should do -lc++ rather than look for libstdc++.a
<andrewrk> I would have it try the latter and fall back to the former, but that is worse for the use case of e.g. fedora linux where the solution was to install libc++-static package
<jwh> hm
<jwh> does clang give any indication of what default it was built with
<andrewrk> I suppose this is the same problem as detecting the native libc abi
<jwh> yeah
<andrewrk> hmm not quite, because a non-native system compiler may have been chosen to build zig
<andrewrk> jwh, if you don't mind, what does this command do on your system? `c++ -print-file-name=libstdc++.a`
<andrewrk> where "c++" is whatever c++ compiler you use to build zig
<jwh> abyss-amd64 [~/m/devel/llvm]# clang++ -print-file-name=libstdc++.a
<jwh> libstdc++.a
<jwh> :(
<andrewrk> that's actually the "we don't have that file" output
<jwh> oh
<andrewrk> for comparison, you can try -print-file-name=crt1.o
<jwh> it should probably be clearer, or at least not exit with rc=0 heh
<andrewrk> yeah...
<andrewrk> if I send you a patch can you try it?
<jwh> sure
<andrewrk> it would be nice if there was a flag you could pass --tell-me-how-to-link-libc++
<jwh> yeah
<jwh> could you get away with just not passing anything?
<jwh> assuming clang++m that is
<andrewrk> jwh, https://clbin.com/dPHz2
<andrewrk> this is actually for zig's linker
<jwh> ahhh
<andrewrk> which is currently LLD
<andrewrk> but the point is that it doesn't have any system dependency or interaction (so that cross compiling works correctly) and so this build.zig code has to do the detection
<andrewrk> it's the correct place for it, since this is where there is an assumption that stage1 is building self-hosted for the native target, rather than in the linker itself
<jwh> looks good
<andrewrk> hmm building self-hosted is currently disabled though
<andrewrk> that's stage1, but stage2 is currently bit rotted, so this didn't actually test it for you. let me fiddle with it for a moment
<jwh> ah
<jwh> hm, I got libzigstage2.a and 'zig'
<andrewrk> that's the hybrid c++/zig stage1 compiler that we currently ship
<jwh> ah
programi1 has quit [Quit: WeeChat 1.4]
dingenskirchen1 has joined #zig
dingenskirchen has quit [Ping timeout: 240 seconds]
dingenskirchen1 is now known as dingenskirchen
<andrewrk> jwh, alright well I have some more serious work to do on the self hosted compiler before we can check ldd on it for you after building it successfully, but I believe the issue is fixed. let's revisit when self-hosted is resurrected
<pixelherodev> Is the behavior of `allocator.free((try allocator.alloc(T, 2))[1..])` defined or allocator-dependent?
<andrewrk> that's currently Illegal Behavior. the Allocator interface promises the implementation that the slice pointer and length will be tracked by the client
waleee-cl has quit [Quit: Connection closed for inactivity]
<jwh> andrewrk: cool ok
<jwh> thx
<Bekwnn> The output here gave me a chuckle https://i.imgur.com/FoJT6QZ.png
<Bekwnn> "???:?:?: 0x14000ffff in ??? (imgui_draw.obj)"
<pixelherodev> andrewrk, thanks!
<pixelherodev> I figured as much
<pixelherodev> but also didn't want to overlook an obvious solution
clarity_flowers has joined #zig
adamkowalski has joined #zig
ur5us has quit [Ping timeout: 246 seconds]
clarity_flowers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dddddd has quit [Ping timeout: 246 seconds]
adamkowalski has quit [Quit: Lost terminal]
Bekwnn has quit [Remote host closed the connection]
mahmudov has quit [Remote host closed the connection]
ur5us has joined #zig
tdog has joined #zig
ur5us has quit [Ping timeout: 246 seconds]
FireFox317 has joined #zig
marijnfs has joined #zig
dom96 has quit [*.net *.split]
betawaffle has quit [*.net *.split]
SimonN has quit [*.net *.split]
SimonN has joined #zig
dom96 has joined #zig
marijnfs has quit [Ping timeout: 250 seconds]
marijnfs has joined #zig
ifreund has joined #zig
FireFox317 has quit [Ping timeout: 264 seconds]
lunamn2 has quit [Ping timeout: 264 seconds]
ave_6 has quit [Ping timeout: 264 seconds]
daex has quit [Ping timeout: 246 seconds]
jmiven has quit [Quit: reboot]
jmiven has joined #zig
daex has joined #zig
betawaffle has joined #zig
zfoo has joined #zig
tgschultz has quit [Read error: Connection reset by peer]
tgschultz has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 264 seconds]
dddddd has joined #zig
marijnfs_ has joined #zig
marijnfs_ has quit [Read error: Connection reset by peer]
<mq32> i code C++ at work and i miss "defer" sooo much
<fengb> I’d miss my sanity :p
<mq32> ah, hey
<pixelherodev> I honestly don't hate C++ all that much
<mq32> i'm insane anyways
<mq32> :D
<pixelherodev> I loathe the stdlib though
<mq32> nah, modern C++ is quite fine
<pixelherodev> C++ itself is *bad*, but honestly it's not worse than most languages
<pixelherodev> Most languages suck in different ways
<pixelherodev> I think the problems with C++ are worse than the problems with a lot of other languages, but the advantages if used properly can be worth the trade ofof
<pixelherodev> s/ofof/off
<pixelherodev> I say that as someone who hasn't used C++ in at least a year and sticks to C/Zig whenever possible :P
<fengb> Have you seen other people’s code? >_>
<pixelherodev> ^
<pixelherodev> I like to think I can write decent C++
<pixelherodev> Having seen code written by others who think the same, I'm forced to doubt it
<mq32> pixelherodev: is this sane code?
<fengb> All languages have warts. The better ones make them not as apparent
<mq32> it even uses goto! *grin*
<fengb> C++ has warts in every damn feature
<fengb> Sure, but then someone else uses a different subset and this don’t work well
<diginet> C++ is unacceptably gigantic
<mq32> cpp would require a cleanup of "old features" like C casts
<mq32> but they don't want to break backwards compatibility
<mq32> which is a reasonable thing to do, but it makes newer projects carry old stuff
<mq32> something like "if you define THIS flag, all old stuff will be exlucded
<pixelherodev> ^ that would actually make me consider using it again
<pixelherodev> For some of my side projects anyways
<pixelherodev> Gotos ain't fundamentally bad
* mq32 tries to fuse future projects with C++ and Zig
<pixelherodev> Nothing is, and convincing people that they are causes problems
<mq32> pixelherodev: yeah, this is one of the use cases where i consider goto useful
<mq32> in zig we have named continue which would've solved the problem
<mq32> i still think about building a libc++ package for zig, so we can easily create crossplatform C++ projects with zig
<fengb> I used a goto to jump into a middle of a function. It was... kludgy but there’s no proper control flow for that
<fengb> I needed to skip half of the loop logic for the first iteration
<pixelherodev> The only times I've needed that, I've had access to an arraylist I could use as an effective counter
<pixelherodev> So I could just do `if (list.len == 0)`
<pixelherodev> Or `!= 0`, in this case
waleee-cl has joined #zig
<fengb> Well sure... but I didn't want the logic in my loop body. I also didn't actually analyze the asm output to see what came out >_>
jjido has joined #zig
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #zig
<diginet> fengb: multi-entry is a common pattern in asm and I've often thought about how you could support that in a structured way
<diginet> I mean in some sense definitionally that's impossible
<diginet> but in the looser sense I think it could work
pmwhite has quit [Ping timeout: 245 seconds]
dtz has quit [Ping timeout: 245 seconds]
pmwhite has joined #zig
dtz has joined #zig
_whitelogger has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheLemonMan has joined #zig
<pixelherodev> Got Zig compiling :D
<pixelherodev> (My backend works!)
<mq32> using CRT, huh? :D
* pixelherodev sighs
<pixelherodev> yeah
<pixelherodev> Not finished yet, and there's ~40 `error.unimplemented`s, along with one or two dozen TODOs
<pixelherodev> But it freaking works!
<mq32> hehe
<mq32> what does it do exactly?
<pixelherodev> It integrates with build.zig at present
<pixelherodev> Uses zig to emit LLVM IR
<pixelherodev> Then it runs on that IR and produces asm
<pixelherodev> best part is, it's written in Zig
<pixelherodev> It can lex its own IR, but not parse it (yet), as i'm using an iterative development methodology
<pixelherodev> Basically, I implement a half-functioning piece
<pixelherodev> Then implement the pieces that need it
<pixelherodev> Then improve them one at a time
<mq32> sounds cool
<pixelherodev> It's not a good style, but the 40 unimplementeds show why i'm doing it
<mq32> target platform is x86/64?
<pixelherodev> If each of those would take five minutes, that's >3 hours
<pixelherodev> Not yet
<pixelherodev> That's a future backend
<mq32> i think iterative development is the only way of doing stuff like this
<pixelherodev> For now, it's a custom 32-bit ISA
<mq32> ah!
<pixelherodev> Next up is z80
<pixelherodev> Then x86
<pixelherodev> I also plan on eventually adding a QBE frontend
<pixelherodev> That would allow bootstrapping `cproc` to the target
<pixelherodev> Even better would be if I can integrate cproc + QBE with my x86 kernel
<pixelherodev> and have a compiler baked into the OS
<pixelherodev> Which would allow for all sorts of neat tricks
<pixelherodev> IR as the binary form, JIT'd into executables, and optimized for the exact CPU being run
<pixelherodev> Heck, would be cool to have most of the kernel run like that :D
<mq32> hrhr
<pixelherodev> But while each component is simple, the whole is much more complex
<pixelherodev> So that's probably months off, minimum
<mq32> would be generally a cool concept to have a kernel JITing LLVM IR executables
<mq32> so you compile to LLVM ir
<pixelherodev> Also speeds up compile times (technically)
<mq32> and you can run the same executables with a AoT-cache on any platform
<pixelherodev> That's basically what WASM is meant to be, isn't it?
<pixelherodev> Just with a different "IR?"
<mq32> kinda
<mq32> but right now i think nobody AoT-Compiles WASM
<pixelherodev> Huh, this also enables *massive* security benefits
<pixelherodev> As in, strong enough to allow disabling nearly all modern hardware security features
<pixelherodev> You can examine the IR ahead of time and scan for threats
<mq32> yep
<mq32> i'd like to see such OS
<pixelherodev> The only problem would be e.g. running another VM
<pixelherodev> But that's not *impossible*, just painful
<mq32> maybe i should hack together a PoC with wasm3 or something
<pixelherodev> Maybe detect common VM patterns and reject it at the OS level?
<pixelherodev> And then require a specific API?
<pixelherodev> That would be awful though...
<pixelherodev> The *only* security that would still be needed is the specex mitigations IIUC
<pixelherodev> and those wouldn't even be worth having because they're not good enough
<pixelherodev> Heck, it doesn't matter if a VM runs; all of the points of escaping the VM still only give you access to what the VM can do
<pixelherodev> If the only methods to, say, delete a file still require going through a "syscall" that's caught and requires explicit user approval, it doesn't really matter
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
<fengb> mq32: you should use wazm instead... if I get around to making it work
<mq32> do you have a link?
<mq32> ah wait :D
<mq32> now i understand *grin*
<Snektron> `const DAS_USABLE = 0x40000000;`
<Snektron> das not good
<TheLemonMan> andrewrk, can you check out #4747 when you have some time? that'd unbreak my zig build :\
<pmwhite> I bet nightly builds could be easily distributed through cachix.org
<andrewrk> TheLemonMan, sure thing
<andrewrk> TheLemonMan, btw I reverted a couple lines in 63a4dbc30d3ef3c7f8a8c6a2ba2087eaab8b830a before merging your PR for array abi size, let me know if that's a problem
mokafolio has quit [Quit: Bye Bye!]
<TheLemonMan> oh I wasn't so sure about that, my idea was to just consider the sentinel as an extra element (albeit having a fixed value depending on the type)
<pmwhite> Just tested uploading a build of a somewhat recent zig build - https://pmwhite.cachix.org/
<pmwhite> All someone would have to do is use `cachix use pmwhite`
<pmwhite> You would have to trust me though, so don't actually do that.
mokafolio has joined #zig
<fengb> Trust me™
<andrewrk> I think part of the benefit of hosting builds on ziglang.org is that people already have to trust the language author, so it does not represent additional trust
<andrewrk> TheLemonMan, oh, I called the wrong Dir function?? goodness, those names are super confusing
<andrewrk> that API is getting a breaking change pronto
<pmwhite> That doesn't work for Nix users. Admittedly, that's a small group. I actually forgot that master builds were already available.
<andrewrk> pmwhite, what doesn't work for nix users? I'm a nix user
<TheLemonMan> andrewrk, yep, I had to squint really hard to notice the missing O_PATH in the other version
<pmwhite> I would love to be corrected, because this has been a source of annoyance. As a NixOS user, I can't just download a tarball/binary and build/run it. I have to figure out how to make a Nix file to build it. So a Nix user doesn't get much use out of the releases page from ziglang.org.
<waleee-cl> pmwhite there's a zig in nixpkgs, I usually override the version to get a master build
<pmwhite> With cachix, you could make one at ziglang.cachix.org, and people could do `cachix use ziglang`. The tool signs stuff when you push it to cachix, so people still only need to trust andrewrk if he is the one that signed it.
<andrewrk> pmwhite, try it :)
<fengb> That sounds pretty cool actually
<andrewrk> I challenge you to find a linux distribution for which the ziglang.org tarballs do not work out of the box
<pmwhite> waleee-cl: I do the same thing, but that requires the minor inconvenience of building zig myself, which is bearable, I guess.
<pmwhite> okay, I'll try it...I bet you included a default.nix
daex has quit [Ping timeout: 264 seconds]
<andrewrk> idk what default.nix does
<andrewrk> it's just correct software that doesn't do unnecessary unportable things, so it works on nixos
<pmwhite> wait...i guess that makes sense. it's just that nothing else is like that, so I've assumed that isn't possible.
daex has joined #zig
<andrewrk> the only nixos-specific logic is in the "native system library detection" code, which respects the nix environment variables for where to find libraries
<andrewrk> that code is necessarily system-dependent
<andrewrk> and it's not activated for cross compiling
ifreund has quit [Ping timeout: 256 seconds]
<pmwhite> well waddya know...the binary just works.
<pmwhite> i guess dynamic linking is the main problem then.
<pmwhite> fyi, default.nix is a nix file that you could put in your project so that people can run `nix-build` to build your project in the same way that everything in nix is built. Sounds like it isn't necessary here.
<andrewrk> I do prefer the cross-platform solution when possible
marijnfs has quit [Ping timeout: 256 seconds]
mahmudov has joined #zig
slowtyper has joined #zig
frmdstryr has joined #zig
mahmudov has quit [Ping timeout: 250 seconds]
slowtyper has quit [Quit: WeeChat 2.7.1]
FireFox317 has joined #zig
slowtyper has joined #zig
ifreund has joined #zig
Akuli has joined #zig
frmdstryr has quit [Ping timeout: 250 seconds]
daex has quit [Ping timeout: 264 seconds]
daex has joined #zig
mahmudov has joined #zig
daex has quit [Ping timeout: 264 seconds]
marijnfs has joined #zig
FireFox317 has quit [Ping timeout: 250 seconds]
daex has joined #zig
daex_ has joined #zig
daex has quit [Ping timeout: 246 seconds]
daex_ has quit [Ping timeout: 250 seconds]
clarity_flowers has joined #zig
daex has joined #zig
ur5us has joined #zig
daex has quit [Ping timeout: 256 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
daex has joined #zig
daex has quit [Ping timeout: 250 seconds]
FireFox317 has joined #zig
daex has joined #zig
lunamn has joined #zig
lunamn has quit [Client Quit]
lunamn has joined #zig
blackbeard420 has quit [Quit: ZNC 1.7.5 - https://znc.in]
blackbeard420 has joined #zig
tdog has quit [Ping timeout: 246 seconds]
daex has quit [Ping timeout: 264 seconds]
FireFox317 has quit [Ping timeout: 246 seconds]
daex has joined #zig
Akuli has quit [Quit: Leaving]
daex has quit [Ping timeout: 250 seconds]
daex has joined #zig
daex has quit [Ping timeout: 250 seconds]
daex has joined #zig
daex has quit [Ping timeout: 256 seconds]
daex has joined #zig
daex has quit [Ping timeout: 246 seconds]
daex has joined #zig
mahmudov has quit [Ping timeout: 264 seconds]
mahmudov has joined #zig
daex has quit [Ping timeout: 250 seconds]
daex has joined #zig
marijnfs has quit [Ping timeout: 250 seconds]
daex has quit [Ping timeout: 256 seconds]
daex has joined #zig
frmdstryr has joined #zig
daex has quit [Ping timeout: 250 seconds]
daex has joined #zig
daex has quit [Ping timeout: 264 seconds]
daex has joined #zig
daex has quit [Ping timeout: 250 seconds]
daex has joined #zig
daex has quit [Read error: Connection reset by peer]
<andrewrk> I have the behavior tests passing for #4752 (slicing with comptime start&end results in a pointer-to-array)
<andrewrk> a few std lib compile errors to look into next
<andrewrk> this will probably be the last big language-breaking change before 0.6.0
daex has joined #zig
<daurnimator> andrewrk: breaks just before a release are good
<daurnimator> though...... introducing new bugs is not
daex has quit [Ping timeout: 250 seconds]
<andrewrk> there is still 1 month for bug fixes
<ifreund> pretty exciting
_Vi has quit [Ping timeout: 246 seconds]
clarity_flowers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]