<jzelinskie>
since zig has comptime, why don't people use it to discover all the C files when they're writing build.zig files that call `lib.addCSourceFile`?
<Nypsie>
I've seen people do that ;)
<jzelinskie>
ah good, I was afraid there was maybe a reason you can't because I've only seen build files with huge lists of source files
<ifreund>
that wouldn't use comptime... just normal code run in the build.zig
<ifreund>
and there are very good reasons to explicitly list all the source files instead, infact I'd recommend this
<jzelinskie>
yeah good point -- it isn't comptime
<ifreund>
meson forces this for example
<jzelinskie>
is there a doc for meson that covers the subject well?
<jzelinskie>
the section actually sounds like an argument to actually make it use comptime though 🤣
<jzelinskie>
that section*
<jzelinskie>
but yeah, being explicit seems fine
<ifreund>
you can't make syscalls at comptime
<jzelinskie>
ah, well that settles that ;)
kenran has quit [Quit: leaving]
eyepatchOwl_ has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
zenkuro has quit [Ping timeout: 240 seconds]
zenkuro has joined #zig
<andrewrk>
to be clear, build.zig runs at runtime
<andrewrk>
but that might be a bit counter intuitive, since it runs before compiling your code
<jzelinskie>
yeah, it makes sense if you think of it as a separate build tool
<jzelinskie>
which it is or else it'd be some crazy JIT thing
<andrewrk>
ifreund, I want to make the default to use zig-provided libc (not try to detect native libc) when compiling natively and not linking any native system libs
<jzelinskie>
I'm currently deep in the automake/autotools weeds
<g-w1>
* repl: if you try `run` with -ofmt=c you get an access denied error because it tries to execute the .c file as a child process instead of executing `zig run` on it. <- andrewrk do you want `zig run file.zig -ofmt=c` to work, or only `run` in the repl to work for c files?
<andrewrk>
jzelinskie, I've found sometimes the best strategy is to just guess rather than try to read all that horrible stuff
<jzelinskie>
yeah, I just want to see the final generated makefile
<andrewrk>
ah right yeah that's useful. also useful is running a real build with `make VERBOSE=1` and looking at the output
Akuli has joined #zig
<ifreund>
andrewrk: I'm fine with that in theory, but don't know how you would implement that
<g-w1>
yay! now i won't need gcc for zig
<ifreund>
how does the compiler know where a given library comes from? I guess the user has to tell it somehow
<jzelinskie>
holy shit yeah... running make with verbose is what I want not to read this mess
<jzelinskie>
I'm always afraid to run makefiles because I don't know if they're going to `make install` and just start dumping/overwriting shit to my system
<jzelinskie>
I should've just done this in docker :\
<jzelinskie>
the `make VERBOSE=1` isn't quite as useful as I'd like because this project using libtool
tefter has quit [Ping timeout: 245 seconds]
tefter has joined #zig
<andrewrk>
ifreund, if you pass -lfoo and it's not one of the known libc libs, then it assumes system provided. otherwise, assumes no system dependencies
<andrewrk>
this is already the case for whether to run native system include / library directories
<ifreund>
ok, and if the user is providing their own shared objects they can just put them on the command line like `zig build-exe -l main.zig foo.so` and we would use the zig-provided libc?
<jzelinskie>
are .inc files autotools? it looks like jq stuffs the builtin jq expressions (defined in JQ's expression language) into an object file using whatever tool uses .inc
<ifreund>
oops, that should be -lc not -l
<jzelinskie>
nvm, it's actually just using the preprocessor to include it
<jzelinskie>
is the zig builder ordered in anyway? for example, do I need to specify that I'm linking to libc before I add my C source files?
<g-w1>
i don't think so
<g-w1>
b.exec is ordered tho ofc
<nerthus>
to be a bit of a bikeshedder, in the "how to build LLVM" part of the docs, there is the ~/local suggestion but wouldnt ~/.local be better to respect XDG spec?
<andrewrk>
jzelinskie, sometimes C code uses .inc instead of .c when #including stuff
<andrewrk>
ifreund, that sounds about right
<jzelinskie>
what is PIC when it comes to linking? When I was reading about libtool it talks about it and build.zig for redis forces it on
<jzelinskie>
I feel like I can never effectively google this stuff because the words overlap with too many other things
eyepatchOwl_ has quit [Quit: Connection closed for inactivity]
<andrewrk>
Position Independent Code. you need it when making a static library but know that it will eventually be linked into a shared library
<betawaffle>
jzelinskie: pic can’t use any absolute addresses.
<betawaffle>
Like for jumps, globals, etc
pretty_d1 has joined #zig
pretty_dumm_guy has quit [Ping timeout: 265 seconds]
earnestly has quit [Ping timeout: 245 seconds]
pretty_d1 has quit [Quit: WeeChat 3.2-dev]
pretty_dumm_guy has joined #zig
earnestly has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
notzmv has quit [Ping timeout: 240 seconds]
mokafolio has quit [Ping timeout: 250 seconds]
notzmv has joined #zig
<jzelinskie>
what's the difference between `.linkLibC()` and `.linkSystemLibrary("c")`? is one not using the zig distributed libc?
v0idify has left #zig [#zig]
<ifreund>
jzelinskie: there is no difference
<jzelinskie>
hmm, I'm not really sure how I should include this `.inc` file, as it `.addCSourceFile()` hates the extension
<ifreund>
what is in the file?
<ifreund>
.inc isn't some standard C thing unless I'm very mistaken
<jzelinskie>
it's a bunch of strings that get #included in another c source file
<ifreund>
yes, but all you need to do is make sure it's in the include path
<ifreund>
it will then get pulled in when you're compiling the c file that includes it
<jzelinskie>
I guess I should use `.addIncludeDir()`then rather than specifying each include file individually?
<ifreund>
yes, addIncludeDir() for the directory with your headers
<ifreund>
and addCSource() for the .c files
<jzelinskie>
`fatal error: 'src/builtin.inc' file not found` :\
<jzelinskie>
the src directory has both the headers and the source files
<ifreund>
does it have the builtin.inc file too?
<jzelinskie>
yep, everything is in src
<ifreund>
and did you add "." as an include directory
<jzelinskie>
I did "src"
<ifreund>
that include statement uses the path src/builtin.inc, which is realtive to the include directory
<ifreund>
which means src won't work
<ifreund>
because there is no src/src/builtin.inc
<jzelinskie>
ah yeah duh
<jzelinskie>
that fixed it, damn thanks
<ifreund>
no problem!
<jzelinskie>
it looks like it's using my system's macos libc and not the target that's shipped with zig, do I have to specify that?
<jzelinskie>
error(compilation): clang failed with stderr: /Users/jzelinskie/Code/oss/jq/src/builtin.c:1368:14: error: static declaration of 'strptime' follows non-static declaration
<jzelinskie>
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/time.h:117:7: note: previous declaration is here
<jzelinskie>
I'm getting quite a few errors from preprocessor macros that are evaluating as if I'm missing things
<ifreund>
using native-native-gnu as the target will make it use the libc zig ships
mokafolio has joined #zig
<jzelinskie>
I figured that'd be the case with `const target = b.standardTargetOptions(.{});`
<jzelinskie>
ah, i'm never setting the target
<ifreund>
this default will be changed back to using the libc zig ships when not linking system libs soon
<ifreund>
as andrewrk and I were just discussing above :D
novakane has quit [Quit: WeeChat 3.1]
<jzelinskie>
👍
_aaron_ has joined #zig
zenkuro has quit [Ping timeout: 240 seconds]
zenkuro has joined #zig
klltkr has joined #zig
Akuli has quit [Quit: Leaving]
hiljusti has joined #zig
notzmv has quit [Read error: Connection reset by peer]
Kingreil has joined #zig
notzmv has joined #zig
leon-p has quit [Quit: leaving]
mpli98 has joined #zig
mpli98 has quit [Client Quit]
mpli has joined #zig
mpli has quit [Client Quit]
cole-h has joined #zig
mpli has joined #zig
<mpli>
hey folks, my friend tried joining this channel for the first time and received a ban for some unknown reason. Can someone explain what happened? (his username is Mysoft)
<jamii>
Is this a bug or am I just totally misunderstanding how suspend works?
Bad_K4rMa has joined #zig
Bad_K4rMa has left #zig [#zig]
nathanael has quit [Remote host closed the connection]
nathanael has joined #zig
<ifreund>
mpli: could be that his username is matched by some wildcard ban targeting some past trouble maker, I believe andrewrk is currently the only op here
<mpli>
weird, he is pretty chill
<mpli>
and he says he didnt get any bans before
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mpli>
I reached out to andrew, thanks for the help ifreund
<fengb>
jamii: b_frame implicitly awaits on a's result. You'll need to manually resume a, which isn't actually set anywhere