ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
steveno_ has joined #zig
zesterer has joined #zig
steveno_ has quit [Remote host closed the connection]
zesterer has quit [Quit: zesterer]
zesterer has joined #zig
zesterer has quit [Remote host closed the connection]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Ichorio has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
heakins has quit [Ping timeout: 260 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ofelas has quit [Ping timeout: 264 seconds]
ofelas has joined #zig
<achambe> So, anyone have any applications they are writing in zig? or is it still early days
<Aequus> Err, using -DCMAKE_PREFIX_PATH didn't work, I get a silly error saying file INSTALL cannot copy file "..." to "/usr/local/bin/zig" even though I don't want it to install to /usr/local, that's why I set it in the first place... When I manually edit cmake_install.cmake and change /usr/local to the prefix I want, it installs it there, but trying to compile anything with Zig, it tells me that it cannot find zig
<Aequus> lib directory and to reinstall or use --zig-install-prefix, but when I pass --zig-install-prefix=PREFIX, it says invalid argument. Any ideas as to how I can install and use Zig properly from PREFIX?
<Aequus> Also when I run "make install", it says "Install configuration: "Debug"", how do I change it to release, if possible?
<Aequus> I know how to workaround the issue, but I want to do it the proper way. :P
<Aequus> Funnily enough it attempts to install the libembedded_lld_*.a to the PREFIX, but not the zig executable.
<Aequus> Actually nevermind, my problem was that I used = after --zig-install-prefix. >.>
<Aequus> .ls
<Aequus> "zig --zig-install-prefix ~/.local/pkg/zig-0.2.0 build-exe --release-fast hello.zig" works.
<Aequus> Sorry. :P
<Aequus> And as to why it tried to install the libembedded_* stuff to CMAKE_PREFIX_PATH whereas the rest to CMAKE_INSTALL_PATH, I dunno.
<Aequus> CMAKE_INSTALL_PREFIX*
<Aequus> Huh, I rebuilt and reinstalled with -DCMAKE_BUILD_TYPE=Release, and when issuing the same command that worked with DEBUG, I'm getting:
<Aequus> : CommandLine Error: Option 'color' registered more than once!
<Aequus> LLVM ERROR: inconsistency in registered CommandLine options
tiehuis has joined #zig
<tiehuis> Aequus: when you run your `cmake ..`, is it showing clang with .so files and llvm with .a or vice versa?
<tiehuis> also, if you want something easy, you can try the master builds from CI: https://ziglang.org/download/
<Aequus> tiehuis: Oh, it uses gcc.
<Aequus> Well it also says found LLVM and CLANG, so I dunno.
<tiehuis> these are all statically linked so you shouldn't have any particular issues
<tiehuis> i was having that issue show up in arch when building from source, what is your os/distro?
<Aequus> arch
<tiehuis> you can install the package the aur and that should work
<tiehuis> i had to add a patch to the build step to get around this particular issue
<Aequus> Ah, all right. Thanks. :)
<tiehuis> as it seems libclang doesn't provide .a files for static linking so when building it finds the libclang.so and llvm.a files and there is an issue when dynamically linking libclang but statically linking llvm
<Aequus> tiehuis: Heh, the only reason I wanted Release is because I thought it'd disable dumping a core when the .zig file I'm trying to build doesn't exist. Any ideas?
<Aequus> This:
<Aequus> unable to open './hello.zig': file not found
<Aequus> Aborted (core dumped)
<tiehuis> aur does a release build, if you wanted to do manually however, you should just be able to modify your CMakeLists.txt with this patch:
<Aequus> Yes, I did that.
<tiehuis> you shouldn't get a core dump file with that by default
<Aequus> That's odd. :/
<tiehuis> maybe you have them enabled by default, have you tried anything here? https://wiki.archlinux.org/index.php/Core_dump
<Aequus> I probably have it enabled, but I thought it wouldn't dump a core with Release (and that patch), and I'm not sure if it's normal behavior from zig. I should probably disable automatic core dumps though.
<tiehuis> i don't get core dumps even with a debug build
<tiehuis> it should be an os dependent thing and not visible a zig thing i believe
<Aequus> Yeah but why would it abort when it could just gracefully exit having not found the source file? I thought it was a Debug/Release thing where with Debug it would abort, and with Release it would just exit or something.
davr0s has joined #zig
arBmind has joined #zig
<tiehuis> it shouldn't really, let me make an issue and i can change that tomorrow
<tiehuis> actually, i'll just do this now
<tiehuis> there are actually a few things to consider with how this interacts with tests so it's not a completely trivial change
tiehuis has quit [Quit: WeeChat 2.1]
noonien has joined #zig
<Aequus> LOL, I told my friend about Zig, I made the claim Zig's comptime is epic and generates optimized/better ASM, and he didn't believe so he gave me an example of gcd written in C, told me to write it in Zig, and also told me the optimal ASM would be "foo: movl $120, %eax ret". GCC and Clang transformed the tail recursion into a loop and then inlined it, but didn't precompute the result, etc... whereas what I did
<Aequus> was: copy his code (could have translate-c'd it) add comptime params, then do: "zig build-obj gcd.zig --release-fast --emit asm" and the result was exactly the optimal asm! I guess I convinced him... He was too lazy to bother with the talk that mentioned it so had to do it this way. :D
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<achambe> Yeah, the comptime feature is really something I want to explore
<andrewrk> Aequus, unless you're trying to hack on the compiler itself, you can use the statically linked CI build of master branch
davr0s has joined #zig
ofelas has quit [Read error: Connection reset by peer]
ofelas has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
<andrewrk> alexnask, I figured out #894
<alexnask> @andrewrk Cool, what was the issue?
<GitHub42> [zig] andrewrk pushed 1 new commit to master: https://git.io/vpvJH
<GitHub42> zig/master 4a2bfec Andrew Kelley: fix linux implementation of self exe path...
<andrewrk> this ^
<andrewrk> sorry for the trouble. pretty annoying bug
<alexnask> ah so basically it would read garbage after the executable path? Pretty weird that it seemed to happen randomly though :p
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub164> [zig] andrewrk pushed 1 new commit to master: https://git.io/vpvUp
<GitHub164> zig/master b5459eb Andrew Kelley: add @sqrt built-in function...
pablo_ has joined #zig
pablo_ has quit [Client Quit]
xkern has joined #zig
<xkern> do you have a book recommendation for writing compiler ?
<andrewrk> xkern, I recommend trying it without reading any books
<andrewrk> and if you get stuck you can read other compiler source code for inspiration
<andrewrk> once you have something basic working without reading anything, you will know what you want to read about
<GitHub136> [zig] andrewrk pushed 1 new commit to master: https://git.io/vpvqK
<GitHub136> zig/master a8d7942 Andrew Kelley: exit with error code instead of panic for file not found
<GitHub69> [zig] andrewrk pushed 1 new commit to master: https://git.io/vpvq6
<GitHub69> zig/master 859b10d Andrew Kelley: std.math.ln and std.math.exp use float strict mode...
<andrewrk> Aequus, ^ panic issue fixed (at least for the case you were hitting)
<Aequus> andrewrk: Thanks. :)
<andrewrk> alright, back to playing with kernel threads :)
davr0s has joined #zig
arBmind has quit [Quit: Leaving.]
<xkern> andrewk: thanks . i understood from your message you start and if you get stuck look up tutorials.
xkern has quit [Quit: Leaving.]
Ichorio has quit [Ping timeout: 265 seconds]
<alexnask> Is there a way to switch the linker zig uses?
<alexnask> Or should I compile to an object file and have some script do the linking?
<andrewrk> alexnask, when linking, it's a non-negotiable assumption that zig will use its own linker (which is LLD)
<andrewrk> however, exporting .o files is supported, as you mentioned
<andrewrk> what's your use case though?
<alexnask> Ok, I assume on windows the object files are COFF?
<andrewrk> corret
<andrewrk> *correct
<alexnask> I want to use clinker (http://www.crinkler.net/)
<alexnask> I'd like to see what binary size I can get down to using just some basic std functions
<andrewrk> ah, the goal is to get the binary size down
<alexnask> Yes, I'm looking at writing some simple 4KB demo
<andrewrk> you can also consider running the final executable through upx
<alexnask> I'm planning on trying out packers, yes, I just want to see if I can get the standard tools people use with C++ running with zig
<alexnask> I think it will be good enough even without LLVM -Os
<andrewrk> yes in this case I recommend taking advantage of build-obj
<alexnask> I will try to contribute to that issue for the compiler though, sounds simple enough
<andrewrk> alexnask, it should be pretty straightforward. start with modifying https://github.com/zig-lang/zig/blob/master/src/zig_llvm.cpp#L103 and then add the command line options to propagate the option
<andrewrk> we'll probably want to figure out what clang sets OptLevel to for -Os as well
<alexnask> Will do
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub166> [zig] andrewrk pushed 1 new commit to master: https://git.io/vpvnY
<GitHub166> zig/master b936064 Andrew Kelley: add @atomicLoad builtin...
xkern has joined #zig
xkern has quit [Client Quit]
<andrewrk> alexnask, another possibly relevant issue: https://github.com/zig-lang/zig/issues/54
noonien has quit [Quit: Connection closed for inactivity]