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/
squeek502 has quit [Remote host closed the connection]
swills has joined #zig
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
xackus has joined #zig
utzig has quit [Read error: Connection reset by peer]
hnOsmium0001 has quit [Read error: Connection reset by peer]
eddyb[legacy] has quit [Ping timeout: 240 seconds]
hnOsmium0001 has joined #zig
utzig has joined #zig
eddyb[legacy] has joined #zig
xackus_ has joined #zig
xackus has quit [Ping timeout: 240 seconds]
dimenus has joined #zig
cole-h has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
earnestly has quit [Ping timeout: 272 seconds]
swills has quit [Ping timeout: 260 seconds]
Kingsquee has joined #zig
dimenus has quit [Quit: WeeChat 2.9]
swills has joined #zig
a92 has quit [Quit: Leaving]
klltkr has quit [Quit: Textual IRC Client: www.textualapp.com]
_whitelogger has joined #zig
Barabas has quit [Remote host closed the connection]
xackus has joined #zig
xackus_ has quit [Ping timeout: 268 seconds]
lucid_0x80 has joined #zig
x2C25 has quit [Ping timeout: 265 seconds]
x2C25 has joined #zig
lucid_0x80 has quit [Ping timeout: 240 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
cole-h has quit [Ping timeout: 264 seconds]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
osa1 has joined #zig
osa1 has quit [Client Quit]
osa1 has joined #zig
xackus has quit [Ping timeout: 240 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
xackus has joined #zig
waleee-cl has quit [Read error: Connection reset by peer]
waleee-cl has joined #zig
tsujp69 has joined #zig
<tsujp69> does anyone have a configuration for building zig on nixos 20.09?
<tsujp69> HEAD of zig*
<dominikh> tsujp69: I pretty much just take the nix file from nixpkgs and change the version to the commit on master I want to build.
<tsujp69> I did that and it doesnt build for me
<tsujp69> expected LLVM 11.x ut found 7.1.0
<dominikh> how are you building the derivation? you'll need to let it fetch dependencies from unstable nixpkgs, too
<tsujp69> ah
<dominikh> to get a recent enough LLVM
<tsujp69> I straight up just copied the nixpkgs one and replaced the rev and sha256
<tsujp69> did you have yours handy by chance?
<dominikh> do you use home-manager?
<tsujp69> I do not, just got onto nixos about.. 1 hour ago
<dominikh> okay, so the easiest, hackiest approach is editing the zig/default.nix inside your nixpkgs checkout, and then something like `nix run -f /path/to/nixpkgs zig` will get you a shell with that zig active. if you don't want to edit nixpkgs itself, you'll want to tweak the nix file slightly and have it import your local nixpkgs checkout (to get a recent LLVM) instead of using the system nixpkgs
<dominikh> can probably use nix-env instead of nix run for something more permanent, too, but I don't really know nix-env much.
<tsujp69> hmm, im trying to get this done within the configuration.nix file itself, well specifically a copy-paste of the nixpkgs zig file
<tsujp69> As in, I've copied the nixpkgs zig.nix and am using it in my environment.systemPackages with of course this LLVM error happening
<tsujp69> I want it there until zig 0.7.0 for use accross various systems, nix-env outside of that deterministic set
<dominikh> so you have like a callPackage call in your configuration.nix?
frett27_ has joined #zig
<tsujp69> I do yeah
<dominikh> try and see if callPackage ./zig.nix { llvmPackages = llvmPackages_11; }; works – I have no idea if 20.09 ships with that. if not, you'll want to import unstable nixpkgs (e.g. your checkout) and use its llvmPackages_11
<tsujp69> its calling a copy-paste (only channged the `rec` and `sha256` from the nixpkgs zig expression file), unsure how/where to put in llvm_11
<tsujp69> 20.09 has the literal `llvm_11` in the package list
<dominikh> well, try that callPackage invocation then
<tsujp69> Ack, trying now
frett27 has quit [Ping timeout: 272 seconds]
<tsujp69> where does `llvmPackages` come from if it's called `llvm` in the package list?
<dominikh> (might have to be llvmPackages = pkgs.llvmPackages_11 if you're not in a with pkgs block) – `nix search llvmPackages`, as for how I deduced that name: the zig.nix has llvmPackages in its list of inputs
<dominikh> llvmPackages defaults to llvm 9, but llvm 10 and 11 are available, too
<tsujp69> building so far, at 99%
<tsujp69> my callPackage is within a pkgs block so should be g
<tsujp69> what I mean is where does `pkgs.llvmPackages` come from?
<tsujp69> is there cmakePackages, zigPackages etc?
<tsujp69> the `xxxPackages` bit confuses me as to where nix exposes/generates/blahs that
<dominikh> no. it's just something LLVM in nixos specific. if you want to look at how it's defined, check out nixpkgs/pkgs/top-level/all-packages.nix and grep for 'llvmPackages_11 = '
<tsujp69> gotcha
<tsujp69> well I got to `Built target zig` and then `error: AccessDenied`, no indication of where logs are printed though.. any ideas there
<dominikh> ugh, right
<dominikh> IIRC it's enough to set doCheck = false in the zig.nix – this is https://github.com/ziglang/zig/issues/6810
ur5us has joined #zig
<tsujp69> tried setting an env var for XDG_CACHE_HOME inside the derivation and that didnt work, will try doCheck=false now
<dominikh> yeah I gave up on setting the env var
<tsujp69> eyy it worked
<tsujp69> with doCheck set to false
<tsujp69> not ideal I guess but hey..
<tsujp69> hooo boy now some other commands don't work, ruh roh lmfao
<dominikh> good luck
<tsujp69> in other news hows that lanlord fiasco going?
<tsujp69> Andrews' scummy landlord and Hulu
return0e[m] has quit [Quit: Idle for 30+ days]
earnestly has joined #zig
Kingsquee has quit []
neceve has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
osa1 has quit [Ping timeout: 268 seconds]
ur5us has quit [Ping timeout: 264 seconds]
gpanders has quit [Read error: Connection reset by peer]
gpanders has joined #zig
_whitelogger has joined #zig
mmohammadi9812 has quit [Ping timeout: 272 seconds]
mmohammadi9812 has joined #zig
endragor has quit [Remote host closed the connection]
Xavi92 has joined #zig
knebulae has quit [Quit: Leaving]
knebulae has joined #zig
<dominikh> what's the actual compilation unit in Zig?
<ifreund> there's only one
<dominikh> then my follow-up questions are 1) what kind of data gets cached to make incremental builds fast 2) if a file makes use of anyerror, will it have to be built from scratch every time a new error gets introduced in the program?
<dominikh> I guess https://kristoff.it/blog/zig-new-relationship-llvm/ answers both of those for me
Xavi92 has left #zig ["https://quassel-irc.org - Chat comfortably. Anywhere."]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
a_chou has joined #zig
lucid_0x80 has joined #zig
<g-w1> I can't find a way to unsafely cast a usize to i64, is there a way?
<alexnask[m]> @truncate will work for both 32bit and 64bit usize I think
<g-w1> thanks
<g-w1> it says expected signed integer type, found 'usize' when trying to convert a usize to an i64
<g-w1> using truncate
<alexnask[m]> How are you calling it? @truncate(i64, <the usize>) should work
<g-w1> this is the error: ./src/lib.zig:63:33: error: expected signed integer type, found 'usize'
<g-w1> mem[0] = @truncate(i64, @ptrToInt(&mem));
<alexnask[m]> Huh, weird. Let me test this
lucid_0x80 has quit [Remote host closed the connection]
<alexnask[m]> Ah mb ofc the signedness matters >.> I guess you probably want bitCast in this case but it will fail when usize is 32 bit
<g-w1> ok. im programming to interface with x86_64 assembly so usize will be 64 bit. thanks
kristoff_it has joined #zig
<kristoff_it> hello, quick Q: I know that types expose some properties, like if T is an array type, you can do T.len. My question is then, are the types exposing all the properties of their @typeInfo counterpart, or it's just something ad-hoc that doesn't have anything to do with @typeInfo?
<alexnask[m]> Most of these existed before typeInfo
lucid_0x80 has joined #zig
<alexnask[m]> I believe all the superfluous special fields were recently removed by tdeo
Wallbraker281 has quit [Quit: Ping timeout (120 seconds)]
<kristoff_it> oh, so no more T.len?
Wallbraker281 has joined #zig
<kristoff_it> like I believe you could also to something like OptionalT.child
<kristoff_it> also do*
tane has joined #zig
<alexnask[m]> Yeah I think both of those are gone, let me check what remains
a_chou has quit [Quit: a_chou]
x2C25 has quit [Ping timeout: 258 seconds]
Snetry has joined #zig
<g-w1> now im getting some weird linker errors when memcpy and memset compiler builtins are used. i think these may belong to compiler-rt, but shouldn't my library be statically linked? https://paste.rs/dW9
<alexnask[m]> Yes afaict all special field accesses were removed kristoff_it
<alexnask[m]> (for `type`)
<g-w1> should I link against compiler-rt?
<kristoff_it> thanks alexnask[m]
<alexnask[m]> g-w1: What is your target? I believe compiler-rt (and special/c.zig) are only not linked when you are building a static library
<alexnask[m]> Unless you specifically set bund_compiler_rt
<alexnask[m]> bundle*
dimenus has joined #zig
Snetry has quit [Ping timeout: 260 seconds]
<g-w1> how do i set that? Im building a static library
Snetry has joined #zig
<alexnask[m]> looks like its missing from the new CLI but is still in the build system >.>
<g-w1> cool
skuzzymiglet has joined #zig
<alexnask[m]> : P The easiest way is probably to define them yourself for now unfortunately
<alexnask[m]> Ill open an issue for this
<g-w1> ok
<alexnask[m]> Ah, https://github.com/ziglang/zig/issues/6817 <- this looks like it covers it
<g-w1> how would I define it manually? Im not sure I undertsand
Snetry has quit [Ping timeout: 260 seconds]
<alexnask[m]> `pub extern fn memcpy(noalias dest: [*]u8, noalias src: [*]u8, count: usize) { ... }`
<alexnask[m]> you can copy the definitions from https://github.com/ziglang/zig/blob/master/lib/std/special/c.zig
<g-w1> the memcpy use is coming from the gpa, not my code. will that override it?
<alexnask[m]> Yes, GPA uses the builtin, which results in LLVM generating a call to this symbol
<g-w1> ok so it if i define it will override, thanks!
Snetry has joined #zig
<g-w1> awesome, it works! thanks so much
<alexnask[m]> Cheers. We should get bundle_compiler_rt back soon :P
via_ is now known as via
dimenus has quit [Quit: WeeChat 2.9]
dimenus has joined #zig
xackus_ has joined #zig
xackus has quit [Ping timeout: 268 seconds]
<kristoff_it> Zig showtime starts in ~20 mins, the preshow is live https://twitch.tv/kristoff_it
frmdstryr has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
g-w1 has quit [Quit: WeeChat 2.3]
g-w1 has joined #zig
zippoh has joined #zig
amk has joined #zig
GrooveStomp has joined #zig
frmdstryr has quit [Ping timeout: 272 seconds]
dimenus has quit [Quit: WeeChat 2.9]
mmohammadi9812 has quit [Quit: Quit]
cole-h has joined #zig
mmohammadi9812 has joined #zig
<tsujp69> I've checked zig out against a specific commit and built it but my version numer says `0.6.0` instead of `0.6.0+9ca9819`, is this expected? How else can I test I have compiled zig from commit `9ca9819`?
skuzzymiglet has quit [Read error: No route to host]
dumenci has joined #zig
lucid_0x80 has quit [Ping timeout: 265 seconds]
<g-w1> is the new one in your path, or the old one?
<tsujp69> should be the new one since I am doing this under nixos I am explicitly running the build artifacts it output
skuzzymiglet has joined #zig
hnOsmium0001 has joined #zig
frmdstryr has joined #zig
frett27 has joined #zig
frett27_ has quit [Ping timeout: 260 seconds]
<waleee-cl> tsujp69: have you changed the sha256 hash?
<tsujp69> yes but in accordance with fetchFromGitHub
<waleee-cl> is the newly built zig under a new hash in /nix/store/ ?
<tsujp69> it is
<tsujp69> its probably because version isn't set in `meta = stdenv.lib` I guess?
<waleee-cl> not sure. From what I remember the problem was (around 1 year back) that nix doesn't update a variable in the cmake file, which is used for the output of 'zig version'
<tsujp69> I see
<tsujp69> hmm
<waleee-cl> at least when overriding the commit for the zig in the binary cache
Akuli has joined #zig
<tsujp69> hmm, well it does have the latest files I did a check of the hash and what not
<tsujp69> trying to build something with zig gives me this heinous output http://ix.io/2CIk
<waleee-cl> this line https://github.com/ziglang/zig/blob/master/CMakeLists.txt#L29 isn't changed for some reason when bumping the sha256 hash
<waleee-cl> tsujp69: you probably need to set a temporary $HOME as in https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/zig/default.nix#L24
omglasers2 has joined #zig
dumenci has quit [Ping timeout: 240 seconds]
techtirade has joined #zig
skuzzymiglet has quit [Ping timeout: 258 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
neceve has quit [Ping timeout: 272 seconds]
skuzzymiglet has joined #zig
riba has joined #zig
mmohammadi9812 has quit [Read error: Connection reset by peer]
frett27_ has joined #zig
mmohammadi9812 has joined #zig
frett27 has quit [Ping timeout: 260 seconds]
kristoff_it1 has joined #zig
kristoff_it has quit [Ping timeout: 240 seconds]
cole-h has quit [Ping timeout: 264 seconds]
frmdstryr has quit [Ping timeout: 264 seconds]
jayschwa has joined #zig
frmdstryr has joined #zig
<jayschwa> Is there a way to get the code size of a function at comptime? sizeOf seems to return the size of the function pointer, nor do I see a relevant field in the TypeInfo.
<andrewrk> jayschwa, no but that's something I think belongs in the language. afaik there is not yet a proposal open for it
marnix has quit [Ping timeout: 272 seconds]
ur5us has joined #zig
<jayschwa> I did not see one either. Created https://github.com/ziglang/zig/issues/6918
<andrewrk> thanks
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
Xavi92 has joined #zig
<andrewrk> ifreund, how we looking for the release? do the issues in the 0.7.0 milestone cover all the needs of river?
<Xavi92> Hi, I am bit worried at why would `zig` generated apparently wrong code for this C function (please read my last comment): https://github.com/simias/psx-sdk-rs/issues/1
<Xavi92> Context: I'm compiling both Zig and C for MIPS I using zig commit 0da8e75ff and llvm10 using the patch mentioned in the issue
Kena has joined #zig
<Kena> Hello, please why do put an address-of operator on an array of bytes turns it into an slice of immutable bytes?
<andrewrk> Xavi92, looks like an important issue. feel free to open a corresponding issue on the zig tracker and hopefully we can get the problem narrowed down
<alexnask[m]> I assume you mean taking the address of an array literal right Kena?
<andrewrk> Kena, if you want mutable bytes you have to choose where in memory to put them
wootehfoot has joined #zig
<Kena> I do not understand what is happening under the hood during the semantic analysis, or code generaiton (or whatever, i'm not sure about the different steps undertaken by a compiler). I have the following error : .\async2.zig:14:28: error: expected type '[]const u8', found '[9]u8'
<Xavi92> andrewrk: thanks a lot! First I'll ensure it still can be reproduced on newest zig and write up an issue
<Kena> At the snippet code available at https://ziglang.org/documentation/master/#Async-and-Await at the line `expect(std.mem.eql(u8, seq_points, "abcdefghi")); `
<Kena> And when i put the `&` in front of seq_points, it turns the [9]u8 into a []const u8, why it does that ?
<g-w1> it is a type coercion
<Kena> Yes alexnask[m]!
<alexnask[m]> As Andrew said, if you want a slice to mutable data, you have to control where the memory of the array lives
<alexnask[m]> When you take the address of the literal, the data will live in a constant data segment in your executable so the resulting slice will have to be mutable
<alexnask[m]> Does that answer your question?
<alexnask[m]> s/mutable/const**
<Kena> wow! It wasn't mentionned in the doc, you're kind. Thanks alexnask[m], g-w1, andrewrk.
riba has quit [Ping timeout: 240 seconds]
<Xavi92> andrewrk: does latest Zig require llvm 11.x? If so, I will need a few hours to compile llvm and friends so I won't be able to write the issue until tomorrow or later
<alexnask[m]> It does
<bfredl> llvm distribute binaries also
<g-w1> in codegen.zig, what exactly is a MCValue, and what does MC stand for?
<Xavi92> bfredl: I need a very specific patch for MIPS I load delay slots that (AFAIK) has not been merged into upstream yet
<alexnask[m]> g-w1: It stands for memory cell
<g-w1> it can also be a register though?
<alexnask[m]> (I believe)
<g-w1> cool. thanks
jayschwa has quit [Ping timeout: 245 seconds]
frett27 has joined #zig
Patrice_ has joined #zig
frett27_ has quit [Ping timeout: 264 seconds]
frett27 has quit [Ping timeout: 240 seconds]
skuzzymiglet has quit [Ping timeout: 258 seconds]
Xavi92 has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<ifreund> andrewrk: thanks for checking in, river's not really being held back by any zig issues currently as the libc version thing is fixed on master
<andrewrk> ok great so I'll just do a little test to make sure when a new glibc comes out zig will do the right thing (I already coded it, just need to test it)
<ifreund> #131 is certainly annoying but I can work around it by using C code with zig-wayland
<andrewrk> ahh yes 131
<ifreund> and right now my build breaks on musl cause of translate-c not liking bitfields, but I'm about to replace that with zig-wlroots anyways
<ifreund> yeah I tried to implement a hacky workaround for #131 in stage1 but hit a brick wall
<ifreund> I think it should wait for stage2, and would certainly be easier to implement if kept in mind early on
wootehfoot has quit [Read error: Connection reset by peer]
frett27 has joined #zig
Patrice_ has quit [Ping timeout: 260 seconds]
omglasers2 has quit [Read error: Connection reset by peer]
tane has quit [Quit: Leaving]
Akuli has quit [Quit: Leaving]
frett27_ has joined #zig
frett27 has quit [Ping timeout: 260 seconds]
<g-w1> what is the best opcode reference for developing/reading the self-hosted compiler?
<andrewrk> g-w1, for x86?
<Kena> Sorry to bother you again alexnask[M] but when you said that "taking the address of the literal, the data will live in a constant data segment in your executable so the resulting slice will have to be constant". But is the constant data segment the same than the array or is it another memory address?
<g-w1> yeah, i mean for x86, thanks
frmdstryr has quit [Ping timeout: 264 seconds]
frett27_ has quit [Ping timeout: 264 seconds]
<Kena> I mean is the segment data redefined or does a pointer copy the data to stores the value at another memory location?
<andrewrk> Kena, you have 3 choices for a mutable array: (1) variable on the stack (2) global variable (3) heap allocate it
xackus_ has quit [Ping timeout: 264 seconds]