ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<nornagon> andrewrk: any thoughts on why https://gist.github.com/nornagon/9113b2a4e8b33e763704c79976a355e1 might be failing with this error? Assertion failed: (dylib.file), function exports, file /Users/nornagon/Source/Reference/zig/deps/lld/lib/ReaderWriter/MachO/File.h, line 365.
darithorn has joined #zig
redj has joined #zig
darithorn has quit [Quit: WeeChat 2.2]
mnoronha has joined #zig
return0e has quit []
<wink_> @jenz and others, here are instructions for building zig and llvm that I used on Arch Linux:
<wink_> They may work on other distro's, please let me know if there are any issues so I may update the instructions.
return0xe has quit [Ping timeout: 252 seconds]
wilsonk has joined #zig
return0e has joined #zig
<nornagon> hm.. i added more `-framework` flags and now i'm seeing this: content type not yet supported
<nornagon> UNREACHABLE executed at /Users/nornagon/Source/Reference/zig/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp:342!
<nornagon> looks like the content type that isn't yet supported is `typeObjCImageInfo`
<nornagon> ah, linking the glfw dylib dynamically works. it's just trying to link it statically that fails.
wink_ has quit [Remote host closed the connection]
return0e has quit [Ping timeout: 240 seconds]
mnoronha has quit [Ping timeout: 245 seconds]
return0e has joined #zig
mnoronha has joined #zig
kristate has joined #zig
kristate was kicked from #zig by ChanServ [Banned: I would like you to take a break from Zig for a week, and then come back when you're ready to interact in an ho]
mahmudov has joined #zig
darithorn has joined #zig
_whitelogger has joined #zig
darithorn has quit [Quit: WeeChat 2.2]
<andrewrk> nornagon, sounds like a limitation of the linker
<andrewrk> unfortunately the LLD project, which is zig's linker, does not have great MACH-O support
<andrewrk> that's one of the motivations for https://github.com/ziglang/zig/issues/1535
<andrewrk> good to know that linking dynamically works
<nornagon> hm, that's weird, chromium builds with lld and depends on those frameworks on OSX. i wonder what's different.
<andrewrk> I highly doubt chromium builds with lld on macos
<nornagon> ah interesting, let me check
<nornagon> they definitely do on windows (but only as of recently)
<nornagon> cool, good to know 👍
<andrewrk> yeah. the windows and linux parts of LLD are pretty solid. it's the macos one that is lagging behind
<nornagon> is there any sort of (proto-?) package management system for zig?
<scientes> nornagon, source or binary?
<nornagon> either, but it seems like it'd be important to include binary stuff to for anything that involved binding to C
<scientes> as zig compiles statically it isn't really needed unless you link to C
<nornagon> is there an easier way to cast '*const foo' to '[*]const foo'? i'm calling a C function whose signature is like 'void bar(const foo*)', and zig is interpreting that argument as '[*]const foo' (when in fact, the function only expects a single element, not an array)
<nornagon> it's kind of tedious to `@ptrCast([*]const foo, &blah)`
<nornagon> not that i have any idea how that works 😅but it does!
_whitelogger has joined #zig
mnoronha has quit [Ping timeout: 252 seconds]
very-mediocre has joined #zig
kristate has joined #zig
kristate was banned on #zig by ChanServ [*!*@180.27.209.223]
kristate was kicked from #zig by ChanServ [Banned: I would like you to take a break from Zig for a week, and then come back when you're ready to interact in an ho]
<scientes> how do i look up the compiled code size of a function?
<dirkson> andrewrk: https://en.wikipedia.org/wiki/Language_Server_Protocol - I just learned this exists, as 'Go' appears to be implementing a server based on it. I'm curious if you knew about it/had opinions on it.
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
Barabas has joined #zig
<wilsonk> I think Andrew was thinking of waiting until the self hosting compiler is pretty much working (may also use a different protocol?)
<wilsonk> scientes: that would be difficult...the second stage compiler will produce a separate object file for each function but I am not sure if that is 'the size of a compiled function' exactly...and I don't know if it is fully working right now. I am just thinking of Andrew's example where he showed that functionality. Why do you need the size, btw?
<cgag> is there a way to attach more data to errors, like if i'm doing a parser and want to attach line numbers or something?
<wilsonk> cgag: if you aren't just looking to see the return trace of where the failure was (which will show the line number of each failure), then you might be able to switch on the caught error and print out the line info at the point of the catch? Otherwise, since errors are usually union types, I am not sure if you can inject line info into them, per se. Please take with a grain of salt though, as I am no Zig expert :)
unique_id has quit [Remote host closed the connection]
<Barabas> Aren't errors in zig just enums pretty much?
<wilsonk> Error sets are pretty much just enums, but usually you would use error union types (to switch on, etc.)
<wilsonk> I think ;)
_whitelogger has joined #zig
Barabas has quit [Ping timeout: 256 seconds]
Barabas has joined #zig
mahmudov has quit [Ping timeout: 252 seconds]
Ichorio has joined #zig
mnoronha has joined #zig
<andrewrk> nornagon, we have plans for making zig packages of C libraries, made to be system-independent via a libc implementation in zig. https://github.com/ziglang/zig/issues/514
<andrewrk> nornagon, regarding c pointers, here's a relevant proposal: https://github.com/ziglang/zig/issues/1059
mnoronha has quit [Ping timeout: 260 seconds]
<andrewrk> scientes, zig doesn't expose the concept of compiled code size of functions. can you elaborate on this interesting use case?
<andrewrk> cgag, no, errors have to be simple integers under the hood for everything to work. the recommendation is that, if you need to attach extra information (for example maybe it's a parse error and you want to attach line/column), it might be time to treat that not as an error case but as a normal case that you handle differently
<scientes> andrewrk, I was not thinking of getting it from code, just analyzing the compiled code. I was wondering how many cache lines siphash takes
mnoronha has joined #zig
Barabas has quit [Ping timeout: 256 seconds]
andrewrk has quit [Ping timeout: 240 seconds]
andrewrk has joined #zig
c00lways has joined #zig
<c00lways> hi, how do i check if a variable is undefined?
<scientes> c00lways, i don't think you can
<c00lways> @scientes: ai, okay
mnoronha has quit [Ping timeout: 260 seconds]
unique_id has joined #zig
<c00lways> how do i for loop from 0 to X ?
<nornagon> andrewrk: that libc issue looks sweet, but unfortunately the library I'm linking against (Skia) is C++
<c00lways> can zig link to c++ library?
<nornagon> it can if you wrap it with a C API :)
<c00lways> okay cool
<nornagon> the mono project is maintaining C bindings to Skia here: https://github.com/mono/skia
<nornagon> oh hm, https://github.com/ziglang/zig/issues/853 suggests that there are plans to wrap the C++ parts of clang too
<unique_id> ohh nice, I'm using Cairo for something right now and I've always wanted to try Skia
<c00lways> hmm how do i for loop range of numbers?
<nornagon> unique_id: here's a minimal example of glfw+skia: https://github.com/nornagon/skia-zig/blob/master/main.zig
<nornagon> not shown: how to download & build skia :)
<unique_id> ha, yeah... that may be why I've never tried Skia
<unique_id> I remember it being difficult, maybe it's not? I'll go for it. Thanks for the example
<nornagon> it's not so hard. something like: `git clone https://github.com/mono/skia && cd skia && python tools/git-sync-deps && gn gen out/Shared --args="is_component_build=true" && ninja -C out/Shared skia`
<nornagon> but yeah not quite as simple as ./configure && make 😅
<c00lways> ok nvm, i use while loop instead
Jenz has joined #zig
<Jenz> I think you should include the LICENSE in https://ziglang.org/builds/zig-linux-x86_64-master.tar.xz builds
<c00lways> how do i debug? seems like it panic with some hex
<Jenz> I have created an AUR package that downloads the most recent master build, i.e. a bin package, and installing stuff without a license is bad practice if not illegal
<Jenz> MIT is a special case in which each license is a custom license, and must therefore be provided by someone that holds the license rights
<Jenz> As far as I understand
<Jenz> i
<Jenz> s/i/it/
<andrewrk> c00lways, "undefined" means that you don't know what the value is. It could be anything. So it doesn't make sense to be able to find out if it's undefined.
<andrewrk> c00lways, to debug: on windows use msvc, on linux use gdb, on macos use lldb
<Jenz> gdb is great
<Jenz> In my - though unexperienced - opinion
<andrewrk> Jenz, agreed, omitting LICENSE was an oversight. I'll open an issue for that
* Jenz :)
<andrewrk> I'll have that fixed by 0.3.0 release which is scheduled for friday
<tyler569> have you considered doing any 0.3.x releases so the download isn't wayyy out of date again like 0.2.0 is now?
<scientes> tyler569, the release is scheduled for a few days from now
<andrewrk> I believe tyler569 is saying to release more often than every 6 months
<tyler569> right, but I mean to bridge the next gap
<tyler569> yea
<scientes> oh nvm
<andrewrk> I feel OK with the schedule. It's in lock-step with LLVM, and it's a balance between stability and progress. The release schedule will change after 1.0.0
<andrewrk> I'll consider it though
<andrewrk> the fundamental problem is that zig is immature and changing the release schedule isn't going to solve that
<Jenz> So... when will 0.3.0 be released?
<Jenz> Oh nvm
<Jenz> ...
<c00lways> hmm how do i know which line gives the error using lldb
<Jenz> Maybe "backtrace"?
<c00lways> ai, too difficult
<c00lways> switching back to go for now
c00lways has quit [Quit: Leaving]
<Jenz> Is typing "backtrace" really that difficult?...
<tyler569> "bt" works too fwiw, though I doubt that would have assuaged him
* Jenz ¯\_(ツ)_/¯
<scientes> wow, go use to have horrible debugging, i guess it improoved
<tyler569> who needs a debugger, printf ftw
<tyler569> or I guess std.debug.warn in this channel
<Jenz> hehe
bodie_ has quit [Quit: ZNC 1.6.6+deb1ubuntu0.1 - http://znc.in]
bodie_ has joined #zig
<scientes> home/shawn/bin/perfh.zig:117:37: error: expected type '*Allocator', found '*const Allocator'
<scientes> enumsstack[i] = try allocator.alloc(u8, size);
<scientes> so zig 0.3.0 will release with llvm 7 even thought it was developed with llvm 6?
mnoronha has joined #zig
<andrewrk> scientes, I've been testing with llvm 7 for 4 months
<Jenz> Hehe
* Jenz likes saying "hehe"
<Jenz> That's cool andrewrk
mnoronha has quit [Ping timeout: 272 seconds]
<scientes> andrewrk, well, it crashes for me on ubuntu cosmic frame #0: 0x00007ffff4a6b772 libLLVM-7.so.1`llvm::DIBuilder::createFile(llvm::StringRef, llvm::StringRef, llvm::Optional<llvm::DIFile::ChecksumInfo<llvm::StringRef> >, llvm::Optional<llvm::StringRef>) + 50
<scientes> (trying to narrow it down)
<scientes> * thread #1, name = 'zig', stop reason = signal SIGSEGV: invalid address (fault address: 0x10)
mzo has joined #zig
mnoronha has joined #zig
<l1x> c00lways> switching back to go for now
<l1x> nice :)
<Jenz> Well,
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> scientes, is the static build working for you?
<andrewrk> that's always an option if compiling from source is problematic
<andrewrk> for compiling from source, make sure you're using the same compiler to to compile zig as you use to compile llvm/clang
<andrewrk> that means if you got llvm/clang from a package manager, you have to use the same compiler that the package manager used and use that to compile zig
<andrewrk> this is a limitation of C++
wilsonk has quit [Read error: Connection reset by peer]
<dirkson> andrewrk: Hah! Thanks!
wilsonk has joined #zig
<dirkson> wilsonk: Also thanks to you.
<wilsonk> dirkson: no problems :)
<dirkson> I probably didn't need to bug andrew about that, then. That's worth remembering.
very-mediocre has quit [Ping timeout: 256 seconds]
<andrewrk> no worries
<Jenz> As I see that zig is somewhat lacking in docs; I think I might be able to help out in that area. I *think*, there's been a few times to many I've said I could help out and never done so. I'll just keep playing with it and see how it goes. Wish me luck! :D
<andrewrk> Jenz, I wonder how practical it would be to start working on https://github.com/ziglang/zig/issues/21 (auto generated html docs)
<andrewrk> you could write pure zig code and use std.zig.parse to parse zig code
<andrewrk> look at the doc comments and output html
<andrewrk> it would eventually have to be reworked and integrated into the self hosted compiler, but I'm sure a lot of the code would be useful and survive
eswtucka has joined #zig
<andrewrk> at least it would give people a place to start contributing, if their doc comments were being exposed in some way
<Jenz> Indeed, that would be nice; though I will first have to get a bit more comfortable with zig
<eswtucka> Hi, is there an equivalent to strtod in zig?
<andrewrk> eswtucka, std.fmt.parseInt
<andrewrk> oh, that's floats isn't it
<andrewrk> we don't have float parsing yet in the standard library: https://github.com/ziglang/zig/issues/375
<andrewrk> you can link against c and use strtod
davr0s has joined #zig
<eswtucka> ok, thanks
Jenz has quit [Quit: Lost terminal]
Jenz has joined #zig
mnoronha has quit [Ping timeout: 252 seconds]
<dirkson> Jenz: The lack of documentation has also occurred to me, although I don't have a lot of spare time to correct it. Ping me if you need a second set of eyes on something you're written, or similar small help.
<cgag> `it might be time to treat that not as an error case but as a normal case`. Makes sense, I thought that might the recommendation, basically leaving the zig error handling for exceptional stuff and my own error handling for expected errors like parse errorrs, though it seems like it'd be nice to get to use try/catch for my own errors. I'm currently setting globals i only assume are set when switching on
<cgag> certain error enums
<Jenz> dirkson: thanks
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 272 seconds]
mzo has quit [Ping timeout: 260 seconds]
Jenz has quit [Ping timeout: 252 seconds]
Ichorio has quit [Ping timeout: 272 seconds]
stratact has joined #zig
<stratact> how's the self-hosted compiler coming along?
eswtucka has quit [Quit: Page closed]
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 252 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mnoronha has joined #zig
<andrewrk> cgag, that's a reasonable strategy too. you can also pass pointer args instead of using global state
davr0s has joined #zig
<andrewrk> stratact, it's been on pause while I fix bugs for 0.3.0
<andrewrk> roadmap after that will be to rework coroutines, then self hosted compiler and/or other big breaking changes
<stratact> Gotcha, sounds good
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mnoronha has quit [Ping timeout: 240 seconds]
mnoronha has joined #zig