ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
_dev_zero has quit [Ping timeout: 248 seconds]
_dev_zero has joined #zig
<pupp> hm, I'm getting "403 access denied" to default.css on ziglang.org
<pupp> so it's not supposed to be this white
<andrewrk> pupp, I moved the docs
<andrewrk> ziglang.org/documentation/master
<andrewrk> or ziglang.org/documentation/0.1.1 if you're using the release
<andrewrk> sorry for not doing it right the first time
<andrewrk> oh
<andrewrk> I see what's going on
<andrewrk> pupp, fixed. thanks for the report
<pupp> so what was it?
<andrewrk> forgot to also move the css/js when I moved the HTML docs
<pupp> tried this today https://luapower.com/winapi
<pupp> repl gets blocked when I start message loop
hasen_judy has joined #zig
hasen_judy has quit [Ping timeout: 252 seconds]
cenomla has quit [Quit: cenomla]
cenomla_ has joined #zig
PV_ has quit [Ping timeout: 260 seconds]
cenomla_ has quit [Quit: cenomla_]
cenomla_ has joined #zig
hasen_judy has joined #zig
hasen_judy has quit [Ping timeout: 252 seconds]
skooch has joined #zig
pupp has quit [Ping timeout: 255 seconds]
cenomla_ has quit [Quit: cenomla_]
lockdown has joined #zig
lockdown has quit [Quit: leaving]
hasen_judy has joined #zig
hasen_judy has quit [Ping timeout: 252 seconds]
tiehuis has joined #zig
_dev_zero has quit [Ping timeout: 248 seconds]
<Elronnd> I'm trying to compile on freebsd, and llvm/clang stuff isn't autodetected?
<Elronnd> what do I set CLANG_LIBRARIES and LLVM_LIBRARIES to? I tried /usr/local/llvm50/lib but I got complaints that I can't link to directories
<tiehuis> do you have llvm-config-5.0 available?
<Elronnd> no, but I have llvm-config50
<tiehuis> try adding llvm-config50 to the `NAMES` section in cmake/Findllvm.cmake
<Elronnd> now it's bitching about CLANG_LIBRARIES
<tiehuis> okay, clang doesn't have a config thing but just looks up where llvm is located
<tiehuis> is llvm located at '/usr/lib/llvm/5/'? or '/usr/lib/llvm-5.0/'?
<tiehuis> else you may need to add an extra path
<Elronnd> wait nvm I got it
<Elronnd> had to edit Findclang.cmake too but cmake isn't complaining anymore
<tiehuis> what were the edits you had to make, could add these to the actual script
<Elronnd> sure, one sec
arBmind has joined #zig
<tiehuis> are those clang path additions standard on freebsd?
<Elronnd> yes
<Elronnd> I just did pkg install llvm50, with no other modifications
<tiehuis> okay, i'll make a pull request with those, unless you want to?
<Elronnd> go ahead
<Elronnd> dafuq?
<Elronnd> "/usr/bin/ld: cannot find -lLLVMLTO"
<Elronnd> but there is a /usr/local/llvm50/lib/libLLVMLTO.a
<tiehuis> i don't know why it needs to pass '-lLLVMLTO' if you are static linking
<Elronnd> hmmm
<Elronnd> if I grep for LLVMLTO it's only present in a couple build cmake cache files
<Elronnd> yay, I hacked it up to build!
<tiehuis> awesome, what was the trick?
<Elronnd> just manually edited the linker script to add -L/usr/local/llvm50/lib
<tiehuis> that seems a bit of a hack, let me see what what my linker arguments are for a build
<Elronnd> oh, I also had to edit a couple of other things in the linker script. Apparently it thinks -l/usr/lib/libexecinfo.so is valid (it isn't). So I had to change that to -lexecinfo
<Elronnd> uh, what?
<Elronnd> TODO c type size in bits for this target
<Elronnd> zsh: abort (core dumped) ./zig build-exe test.zig
<Elronnd> promising...
<tiehuis> yeah, i don't think anyone actually has been building this on freebsd so there may be a few things that come up
<tiehuis> that particular change seems pretty straight-forward though
<tiehuis> i presume the sizes of the types are similar to linux so you could move one case label up to probably get around that
_dev_zero has joined #zig
<tiehuis> in 'src/target.cpp'
<Elronnd> well it shouldn't be dependent on the os, but rather the comipler
<Elronnd> which would be clang or gcc in both cases
<Elronnd> which case label?
<tiehuis> i presume this is for cross-compiling partly as well, not 100%
<tiehuis> line 500-ish
<Elronnd> oic
<tiehuis> in the function `target_c_type_size_in_bits`.
<Elronnd> ye I'll just say freebsd is linux
<Elronnd> yeI did that and now I get a bunch of errors about unsupported os
<Elronnd> (from stdlib, so compiler is actually compiling)
arBmind has quit [Quit: Leaving.]
<tiehuis> you should be able to compile simple things however even without the stdlib though?
<Elronnd> even for libc hello world, I get a bunch of errors
<tiehuis> mind posting what they are somewhere?
<tiehuis> whats the test program you are running?
<Elronnd> and I'm running it with ./zig build-exe test.zig
<tiehuis> you probably want to use `--library c` as an argument by the way
<tiehuis> also, not sure if this will work, but here is a simpler example that may give you something different: https://clbin.com/Tdt5F
<Elronnd> no dice
<tiehuis> think i'll spend some time this weekend seeing if i can get these initial hurdles solved a bit better
<tiehuis> since freebsd isn't too uncommon anyway and it should be quite similar to linux in a lot of cases
<Elronnd> ok
<Elronnd> gl!
<tiehuis> hopefully i can report back to you with some better news!
<Elronnd> (default clang installed is a really old version so you'll have to isntall a new one from package (or ports))
<tiehuis> okay, thanks will keep in mind.
winsoff has joined #zig
<winsoff> What's the big deal with zig
<Elronnd> it's like c but it sucks less
<Elronnd> it's the only lang (that I know of) that tries to be an alternative to c rather than an alternative to c++
<winsoff> Ah, that's kind of nifty.
<winsoff> So it's not high level?
<Elronnd> I wouldn't say that
<Elronnd> (bear in mind, I don't really know zig yet)
<tiehuis> its not specifically low-level, but it does target a lot of the use-case a low-level language needs to consider (like alignment, packed structures) etc
benq has joined #zig
<tiehuis> although it provides higher-level features than c, such as adts, nullable, iterators and error types
<Elronnd> I don't think that's necessarily relevant. C++ provides those things, as do most "c++ alternatives"
<tiehuis> sure, and they are still suitably low-level for many tasks vs. a language like Java
<Elronnd> my point is, that I don't think that presence of "low-level" features in a language is necessarily relevant to general useage of it
<Elronnd> c#, for instance, afaik supports low-level memory features, but I wouldn't want to write a kernel in it
<Elronnd> same for c++
<winsoff> So what's wrong with Rust?
hasen_judy has joined #zig
<Elronnd> it competes with c++ not c
<Elronnd> (also, nothing *wrong* with it)
<tiehuis> nothing really, i think it has a different niche personally
pupp has joined #zig
hasen_judy has quit [Ping timeout: 252 seconds]
winsoff has quit [Read error: Connection reset by peer]
winsoff_ has joined #zig
winsoff_ has quit [Changing host]
winsoff_ has joined #zig
eggy_ has joined #zig
eggy_ has quit [Client Quit]
tiehuis has quit [Quit: WeeChat 1.9.1]
benq has quit [Ping timeout: 248 seconds]
pupp has quit [Ping timeout: 240 seconds]
pupp has joined #zig
arBmind has joined #zig
hasen_judy has joined #zig
<hasen_judy> Congratulations on the first beta release
_dev_zero has quit [Ping timeout: 248 seconds]
hasen_ju_ has joined #zig
hasen_ju_ has quit [Ping timeout: 258 seconds]
_dev_zero has joined #zig
winsoff_ has quit [Quit: Leaving]
hasen_judy has quit [Quit: hasen_judy]
pupp has quit [Read error: Connection reset by peer]
pupp has joined #zig
arBmind1 has joined #zig
arBmind has quit [Ping timeout: 246 seconds]
<pupp> Wish somebody could write prettyprinter for gdb. For Buf type.
<pupp> it's definition is in src/buffer.hpp, and ZigList is in src/list.hpp
<pupp> struct Buf { ZigList<char> list; }
<pupp> *its
arBmind has joined #zig
cenomla has joined #zig
arBmind1 has quit [Ping timeout: 258 seconds]
hasen_judy has joined #zig
pupp has quit [Ping timeout: 240 seconds]
hasen_judy has quit [Remote host closed the connection]
pupp has joined #zig
hasen_judy has joined #zig
hoppetosse has joined #zig
hoppetosse has quit [Ping timeout: 255 seconds]
hasen_judy has quit [Remote host closed the connection]
pupp has quit [Ping timeout: 246 seconds]
_dev_zero has quit [Ping timeout: 248 seconds]
pupp has joined #zig
hasen_judy has joined #zig
hoppetosse has joined #zig
cenomla has quit [Quit: cenomla]
cenomla has joined #zig
cenomla has quit [Remote host closed the connection]
_dev_zero has joined #zig
hoppetosse has quit [Ping timeout: 240 seconds]
hoppetosse has joined #zig
pupp has quit [Read error: Connection reset by peer]
pupp has joined #zig
<andrewrk> pupp, it would be great if we could put something in the debug symbols to get that automatically
<andrewrk> Elronnd, I read the logs. Did you ever try this command? ./zig build-exe test.zig --library C
<andrewrk> sorry, lowercase c
<Elronnd> andrewrk: yes, I added --library c
<andrewrk> and the errors were the same as https://0x0.st/CCc.txt ?
<Elronnd> I never ran it without --library c
<Elronnd> ye same errors with and without
<andrewrk> there's code in the compiler that explicitly checks for `main` and doesn't add that bootstrap.zig file. so I'm confused how that got into the build
<andrewrk> your source code is exactly https://0x0.st/CCa.zig ?
<andrewrk> with `export` in front of fn?
<Elronnd> no, it's https://0x0.st/srsz.zig
hasen_judy has quit [Remote host closed the connection]
<andrewrk> Elronnd, aha so here's the deal, `pub` is making a zig function available outside the current file
<andrewrk> `export` is making a function available with the C ABI in the current object
<andrewrk> if you're integrating with libc, you need to make the object export `main`
<Elronnd> do I say -> %int, or -> int?
<andrewrk> look at example/hello_world/hello_libc.zig
<Elronnd> there are fewer errors now but they're the same type
<andrewrk> we don't have a way to use the error type in the C ABI
<andrewrk> can I see?
<andrewrk> hmm I think I know what's happening
<andrewrk> ok I'll give you the work around and then I'll fix it in master branch
<andrewrk> workaround is add this to your code:
<Elronnd> ...?
<andrewrk> pub fn panic(msg: []const u8) -> noreturn { @import("std").c.abort(); }
<andrewrk> the default panic implementation was doing OS-dependent stuff, but I'll update it to call libc functions if you are linking libc
<Elronnd> what's the difference between -> noreturn and -> %void?
<andrewrk> noreturn tells the compiler that control flow does not make it back to the caller
<andrewrk> %void says that you'll either return an error, or nothing
<Elronnd> almost!
<Elronnd> it compiles and links fine
<Elronnd> but when I run, I get ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2
<andrewrk> ahh I know what's going on
<andrewrk> do me a favor, create a normal hello world C file, and run ldd on it. it should tell us the appropriate path for the dynamic linker
<Elronnd> nope
<Elronnd> just prints out "libc.so.7 => /lib/libc.so.7 (0x800821000)"
<Elronnd> but whenI vim the file, I see "/libexec/ld-elf.so.1" near the top
<andrewrk> that must be it
<andrewrk> I think we can just check if we are targeting FreeBSD and hard code that value
<Elronnd> it works!
<andrewrk> Elronnd, great. you did all the work to get zig working (with libc) on freebsd
<Elronnd> now that it works, can all the 'os not supported' get removed from stdlib?
<andrewrk> those were not actually incorrect. whenever those compile errors were happening, we were trying to do something without libc that we would need to add freebsd syscalls for
<andrewrk> for example the panic implementation was trying to use linux syscalls to read the program exe and get a stack trace
<Elronnd> ah
<Elronnd> idea: can an alternate version of stdlib exist that depends on libc, for compatability purposes?
<andrewrk> I think we have that, and it is @import("std").c
<Elronnd> ah
<andrewrk> (some functions missing, but you can look at that file and see how to add more)
<andrewrk> or you can just import libc with .h files, and everything works except for really fancy #define macros
<Elronnd> ok
<andrewrk> Elronnd, for the panic implementation, however, I will add a check to see if you are linking libc, and on the OSes where you would get that error, we can call c.abort()
<Elronnd> ok
<Elronnd> how can the linker script be autofixed?
<andrewrk> oh yeah what was the deal with that?
<Elronnd> couple of things
<Elronnd> I had to add -L/path/to/llvm/libraries to it
<Elronnd> and there was a line, -l/usr/lib/libexecinfo.so.1, which I had to change to -lexecinfo
<andrewrk> for the first one, try adding to CMakeLists.txt link_directories(${LLVM_LIBDIRS})
<andrewrk> just after the include_directories(${LLVM_INCLUDE_DIRS})
<Elronnd> (should it also be for CLANG_LIBDIRS?
<andrewrk> second one sounds harder to fix. I'll be back later
<andrewrk> I don't think we have CLANG_LIBDIRS
<Elronnd> ok
<Elronnd> how do I run the unittests? 'make test' doesn't do anything
<Elronnd> https://0x0.st/srsQ.txt here's all my changes
<andrewrk> Elronnd: the readme has testing instructions
hoppetosse has quit [Ping timeout: 260 seconds]
<andrewrk> They're going to fail for you since we don't have freebsd support in the standard library
<andrewrk> If you're interested in contributing, this would be a big way to do that. You could follow the pattern set by linux
<Elronnd> ok
cenomla has joined #zig
<Elronnd> yeah it's not working
<Elronnd> const is_posix = builtin.os != builtin.Os.windows; since this is here, why am I getting errors where it checks if this is posix or windows and errors else?
xoxo has joined #zig
<Elronnd> hmmm. openSelfExe would require sysctl on freebsd. Is sysctl available in zig's stdlib?
hoppetosse has joined #zig
cenomla has quit [Quit: cenomla]
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
cenomla has joined #zig
cenomla has quit [Client Quit]
arBmind has quit [Quit: Leaving.]
hasen_judy has joined #zig
hoppetosse has quit [Ping timeout: 258 seconds]
hasen_judy has quit [Ping timeout: 252 seconds]
_dev_zero has quit [Ping timeout: 248 seconds]
_dev_zero has joined #zig
<andrewrk> Elronnd, sysctl is probably a freebsd syscall. it would behoove us to look at an open source freebsd libc implementation of sysctl and see what they do
<andrewrk> have a look at std/os/linux.zig
<andrewrk> we will likely have something similar for freebsd
hasen_judy has joined #zig
<Elronnd> andrewrk: *an* open source freebsd libc implementation?
<Elronnd> how about *the* freebsd libc?
<andrewrk> Elronnd, my mistake :)
<Elronnd> (I mean, I think there are other libcs that support fbsd, but easiest is probably the official one since it just has top support fbsd instead of having workarounds for different OSes)
<Elronnd> anyway, I searched for 'freebsd syscall table' and found http://fxr.watson.org/fxr/source/kern/syscalls.master and https://github.com/freebsd/freebsd/blob/master/sys/kern/syscalls.master which are probably already more than enough
<andrewrk> yeah. the freebsd libc will know how to make syscalls
<andrewrk> I imagine it is quite similar to linux, but with different numbers
hasen_judy has quit [Ping timeout: 252 seconds]
xoxo has quit [Ping timeout: 260 seconds]
xoxo has joined #zig
arBmind has joined #zig
xoxo has quit [Ping timeout: 260 seconds]
pupp has quit [Ping timeout: 240 seconds]
<Elronnd> ye probably
hasen_judy has joined #zig
hasen_judy has quit [Ping timeout: 252 seconds]
drakonis has joined #zig
<drakonis> hello dev man andrewrk, what's zig's inspirations besides C?
<andrewrk> zig's goal is to help programmers create robust, optimal, maintainable software together
<Elronnd> drakonis: there is some from go and rust
<drakonis> hmm, i see.
<Elronnd> I mean, every language is influenced by everything that came before it
<drakonis> yes
<Elronnd> so probably ever language that andrewrk has ever used has influenced zig in some way
<drakonis> so its like this complex web of languages :v
<andrewrk> yes
<drakonis> its probably a long list of inspirations
<Elronnd> andrewrk: now I'm curious, what languages did you learn/know before you made zig?
<drakonis> same
<drakonis> i'm interested in writing some zig code because it is compatible with C
<drakonis> probably never C++ yeah?
<drakonis> though not C++ because its a horrible monster?
<Elronnd> official (and only) zig implementation is in c++...
<Elronnd> (but yes I agree c++ is a horrible monster)
<drakonis> i mean
<drakonis> no C++ compatibility because it is too complex?
<Elronnd> oh
<Elronnd> it can't be *that* complex
<Elronnd> D has it
<Elronnd> (of course, zig maybe can't use c++ libraries because they have classes and namespaces)
<drakonis> D also has adoption in the gaming industry to a certain degree
<drakonis> naughty dog used it
<Elronnd> kinda
<Elronnd> but people mostly use pure-d libraries or c libraries
<drakonis> a pure d library
<drakonis> yes
<andrewrk> Elronnd, vb6, perl, javascript, action-script, C, C++, java, python, ruby, vb.net, c#, scheme, ti-basic, lua, bash, go, rust
<drakonis> now that's a lot of languages!
<Elronnd> wow
<drakonis> that's more than me i guess
cenomla has joined #zig
arBmind has quit [Quit: Leaving.]
cenomla has quit [Quit: cenomla]
cenomla has joined #zig