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/
<v0idifyy> is there a @fieldParentPtr for union(enum)?
<andrewrk> v0idifyy, planned but not implemented
earnestly has quit [Ping timeout: 252 seconds]
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
selby has joined #zig
gpanders has joined #zig
earnestly has joined #zig
selby has quit [Quit: My MacBook has gone to sleep.]
earnestly has quit [Ping timeout: 268 seconds]
<g-w1> is there a way to make this work?
<andrewrk> llvm12 builds are up on the download page
<andrewrk> https link please, otherwise my ISP MITM attacks me: https://clbin.com/5M2BI
<g-w1> oof, sorry about that
<g-w1> it seems like the function is called in a comptime context which kinda makes sense
<g-w1> but also doesn't at the same time
<g-w1> i feel like functions that return types shouldn't automatically be comptime
<andrewrk> you're trying to store 0x01 in the address 0x01 at compile time
<g-w1> yes, that is an example to show that it is not runtime
<andrewrk> did you mean to return a struct instance and not the struct type?
<g-w1> basically, make a struct and init it at the same time
<g-w1> nah, this is for embedded stuff
<g-w1> actually that might work
nvmd has quit [Quit: Later nerds.]
<v0idifyy> why is there readUntilDelimiterAlloc and readUntilDelimiterOrEof but no readUntilDelimiter?
<g-w1> i was thinking that exact same thing a few days ago!
<hspak> Possible the problem is PEBKAC, but the latest master zig tarball seems to be missing `std.mem.containsAtLeast` somehow? I'm seeing: https://zigbin.io/9887a6
<g-w1> what is PEBKAC?
<hspak> > Short for problem exists between keyboard and chair
<hspak> Basically I'm the fool :D
<hspak> Hmm I wonder what I've done wrong here
<g-w1> you probably messed up your lib dir
<hspak> Ah yup, you're right. Problem was definitely me - I probably didn't realize I already had a ~/zig dir and when I extracted the new tarball there, some lingering over files that didn't get overwritten probably messed it up
<hspak> All good now!
<g-w1> imo zig should be better at detecting stuff like this
<g-w1> maybe it should put a file with its version in the lib dir, then check if its version matches it?
<g-w1> ah, this wouldn't solve it anyways
yxprogramming has joined #zig
<yxprogramming> hello, everyone! I recently started a project that requires linking a static library to the final project. Using linkSystemLibrary doesn't work because that appears to look for system libraries rather than relative paths from the project directory. I looked through the LibExeObjStep and didn't notice anything that could accomplish this. Does anyone know a way to do this? Thanks in advance!
<g-w1> exe.addObjectFile iirc
<yxprogramming> okay, thank you, that seems to have done the trick! I saw that function browing through the source earlier, but didn't make the connection
jicksaw has quit [Quit: ZNC is kill]
jicksaw has joined #zig
xackus has joined #zig
selby has joined #zig
yxprogramming has quit [Quit: leaving]
selby has quit [Quit: My MacBook has gone to sleep.]
selby has joined #zig
selby has quit [Quit: My MacBook has gone to sleep.]
selby has joined #zig
selby has quit [Client Quit]
leon-p has joined #zig
a_chou has joined #zig
aerona has quit [Quit: Leaving]
nkoz has quit [Remote host closed the connection]
a_chou has quit [Quit: a_chou]
a_chou has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
Stephie has quit [Ping timeout: 260 seconds]
Stephanie has joined #zig
ur5us_ has quit [Ping timeout: 240 seconds]
selby has joined #zig
<wilsonk> anybody else having trouble building llvm-12? I have followed the same procedure as the last 90-ish times I have built it, but now I get this error: "llvm-12.0.0.src/tools/lld-12.0.0.src/MachO/UnwindInfoSection.h:15:10: fatal error: mach-o/compact_unwind_encoding.h' file not found"
<wilsonk> Anybody else?
<wilsonk> I grabbed libunwind and unpacked it in the runtimes dir, since that file seems to be libunwind specific...no joy
a_chou has quit [Remote host closed the connection]
osa1 has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 260 seconds]
<wilsonk> Thankfully I have this 64-core system that only takes 9 mins to build LLVM/clang/lld or I would be even more pissed! Can't imagine waiting 3 hours only to find out LLVM can't get their shit together enough to guarantee a build for a new release!! So anyways...
<mikdusan> known issue with lld
<mikdusan> one sec
<wilsonk> I got it figured out...
<wilsonk> if you copy over the Unwind file from runtimes/libunwind/include/mach-o to the lld include directory (make a mach-o subdir first) then things build fine
<wilsonk> Shouldn't they be able to fix this in a tenth of a second over there instead of pissing off VERY long time users!?!??!?! UGH
<wilsonk> It's not like I am on an exotic system or doing anything even remotely out of the ordinary... rant over!
<wilsonk> mikdusan, did you happen to find an issue for this? Or something in a search? I couldn't find any info on this silliness
<mikdusan> it's labeled against a standalone build of lld. so I'm not sure why people are hitting the bug. I managed to build llvm12 "my way" without issue (llvm-project, and subprojects of choice all at once)
<mikdusan> I know andrew hit it (I think with zig-bootstrap) but that does a lot more things. like disables some LLVM tools during build. might be key that "llvm-config" is not built in one of it's stages and triggers this lld bug? i dunno
<mikdusan> but way to volatile. lld is like an outcast. it's CMakeFiles and targets are really odd compared to the rest of llvm-projects
<wilsonk> Thanks for that. At least I know I am not alone :) Strange that it comes up for me without a standalone build or doing anything exotic
<wilsonk> The only difference from the build instructions on the zig wiki is that I unpack clang/lld in the tools directory of llvm and they get picked up automatically during the llvm build...usually easy-peasy
<semarie> here build of zig-bootstrap was fine (on openbsd)
<wilsonk> brb
wilsonk has quit [Quit: Leaving]
wilsonk has joined #zig
<wilsonk> wow, on a roll...reboot to update win10 and it fails twice! Snake-bitten tonight! I think I will leave off updating my business VM's, just in case...
selby has quit [Quit: My MacBook has gone to sleep.]
RadekCh has joined #zig
<RadekCh> Good morning guys! I was asking this yesterday evening but nobody has responded. What I have problem with is building stage1 compiler. I'm getting the following errors: https://zigbin.io/af9b33
<RadekCh> The problems are related to "missing" enums, but the source code of zig does contain them
<RadekCh> the problem is that for example tartet.zig is taken from the zig that is installed on my host
<RadekCh> so zig compilation of stage1 is not using the proper source code, do You know how can I overcome this?
<xackus> hmm, maybe try override-lib-dir
<RadekCh> and how can I do this?
<xackus> --override-lib-dir
<xackus> with zig build it might be different
<RadekCh> so: [radzio@dom zig]$ zig build -Dstage1 --search-prefix ~/experiments/zig/zig-bootstrap/out/native-linux-gnu-baseline/ --override-lib-dir lib/ ?
<RadekCh> but this also fails immediately
<RadekCh> I'm following the instructions in https://github.com/ziglang/zig/wiki/Building-Zig-From-Source
<RadekCh> Option B: Use a Pre-Built Zig Binary
<xackus> I've never used this option, maybe someone else can help
<RadekCh> ok, no worries, thanks for help anyway
<RadekCh> btw. are most people in Americas', Europe's or Asian time-zone? (so that I would know when to be active here :))
<xackus> mostly eu, na I think
<xackus> you can try discord too
<RadekCh> thx
motersen has quit [Remote host closed the connection]
notzmv has joined #zig
Bernstein has joined #zig
ur5us_ has joined #zig
ur5us_ has quit [Remote host closed the connection]
ur5us_ has joined #zig
TheLemonMan has joined #zig
ur5us_ has quit [Ping timeout: 258 seconds]
RadekCh has quit [Quit: Connection closed]
r4pr0n has joined #zig
leon-p has quit [Quit: leaving]
RadekCh has joined #zig
<RadekCh> Arghhh, found the cause. I had cached output from previous zig run in ~/.cach/zig <- it was causing zig compiler confustion
<RadekCh> ummm, no, it actually failed in the same place
<dch> I tried bringing up latest zig on FreeBSD for ports, using devel/llvm12 which is 12.0.0.rc4 now
<dch> I was surprised to see zig compiler wants libxml (huh but whatever) and I'm seeing
<dch> ld: error: undefined symbol: lzma_properties_decode >>> referenced by xzlib.o:(xz_make) in archive /usr/local/lib/libxml2.a
<dch> which seems odd
earnestly has joined #zig
<TheLemonMan> it's a transitive dependency, I guess it's llvm that needs libxml
<dch> TheLemonMan: I'm not building llvm, does zig need to somehow pull these in as well?
<TheLemonMan> yeah, check out the CMakeLists.txt file
pretty_dumm_guy has joined #zig
knebulae has quit [Read error: Connection reset by peer]
retropikzel has joined #zig
<RadekCh> ok, I think I get it now, the problem was that I was building zig source code with zig installed on the host and not zig built by zig-bootstrap, now I'm using:
<RadekCh> ../zig-bootstrap/out/zig-native-linux-gnu-baseline/bin/zig build -Dstage1 --search-prefix ../zig-bootstrap/out/native-linux-gnu-baseline/
<RadekCh> This is working up until the following error:
<RadekCh> d.lld: error: undefined symbol: llvm::HelloWorldPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)
<RadekCh> >>> referenced by PassBuilder.cpp
<RadekCh> >>>               PassBuilder.cpp.o:(llvm::detail::PassModel<llvm::Function, llvm::HelloWorldPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)) in archive ../zig-bootstrap/out/native-linux-gnu-baseline/lib/libLLVMPasses.a
<RadekCh> error: LLDReportedFailure
<RadekCh> zig...The following command exited with error code 1:
<RadekCh> Am I referencing the correct directories from zig-bootstrap? It seems as if this problem was due to llvm in zig-bootstrap/out/native-linux-gnu-baseline/ not being built using zig cc
xackus has quit [Ping timeout: 252 seconds]
xackus has joined #zig
<RadekCh> ok, next try: copy current zig source code to zig-bootstrap/zig, compile zig-bootstrap again and then use this output zig to compile stage1 with the corresponding zig source code
amk has quit [Remote host closed the connection]
amk has joined #zig
kchambers has joined #zig
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
knebulae has joined #zig
retropikzel has quit [Quit: Leaving]
RadekCh has quit [Quit: Connection closed]
waleee-cl has joined #zig
r4pr0n has quit [Quit: r4pr0n]
retropikzel has joined #zig
retropikzel has quit [Remote host closed the connection]
retropikzel has joined #zig
koakuma has joined #zig
tefter has joined #zig
riba has joined #zig
sm2n has quit [Remote host closed the connection]
sm2n has joined #zig
earnestly has quit [Ping timeout: 252 seconds]
riba has quit [Ping timeout: 252 seconds]
paulgrmn_ has joined #zig
selby has joined #zig
selby has quit [Ping timeout: 240 seconds]
RadekCh has joined #zig
<koakuma> andrewrk: Sorry for the late reply, but I tried to comment the libunwind lines in the file you pointed earlier, but it seems that stage2 build will still try to build it?
klltkr has joined #zig
<RadekCh> Can someone please explain to me if zig has two stage1 compilers? It seems that there is one stage1 zig compiler built from c++ and a second one built from zig source code. Is this correct?
<RadekCh> Then maybe a stage0 would be an appropriate name for the c++ version
<RadekCh> it would reduce confusion in my opinion
<RadekCh> (unless this is not the case)
<Nypsie> There's only 1 stage1 compiler. There's zig0 (which contains a very small subset for Zig), which is used to build the final zig compiler.
<Nypsie> The easiest way to get Zig is by downloading the master binaries from the ziglang website. You can also build from source. Lastly, there's zig-bootstrap which will build Zig from the most minimal setup into a final Zig compiler. But you don't really need to do this unless you're into that.
<RadekCh> what is zig-bootstrap building then?
<Nypsie> It first builds a zig compiler from llvm, clang etc. It then uses 'zig cc' to build llvm, clang etc and uses the output of those to build a static zig binary iirc.
<Nypsie> It's a lot easier to use system llvm, ld & clang and use those to build Zig from source
<RadekCh> ok, thanks for the info
<RadekCh> one thing bother me though, in zig-bootstrap there is a patched version of LLVM, will the stock binary version of LLVM also be able to build zig-stage1 from zig repository?
<RadekCh> Oh, and instruction for Option B in https://github.com/ziglang/zig/wiki/Building-Zig-From-Source are incorrect when using zig-bootstrap:
<RadekCh> 1) It should point that only zig in zig-bootstrap/out/zig-.. should be used to build from zig repository
<RadekCh> 2) In my case zig-bootstrap/zig needed to be a exact copy of zig repository I wanted to built
<RadekCh> 3) It then says to type in 'cmake ..', but we should first do 'mkdir build; cd build' and only then cmake ..
<RadekCh> 4) In case I don't have LLVM 12.x installed on the system how could I specify the LLVM binaries built in zig-bootstrap or other way if I just want to write
<RadekCh> make install, do I really need LLVM for this?
<RadekCh> there should be a way to omit this step I think
<RadekCh> Can someone change this in the wiki?
<Nypsie> llvm12 was only just merged into Zig master so some of the steps are still being fleshed out/corrected
<Nypsie> (Note that the readme of zig-bootstrap does tell you to get the latest zig that you want to build)
<Nypsie> zig-bootstrap also comes with llvm itself
earnestly has joined #zig
<Nypsie> Not sure which step needs to be omitted?
<Nypsie> Note that the goal of zig-bootstrap is "The purpose of this project is to start with minimum system dependencies and end with a fully operational Zig compiler for any target."
<Nypsie> So the steps it contains are not optional
<RadekCh> yes, this is correct, it does said that "A previous build of Zig, 0.7.0+a01d55e80 or newer." but to me it sounds like some latest released binary, and not the one I want to built
<RadekCh> I mean that in Option B, do I need to have LLVM 12.x installed in order to type 'make install'?
<RadekCh> looking at CMakeLists.txt it seems that it's always checking for LLVM
<RadekCh> regardless of the build type
<RadekCh> which is probably ok, but would be nice to specify the LLVM from zig-bootstrap
<Nypsie> In case of option B, you need to have LLVM built using Zig
<RadekCh> yes, and how do I install it on the host?
<RadekCh> or use it "in-place" for cmake in zig?
<Nypsie> Those steps are explained in the zig-bootstrap README that is linked at Option B
<Nypsie> Using -DCMAKE_PREFIX_PATH=<path> you can specify where the libraries are located
<Nypsie> If you're on posix, the easiest way to build all dependencies is following https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#posix
<RadekCh> ah, ok. Than can this be made more transparent in the wiki? And linked in "Option B" section?
<Nypsie> It's in the Option A section
<RadekCh> yes, but Option A / Option B sounds to me as "either or" and not "Option B needs part of Option A". So that the sections are self-contained
<RadekCh> it would be clearer this way
<Nypsie> They are self-contained
<Nypsie> It is either option A, or option B
<RadekCh> I have the feeling we are not understanding each other, but fine. Thank You for help anyway!
<Nypsie> Note that what I linked only works for option A
<Nypsie> Option B requires you to build LLVM using an existing Zig compiler. (Where zig-bootstrap is the easiest way to get this version of LLVM)
<RadekCh> and exactly I want to use Option B, and unfortunately the steps provided there are not working when "copy-and-pasting" them from wiki. Some other work needs to be done that is documented elsewhere. This is my point.
<Nypsie> Yes, but it links you to that documentation
<RadekCh> But I guess only few venture this way so probably no need to update this section
<Nypsie> If it's incorrect, it certainly should be updated. Don't get me wrong.
<RadekCh> it's not mentioning how exactly to use binaries from zig-bootstrap. So that LLVM, LLD and CLANG should not only be built but also installed on the host (even in local directory) and that the zig-stage1 compiler should be used. Instead the command 'zig build' gives an impression that some other binary installed on the system should be used.
cole-h has joined #zig
mikdusan has quit [Quit: WeeChat 3.0.1]
<RadekCh> I need to log out. I'll try to reproduce steps to build everything from scratch over the weekend and hopefully give some concrete steps to be added to the wiki page.
teratorn has quit [Ping timeout: 252 seconds]
teratorn has joined #zig
<RadekCh> Thanks for conversations! Bye!
RadekCh has quit [Quit: Connection closed]
nefix has joined #zig
<nefix> Hello! I asked the same question yesterday, so if it's not appropiate please tell me! I'm trying to learn Zig and coming from a Go background. I was wondering how can I create interfaces? Or if it's not the correct way of thinking and what should I do instead. Thanks! :)
<marler8997> nefix, if you're into reading, you can take a look at https://github.com/ziglang/zig/issues/980
<Nypsie> They can also be implemented in userspace, like here: https://github.com/alexnask/interface.zig
<Nypsie> You can also look at the approaches std.io.Reader and std.mem.Allocator have taken (runtime vs static dispatch)
<nefix> marler8997: I haven't understood a thing of what I've just read xD
<Nypsie> In short: There's no language support like the way Go has
<nefix> and are there workarounds? Like defining a function that returns a struct with typechecks or something like that?
<Nypsie> See the link I gave you and the source of std.io.Reader & std.mem.Allocator
<Nypsie> I'm not really good at explaining how it works I'm afraid, sorry.
<marler8997> we might be able to help more if you show us some code
<nefix> hmm, so I'm not sure to understand the different approaches between std.mem.Allocator and std.io.Reader. I've found the @hasDecl function, maybe something like this but type-checking and returning a compile error if not?
<nefix> https://dpaste.com/6CPUR2XBB <- right now I have this, but it seems I can't access to T.id
<nefix> (on line 4)
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
retropikzel has left #zig ["Leaving"]
<nefix> I've done it! :D https://dpaste.com/42VMNFE9A
<nefix> If you could review my code i'd be really grateful
tefter_ has joined #zig
tefter has quit [Ping timeout: 252 seconds]
<plumm> nefix may I ask what the point of this is? Could be ying here, (also, a bit off that you use a local variable instead of checking the type using typeinfo
plumm has quit [Quit: Textual IRC Client: www.textualapp.com]
<nefix> plumm: I'm trying to create a interface, so it has common methods (such as init) but the T struct can also have its own methods
plumm has joined #zig
<nefix> And I'm not understanding the second part
tefter_ is now known as tefter
<plumm> you can get more type information and check it that way using @TypeInfo https://ziglang.org/documentation/0.7.1/#typeInfo
<nefix> plumm: could you provide an example on how to use it? I'm not getting it
<plumm> @TypeInfo(@typeOf(T.id))
<plumm> that returns a union you can then check the data on iirc
<plumm> could you give me a more real world example of what you intend to use interfaces for? I think the paradigm zig has is a bit different, and while I think you're on the right track, i'm not sure it will be useful down the line (you invert T and the overlay so that overlay appears first, but the T methods aren't available from the returned struct
<nefix> I'm trying to implement a protocol that has different transports
<nefix> There's an interface for transport, and then each transport has its own implementation
<nefix> I'm probably thinking it wrongly though?
<plumm> I don't think zig has a pretty solution for this just yet tho lol
<nefix> That's why I'm doing this "hack" xD
<plumm> I think what you want to follow is the allocator pattern
<plumm> because with readers you can't switch them out or provide different ones at runtime
<nefix> I wasn't able to understand how it works
<plumm> I'mm not even sure if the way it works is what andrew wants, because i think it uses fieldParentPtr
<plumm> nefix the allocator pattern is just replacing the common methods with specialized functions
<plumm> thats why you pass around different specialized instances of allocator, e.g var arena = std.heap.ArenaAllocator.init(inner_allocator); var alocator = &arena.allocator;
<nefix> oh, I kinda understand it now
<nefix> And I guess this is better than what I was trying to do, right?
<plumm> I can't say for sure tbqh
<plumm> but this is one pattern thats widely used throughout all zig projects and std and "just works"
<plumm> what you wrote may have use for your own project, the only way to find out is to just use it and see
<nefix> I'll try to implement it with this pattern and then compare both approaches
<nefix> I have to go now, many thanks! :)
<plumm> have a good day
nefix has quit [Quit: WeeChat 3.1]
bitmapper has joined #zig
<plumm> does anyone know jakubs irc nick here
<Nypsie> plumm: I believe he's only on Discord, not irc.
<plumm> womp
<ifreund> he's popped up here occasionally with the nick kubkon
<andrewrk> argh this is my least favorite kind of issue: https://github.com/ziglang/zig/issues/8545
<Nypsie> Ah, guess I'm not active enough here to have noticed :)
<andrewrk> manifests only on CI, that does not support shelling into
leon-p has joined #zig
mikdusan has joined #zig
nvmd has joined #zig
Akuli has joined #zig
tdeo has quit [Read error: Connection reset by peer]
tdeo has joined #zig
leon-p has quit [Ping timeout: 240 seconds]
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leon-p has joined #zig
deb303 has joined #zig
leon-p has quit [Quit: leaving]
plumm has quit [Ping timeout: 268 seconds]
plumm has joined #zig
paulgrmn_ has quit [Remote host closed the connection]
cryptocode has joined #zig
<cryptocode> Hm, added a C lib, builds fine with zig build. But with -Drelease-safe I'm getting
<cryptocode> error(zld): unexpected file type: expected object '.o' or archive '.a':
<cryptocode> What am I doing wrong?
<cryptocode> addCSourceFile should be sufficient in the build file to have it pick up the resulting object file for linking?
r4pr0n has joined #zig
pretty_dumm_guy has joined #zig
<cryptocode> tried master too, but it claims "error: MissingMainEntrypoint" with release-safe :)
afk has joined #zig
ur5us_ has joined #zig
Snetry has quit [Quit: left Freenode]
Snetry has joined #zig
Snetry has quit [Quit: left Freenode]
Snetry has joined #zig
<cryptocode> ok, looks like release object files on macos are broken, nm/objdump/etc won't accept them
Snetry has quit [Quit: left Freenode]
<g-w1> uhoh, zld probably has a bug
Snetry has joined #zig
<afk> Hey, can someone point me to how to include system libs with zig? Like, if I wanna use xcb for example, how do I go about that?
<andrewrk> afk, -lxcb
<g-w1> pub fn linkSystemLibrary(self: *LibExeObjStep, name: []const u8) void { for build.zig
<afk> andrewrk: And I can just access it with @cInclude("xcb.h")?
<g-w1> yep
<andrewrk> yes, @cImport takes a block so that you can mess with macros and include multiple files and use comptime control flow
<afk> Wow
Snetry has quit [Client Quit]
Snetry has joined #zig
<cryptocode> g-w1: yes, seems like a bug, only triggered if I include C source
jmiven has quit [Quit: reboot]
<andrewrk> cryptocode, we have a young linker codebase so cases like these are helpful especially if we can get a nice reduction test case :)
jmiven has joined #zig
kchambers has quit [Quit: WeeChat 3.1]
<cryptocode> andrewrk: yep, I'll see if I can make a minimal test case
<afk> Okay I tried this: "const xcb = @cImport({ @cInclude("xcb.h"); });" and I'm getting the following error on Arch Linux with libxcb installed:
<andrewrk> I would recommend putting all your c includes in the same @cImport and name it as `c` because xcb will already have its own prefix in the global c namespace. more details: https://ziglang.org/documentation/master/#cImport
<g-w1> afk, also use -lc or exe.linkLibC();
<g-w1> because xcb depends on the c stdlib
<andrewrk> I noticed that people still do not know what to do even after seeing "compilation does not link against libc" - perhaps we need a stronger hint
<g-w1> yes, maybe just say do `-lc or exe.linkLibC()` ?
<afk> Thanks g-w1, that along with changing it to xcb/xcb.h instead of just xcb fixed it.
<g-w1> andrewrk: after a few weeks, I am trying to get back to my rpi0 os, so I have filed this bug with zig not being able to build the boot.S file for it https://github.com/ziglang/zig/issues/8550
<marler8997> g-w1, is it on github? link?
<g-w1> the boot.S file is in the issue
<andrewrk> g-w1, if you want to help with the fix, the next steps are (1) determine what command line is being passed to clang (2) determine what flags need to be added/removed/changed to make it correct
<marler8997> oh it's just the boot.S file so far, nothing else?
<marler8997> that blx instruction issue looks very similar, I think I was getting blx instruction errors when compiling for the gameboy advance arm7 chip
<g-w1> the thing is, it doesn't work with clang either because of a nixos bug https://github.com/NixOS/nixpkgs/issues/118506 🤣
<andrewrk> check my link ^
<g-w1> ok, will do
<noam> Write up for zyg's analysis: http://pixelhero.dev/c3/analysis.pdf I think this design is here to stay, but it might need a bit more work...
maddievision has joined #zig
r4pr0n has quit [Quit: r4pr0n]
<ifreund> is there no way to pass extra arguments to the linker?
cole-h has quit [Ping timeout: 265 seconds]
<andrewrk> ifreund, linking is supposed to be encapsulated. what do you need?
ur5us_ has quit [Ping timeout: 258 seconds]
<ifreund> I needed --allow-shlib-undefined, which I just found and merged open PR from daurnimator adding support for
<andrewrk> the flags are prefixed with -f like this: -fbar, -fno-bar
<g-w1> how do i figure out what args are being passed to clang with zig cc? --verbose-cc does not work
<ifreund> andrewrk: welp, I guess I'll open a PR fixing that then. Noted for the future
<andrewrk> other than that, seems fine
<andrewrk> g-w1, set ZIG_VERBOSE_CC=1 environment variable
<g-w1> thanks
<g-w1> yeah, the mcpu is not passed: `/home/jacob/.local/zig/0.8.0-dev.1963+2b2920f59/files/zig clang -target arm-unknown-unknown-eabi -ffreestanding -fpic -ffreestanding -c -o /home/jacob/.cache/zig/tmp/ccfd1a8f7c79fc6-boot.o boot.S`
<g-w1> with `❯ ZIG_VERBOSE_CC=1 zig cc -target arm-freestanding-eabi -mcpu=arm1176jzf_s -fpic -ffreestanding -c boot.S -o boot.o -g`
<noam> Redid analysis a bit, *now* I'm pretty sure it's good. http://pixelhero.dev/c3/analysis-2.pdf
<g-w1> ill take a look at that src loc
<g-w1> marler8997: my os src is not up yet, but it doesn't run on bare metal yet, only qemu
<andrewrk> g-w1, clang as an assembler does not accept the same args as clang as a c compiler
<andrewrk> annoyingly
<g-w1> 🤔 wut
<g-w1> thats soo weird
<ifreund> andrewrk: PR up, sorry bout that
<andrewrk> no worries thanks for taking care of it
<g-w1> wait, but i think clang as an asm has -mcpu?
<g-w1> in this case, could it be the same?
<g-w1> does it not work with zig's embedded clang?
<andrewrk> try it
<andrewrk> ZIG_VERBOSE_CC have you the command to run right?
<g-w1> oh yea, lemme try :)
<andrewrk> change the beginning to "zig clang"
<g-w1> yep :)
<g-w1> zig: error: the clang compiler does not support '-mcpu=-mcpu=arm1176jzf-s'
<andrewrk> how did that prefix get doubled?
<g-w1> oh, not sure, it was on the cli tho :P
<g-w1> ok, ❯ /home/jacob/.local/zig/0.8.0-dev.1963+2b2920f59/files/zig clang -target arm-unknown-unknown-eabi -ffreestanding -fpic -ffreestanding -c -o /home/jacob/.cache/zig/tmp/db4d532bcd4a108e-boot.o boot.S -mcpu=arm1176jzf-s works!!
<g-w1> ill try updating that part of the Compilation.zig :)
<andrewrk> look up in that function for target.cpu.model.llvm_name. I suggest to copy paste that block into the asm switch prong and modify it to emit an -mcpu arg
<g-w1> ok
<g-w1> yo if this works, zig will be a better cross-assembler than system clang on nixos!
tributarian has joined #zig
Akuli has quit [Quit: Leaving]
marler8997 has quit [Ping timeout: 265 seconds]
<g-w1> yooo it worked!
<g-w1> does this diff look right https://clbin.com/nU57G ?
<andrewrk> yes
LewisGaul has joined #zig
<g-w1> k, making a pr
<g-w1> thanks for the help!
<andrewrk> np, thanks for testing it
<g-w1> that new astgen cmd looks awesome
<g-w1> for 8516 is the language change part the fact that all decls will be astgened, not just parsed? so if there is some missing identifier in a function that is not used, it is still analyzed up to astgen?
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
<andrewrk> that's correct
<g-w1> that is nice
<andrewrk> it also lets us have errors for unused functions
<andrewrk> this will be controversial but I will strong arm it through
<g-w1> why controversial?
<andrewrk> people want to be sloppy
<g-w1> oh yeah, 😳
<g-w1> could a binary be emitted even if there are compile errors? I think this is very doable in stage2
<g-w1> this might confuse people more though
<g-w1> ok, i made a pr
<noam> Oh nice
<noam> andrewrk: glad to hear it :)
<noam> lazy analysis is dead! Woot!
<noam> Just in time for me to incorporate it into my design lol
<andrewrk> there is still a lot of lazy analysis in Sema
<andrewrk> for example type coercion errors
<noam> Sure, but *semantically*, invalid decls now have meaning
<noam> (even when unused)
<noam> ...unless I"m misunderstanding this, which is possible
remby has joined #zig
<g-w1> they are only invalid in some ways, not others
<noam> Do we have a good writeup of which are which yet?
<noam> 'cause this might let me make another big simplification...
<g-w1> comptime stuff doesn't get caught, other stuff does
<g-w1> S.x doesn't i think, but x does
<andrewrk> there's a complete list on 8516
<noam> andrewrk: thanks
<noam> does this mean sloppy mode is rejected?
nvmd has quit [Quit: Later nerds.]
xackus has quit [Quit: Leaving]
<andrewrk> not until I press the close button
LewisGaul has quit [Ping timeout: 240 seconds]
ur5us_ has joined #zig
<plumm> your sloppy time is up
remby has left #zig ["Good Bye"]