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/
omglasers2 has quit [Read error: Connection reset by peer]
<Ondingen> and I don't have access to the code, it wasn't released with the quake source
<Ondingen> "lib\std\start.zig:289:45: error: root source file has no member called 'main'
<Ondingen> is the error I get when using const exe = b.addExecutable("win", "ubsan-test/src/segfault_handler.zig");
<andrewrk> hmm let me check something
<andrewrk> well anyway you can make the object in build.zig
<andrewrk> const obj = b.addObject("segfault_handler", "ubsan-test/src/segfault_handler.zig"); obj.setTarget(target); exe.addObject(obj);
ryuukk_ has joined #zig
<andrewrk> I still don't understand the default libc thing - zig won't link libc unless you explicitly ask for it
<andrewrk> so you should be OK
<Ondingen> ah, I missed setting the target on obj
a_chou has quit [Ping timeout: 260 seconds]
<andrewrk> yeah, that's a flaw in the API design I think - it could detect and warn you about it
<andrewrk> this build stuff is all still under construction
xackus has quit [Ping timeout: 272 seconds]
<andrewrk> what problem do you get without safeseh:no?
<Ondingen> lld: error: /safeseh: vga.obj is not compatible with SEH
<andrewrk> if this is an important linker option it would be good to get upstream support for it because we will want to be aware of it for the self-hosted linker for fast debug builds
<Ondingen> with -safeseh:no and without -nodefaultlib:libc I get "lld: error: could not open 'LIBC.lib': no such file or directory"
<andrewrk> hmm and why is LIBC.lib ending up on the linker line?
<andrewrk> zig doesn't put that there
<Ondingen> because of the -defaultlib:libc from MGLLT.lib
<andrewrk> if MGLLT.LIB has a reference to it, why isn't it needed?
<andrewrk> is that just a quirk of quake?
<ky0ko> oh interesting, am i not the only person working on a zig port of quake
<Ondingen> It think is needed, just not both libc and libcmt/msvcrt? It's a super old library with software rendering routines
<Ondingen> ky0ko cool!
<ky0ko> i had to disable ubsan for the whole project, the code is just absolutely littered with undefined behavior and i'm just tackling it as i rewrite
<andrewrk> ah yeah I forgot to mention that option
<andrewrk> even zig has to disable UBSAN for some of the libc code it builds from source
<andrewrk> I think it's the right call to have on by default, it's forcing people to be aware of how much UB is going (so far) unnoticed
<andrewrk> but yeah no shame in disabling it for 3rd party code to make your project work
frmdstryr has joined #zig
<Ondingen> How is that done? I figured I might have to do that but I haven't looked into how to do it yet. It's been a lot of hours just to get to this point, haha.
<ky0ko> pass the `-fno-sanitize=undefined` and `-fno-sanitize-trap=undefined` to all your c objects
<ky0ko> at least, that's what i'm doing in my build.zig and it's working
<Ondingen> thanks!
<ky0ko> and yeah, andrewrk, i agree that ubsan on by default is the right call here
<Ondingen> there's also .disable_sanitize_c in LibExeObjStep, but there doesn't seem to be a way to set it? NVM, forgot that there's no encapsulation. exe.disable_sanitize_c = true; works ky0ko
<ky0ko> thanks, though i'll probably just leave it as it is for now as my build.zig is currently a house of cards due to the shenanigans i've had to pull to make the c and zig bits cooperate at this stage
<ky0ko> need to have more of the zig code running the show so i can refactor it a bit nicer
<Ondingen> ky0ko, I sent you a private mssage
<andrewrk> friendship is magic 🌈
ur5us has joined #zig
xd1le has quit [Remote host closed the connection]
dutchie has quit [Ping timeout: 258 seconds]
dutchie has joined #zig
traviss has quit [Remote host closed the connection]
a_chou has joined #zig
xd1le has joined #zig
<ryuukk_> is there a way to tell the compiler to search in specific folder for zig files?
<andrewrk> --override-lib-dir [path] Override path to Zig installation lib directory
<andrewrk> by default it looks relative to the executable. multiple installations should be fine
<ryuukk_> is it possible to set that in the build.zig file?
<Ondingen> exe.overrideZigLibDir(...)
<ryuukk_> thanks i will try that
<andrewrk> zig build supports the same option
<andrewrk> you can't specify it in your build.zig because `zig build` depends on that value
<andrewrk> why do you need this option though?
<ryuukk_> i have a sample directory, and i would like the files there to be able to import the engine files without having to do stuff like "../../engine/file.zig"
<ryuukk_> 4am and i forgot english term of most things sorry if i don't make sense xD
<andrewrk> ok I'm glad I asked because --override-lib-dir is irrelevant to this use case
<ryuukk_> yes i should have started by the usecase my bad
<ryuukk_> closest i found is addPackagePath
<ryuukk_> but i need to manually import everything into a dedicated file
<andrewrk> yes that's right - this lets you map an arbitrary string so you can do @import("foo")
<andrewrk> I think it's not so bad, here's the std lib doing this pattern: https://github.com/ziglang/zig/blob/master/lib/std/std.zig
a_chou has quit [Quit: a_chou]
<ryuukk_> ohh right, yeah that's nice, it lets me choose what people have access to, so i can exclude internal stuff
<ryuukk_> i'll try do that then
<ryuukk_> thanks
<andrewrk> np
<ryuukk_> it's been few days i am using zig, i am hooked, nice job on the language, i never thought i'd stick this long with a language with manual memory management, but with this one it feels super nice
<andrewrk> :)
ur5us has quit [Ping timeout: 260 seconds]
mschwaig has joined #zig
ur5us has joined #zig
oats is now known as wheats
wheats is now known as oats
msingle has joined #zig
msingle has quit [Ping timeout: 240 seconds]
<daurnimator> andrewrk: heh; I'm trying to get to the json prs today
<daurnimator> btw, just tested compilation against llvm 11 on arch; all seems good for the release
<andrewrk> nice
mschwaig has quit [Quit: WeeChat 2.7.1]
<daurnimator> uh wait; I lied on the packaging
<daurnimator> the self-hosted component seems to get built again in the `install` step
<andrewrk> that is undesired but expected
<pixelherodev> why's that?
<andrewrk> it's cmake not letting us express the dependency
<daurnimator> its more than undesired.... its unacceptable as an install step
<pixelherodev> `add_custom_dependency` or something?
<andrewrk> idk why there is a separate make and install step. just do the install step only
<pixelherodev> That's not possible, for Gentoo at least
<pixelherodev> Build and install are completely distinct
<andrewrk> isn't it doing it into a build root anyway?
<daurnimator> its not allowed for *any* distro I know if
<daurnimator> *of
<pixelherodev> It does QA checks and such on the compilation step IIRC
<andrewrk> yeah I'm not going to win this argument, everyone does the `make && make install` but I am right about it being dumb
<pixelherodev> andrewrk: the big reason I don't do it is permissions
<pixelherodev> `doas ninja install` results in ninja files being owned by root
<daurnimator> ^ `make && sudo make install`
<pixelherodev> and thus `ninja` fails
<andrewrk> you shouldn't be running make or ninja with root
<daurnimator> importantly you never invoke the compiler as root
<daurnimator> `make install` needs to run as root... otherwise how would you install to /usr ?
<andrewrk> you shouldn't install to /usr, your package manager should do that
<pixelherodev> With Gentoo, it installs to /var/tmp/portage/work/blah, and then copies it into place
<daurnimator> I *am* the package manager
<pixelherodev> But I'm talking normal builds
<pixelherodev> Yeah
<pixelherodev> This is more of an issue for normal users than for package managers
<andrewrk> so aren't you installing to a package manager prefix, rather than your global system?
<pixelherodev> Only if you're using a package manager
<daurnimator> that's optional
<andrewrk> no if you are the package maintainer, you are installing to some prefix, which then gets compiled into the package
<daurnimator> yes the prefix gets compiled in; and also we use DESTDIR
<andrewrk> anyway I recognize the need for upstream zig to not invoke the compiler on the install step. do you know how to fix the cmake file?
<pixelherodev> Switching the build system to not use CMake?
<pixelherodev> :P
<pixelherodev> My solution to cmake bugs is, typically, to ditch cmake
<daurnimator> pixelherodev: though I agree with you; that's obviously not going to work here
<andrewrk> that is an option, but it introduces problems as well such as how to build on windows
<pixelherodev> My answer to that wouldn't be well liked either ;)
<andrewrk> we could change to use add_custom_command but then it has the problem that it won't rebuild zig1.o when it should
<daurnimator> > Using DEPFILE with other generators than Ninja is an error.
<daurnimator> :(
<daurnimator> andrewrk: you mean it doesn't know about .zig files changing?
<andrewrk> right
<daurnimator> andrewrk: should be able to list every .zig file in DEPENDS ?
<andrewrk> that might be an OK compromise. it would be everything in src/* and then also some files from the std lib
<daurnimator> even if it was the entire std library.... so be it
<andrewrk> yeah I see your point. alright, will have that done by the release
<andrewrk> I'm still right about make install tho :P
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
<daurnimator> andrewrk: need me to make an issue for it?
<andrewrk> sure
<kandinski> quick question, because I'm looking at some Zig code that doesn't compile under 0.6 and one of the syntax quirks it uses is the syntax c"foo" for a c-type string in calling a C library. What's the new c-string literal I should be using?
<pixelherodev> There isn't one
<pixelherodev> Just use a string normally
<pixelherodev> Ah wait
<pixelherodev> You mean from Zig to C, right?
<kandinski> also, what's a good small project that I can crib from which is updated to 0.6?
<pixelherodev> If you want to pass a literal, I think it'll "just work"
<kandinski> pixelherodev: yes, calling a C library from Zig code.
<kandinski> pixelherodev: thanks
<pixelherodev> For slices, you want to use the pointer
<kandinski> ta
ur5us has quit [Ping timeout: 240 seconds]
lltt has quit [Remote host closed the connection]
lltt has joined #zig
pfg_ has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
pfg_ has quit [Quit: Leaving]
xd1le has quit [Ping timeout: 240 seconds]
xd1le has joined #zig
kristoff_it1 has joined #zig
cole-h has joined #zig
frett27 has quit [Ping timeout: 272 seconds]
<kandinski> I'd appreciate some help with this: https://termbin.com/jc9f I can't @cImport readline, and I think I'm doing everything right but I'm new to both zig and C so there could be something I'm missing.
<kandinski> I'm on NixOS but I just went through Nathan Michaels' tutorial on wrapping libsodium and everything worked, so I tried to do the same thing with readline. My paste again: https://termbin.com/jc9f
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
xd1le has quit [Remote host closed the connection]
xd1le has joined #zig
ask6155 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
earnestly has joined #zig
ask6155 has left #zig [#zig]
ur5us has joined #zig
ryuukk_ has quit [Ping timeout: 272 seconds]
squiddy has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
DarkUranium has quit [Read error: Connection reset by peer]
DarkUranium has joined #zig
DarkUranium has quit [Read error: Connection reset by peer]
DarkUranium has joined #zig
DarkUranium has quit [Read error: Connection reset by peer]
DarkUranium has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
mschwaig has joined #zig
mschwaig has quit [Quit: WeeChat 2.7.1]
mschwaig has joined #zig
wootehfoot has joined #zig
msingle has joined #zig
mschwaig has quit [Quit: WeeChat 2.7.1]
mschwaig has joined #zig
skuzzymiglet has joined #zig
skuzzymiglet has quit [Client Quit]
skuzzymiglet has joined #zig
mschwaig has quit [Quit: WeeChat 2.7.1]
mschwaig has joined #zig
skuzzymiglet has quit [Quit: WeeChat 2.9]
skuzzymiglet has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
yunree is now known as nyaayaya
Kingsquee has quit []
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
ask6155 has joined #zig
skuzzymiglet has quit [Ping timeout: 246 seconds]
ask6155 has left #zig [#zig]
osa1 has joined #zig
msingle has quit [Ping timeout: 256 seconds]
ask6155 has joined #zig
<nyaayaya> Hello!
<nyaayaya> https://github.com/ziglang/zig/blob/master/src/main.zig#L282-L284 - "Compile to C source code" (-ofmt=c)
<nyaayaya> Is this feature WIP? Because on FreeBSD 12.1 it fails with "Address boundary error"/"Segmentation fault (core cumped)" [fish/bash] :(
<ikskuh> the C backend is for stage2 only, i think pixelherodev can tell more about it
riba has joined #zig
<nyaayaya> oh, ookie. Got a bit confused when it showed up in `zig build-exe --help`. Thankie ^^
<ikskuh> heh. still gonna be awesome as soon as it works :)
marnix has quit [Ping timeout: 260 seconds]
marnix has joined #zig
frmdstryr has quit [Ping timeout: 256 seconds]
skuzzymiglet has joined #zig
marnix has quit [Ping timeout: 260 seconds]
cole-h has joined #zig
ask6155 has left #zig [#zig]
riba has quit [Ping timeout: 265 seconds]
skuzzymiglet has quit [Ping timeout: 256 seconds]
endragor has joined #zig
xd1le has quit [Remote host closed the connection]
xackus has joined #zig
cole-h has quit [Ping timeout: 258 seconds]
xd1le has joined #zig
supercoven has joined #zig
supercoven has quit [Max SendQ exceeded]
supercoven has joined #zig
Akuli has joined #zig
ryuukk_ has joined #zig
osa1 has quit [Remote host closed the connection]
frmdstryr has joined #zig
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
ryuukk__ has joined #zig
msingle has joined #zig
ryuukk_ has quit [Ping timeout: 260 seconds]
wootehfoot has quit [Ping timeout: 260 seconds]
moo has quit [Ping timeout: 260 seconds]
msingle has quit [Ping timeout: 240 seconds]
wootehfoot has joined #zig
moo has joined #zig
squiddy has quit [Remote host closed the connection]
moo has quit [Ping timeout: 256 seconds]
wootehfoot has quit [Ping timeout: 256 seconds]
frmdstryr has quit [Ping timeout: 260 seconds]
pfg_ has joined #zig
omglasers2 has joined #zig
m4r35n357 has quit [Quit: Ex-Chat]
waleee-cl has joined #zig
_Vi has joined #zig
_Vi has quit [Client Quit]
Snetry has quit [Ping timeout: 260 seconds]
Snetry has joined #zig
Snetry has quit [Ping timeout: 258 seconds]
pfg_ has quit [Quit: Leaving]
Snetry has joined #zig
msingle has joined #zig
msingle has quit [Ping timeout: 272 seconds]
lltt has quit [Ping timeout: 260 seconds]
cole-h has joined #zig
rain1 has quit [Quit: Leaving]
baddecaf has joined #zig
baddecaf has quit [Remote host closed the connection]
moo has joined #zig
wootehfoot has joined #zig
u0jQx9gPyrYg has quit [Ping timeout: 272 seconds]
hnOsmium0001 has joined #zig
msingle has joined #zig
squeek502 has joined #zig
slice has joined #zig
<ryuukk__> got the triangle working, yay https://i.imgur.com/Kstgll1.png
<slice> just wanted to pop in and say that i got windows cross compile working on the bigsur branch, although i had to edit start.zig a lil
<slice> pretty amazing work
<ikskuh> uh neat :)
metabulation has joined #zig
wootehfoot has quit [Ping timeout: 240 seconds]
moo has quit [Ping timeout: 240 seconds]
wootehfoot has joined #zig
frmdstryr has joined #zig
slice has quit [Quit: zzz]
lltt has joined #zig
ur5us has joined #zig
johnburton has joined #zig
cole-h has quit [Ping timeout: 256 seconds]
tobiasrox has joined #zig
frmdstryr has quit [Ping timeout: 260 seconds]
<g-w1> I am having trouble with @cImport("hpdf.h"); I want to use libharu but this happens: https://i.imgur.com/qclDEZW.png
<earnestly> Does zig need to be told to look in /usr/include?
<g-w1> i dont think
<g-w1> huh it works!
<g-w1> thanks
<ifreund> It's always found stuff in /usr/include for me..
<ifreund> you do need to link with the library though for the header to be found
<ikskuh> earnestly: yes, you need to tell zig to search in /usr/include
<earnestly> til
<ifreund> ikskuh: I don't and river builds just fine
metabulation has quit [Read error: Connection reset by peer]
wootehfoot has quit [Read error: Connection reset by peer]
<ifreund> it even finds wlroots headers in ~/.local/include by checkind LD_LIBRARY_PATH i assume
<ikskuh> ifreund: do you link anything with linkSystemLibrary? ;)
<ifreund> yes
<ikskuh> this tells to link /usr/include ;)
<ikskuh> if you don't, zig won't search /usr/include (for example linkSystemLibraryName)
<ifreund> ah ok
<g-w1> its fine. it works
riba has joined #zig
xd1le has quit [Quit: Quit]
slice has joined #zig
slice has quit [Client Quit]
slice has joined #zig
<g-w1> does anyone know of any good pdf libraries for zig (c will work ofc). libharu is unmaintained and seems like it is broken
tobiasrox has quit [Remote host closed the connection]
slice has quit [Quit: zzz]
<g-w1> or ill just impliment the pdf standard. :) I have a very limited use case, so it may be easy. (im trying to made a pdf code reader with links to goto definition, etc)
<ifreund> i'd probably just generate something simpler and pass it through pandoc
Akuli has quit [Quit: Leaving]
<g-w1> yeah i did that but it took like 20 minutes. im thinking about something that will be really fast for 100,000's of lines codebases. i prefer reading stuff in pdf format so i would like an efficient way to convert it. this is nice https://github.com/cs50/render50 but it causes a memory leak for large codebases. it will be a fun project to read the pdf spec and impliment it :P
<g-w1> this article seems like a good erference https://www.printmyfolders.com/understanding-pdf
_whitelogger has joined #zig
msingle has quit [Ping timeout: 260 seconds]
<earnestly> I mean, mupdf
<earnestly> But "good", idk
<g-w1> oh i forgot abt that. ill check it out
<g-w1> it seems it is only for reading/viewing pdf files but thanks
riba has quit [Ping timeout: 240 seconds]
<earnestly> g-w1: No it's a library
<g-w1> yeah. if i read it correctly the library is only for reading,not writing
<g-w1> oh wait it can render files, thanks!
<earnestly> https://www.mupdf.com/docs/api/io.html - I imagine without this it wouldn't have the ability to provide such functionality via it's mutool
<earnestly> But I don't know much about it, there's also poppler
<g-w1> ok
<g-w1> ill do some research
omglasers2 has quit [Read error: Connection reset by peer]
lltt has quit [Remote host closed the connection]
supercoven has quit [Ping timeout: 260 seconds]
xackus has quit [Ping timeout: 258 seconds]
frmdstryr has joined #zig
xackus has joined #zig
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
ryuukk_ has joined #zig
ryuukk__ has quit [Read error: Connection reset by peer]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<ryuukk_> https://hastebin.com/ewozifezer.zig i thought this would only compile the specific exe if i type for example: "zig build cube", but it creates exe for all samples, what i am doing wrong?
msingle has joined #zig
<ryuukk_> looks like hastebin refuses to save my pastes, a new link in case it doesn't work for you https://gist.github.com/ryuukk/3c7ed22c96e5ed5dadad0b7f62e102aa
earnestly has quit [Ping timeout: 260 seconds]
hnOsmium0001 has joined #zig