Zig as a Multi-OS Build System (with Loris Cro)

Поделиться
HTML-код
  • Опубликовано: 31 янв 2025

Комментарии •

  • @stretch8390
    @stretch8390 6 месяцев назад +50

    Kris, your channels are the opposite of tech-influencer memes. I always come away having learned something and with other things to read more about.

    • @mandradon
      @mandradon 6 месяцев назад +5

      I was blown away by the first episode I watched a few months ago. The depth of discussion and knowledge in this is just amazing. I wish there were more channels like this!

  • @purewantfun
    @purewantfun 6 месяцев назад +33

    Recently got into zig after seeing so much of it online, did the whole ray tracing in a weekend thing and I'm loving every bit of it.

    • @ForeverZer0
      @ForeverZer0 6 месяцев назад +5

      It just keeps getting better and better the more you use it. I was admittedly skeptic at first, I initially thought the syntax looked strange. Finally gave an honest effort to learn it, and absolutely love it now, and understand "why" some of the syntax exists, and the convenient things it allows for that just feel satisfying.

    • @mr.sloth.
      @mr.sloth. 17 дней назад

      just a curiosity, which graphical library you used? Raylib?

    • @kalasmournrex1470
      @kalasmournrex1470 14 дней назад

      @@ForeverZer0the syntax is pretty similar to rust in the end

    • @ForeverZer0
      @ForeverZer0 14 дней назад

      ​@ I dunno, personally don't find much in common with their syntax beyond the very basics that most mainstream languages share.

    • @purewantfun
      @purewantfun 12 дней назад +1

      @@mr.sloth. Nah, I just output ppm image files (there's a standard for both text-based and binary versions), which I then convert to PNGs for viewing using imagemagick.

  • @alphabitserial
    @alphabitserial 4 месяца назад +11

    Loris's static site generator, Zine, is awesome! I would love to see him back on to talk about that. It even ships with an HTML LSP that actually reports errors - the VSCode extension is written in zig and built to WASM!

  • @MrHopp24
    @MrHopp24 6 месяцев назад +42

    Can’t get enough Zig! Thanks for the new episode 🎉

  • @TheFreshMakerHD
    @TheFreshMakerHD 6 месяцев назад +10

    This came out at the perfect time. I am trying to compile an open source game project written in C and I've felt like I've been banging my head against a wall lol

  • @t1nytim
    @t1nytim 5 месяцев назад +5

    Not another Zig episode...every time I hear about Zig, it makes me wanna give it a go. But I know I can't control myself, and I won't be able to sleep because I'll be wanting to spend my whole time learning, so I know I need to wait till I'm off work, and don't have other plans. Though on a more serious note, I did love listening to Loris last time, can't wait to listen this time too.

  • @iatheman
    @iatheman 6 месяцев назад +10

    Another great interview! It was so valuable to learn how Zig prioritizes building in a sane way on the world of static/compiled programs. I'm dealing with Python + C dependency issues as I was listening to this... gotta give Zig another try.

    • @pookiepats
      @pookiepats 6 месяцев назад +1

      I wanted to get excited for Zig but the experience is so different than the perspective shared here-one might not reasonably expect seamlessness but for entire concepts to only exist in github discussions is a bit beyond my tolerance.

  • @jonathanbush6197
    @jonathanbush6197 5 месяцев назад +6

    Very cool. Zig seems to keep expanding and doing more and more fundamental things. Who knows what it might do some day?

  • @matt42hughes
    @matt42hughes 6 месяцев назад +3

    great discussion, really relevant for not just zig but the process of building and shipping native projects in general

  • @JaconSamsta
    @JaconSamsta 6 месяцев назад +13

    Great introduction. Dealing with a C/C++ library will never not seem daunting. Even being packaged by my distro won't guarantee that it will play nicely with my current project and the build system I'm using there. So it's usually down to building it myself and lord help me if I need to make any modifications there!
    Zig is making bold statements about being the last build system you'll ever need, so It's definitely on my radar in that regard. Can't wait to dive into this episode and see what Zig has to offer and where it's headed!

    • @theevilcottonball
      @theevilcottonball 6 месяцев назад +1

      Well there are many cross-platform build-systems making that claim: CMake, meson, Scons, autotools, Jam, ... I mean, Zig provides some nicerr out-of-the box-cross compilation but otherwise it is not going to solve the problem of there being many different build systems that are all not really compatible with each other.

  • @michaelutech4786
    @michaelutech4786 6 месяцев назад +2

    I really enjoy this channel. The content is very informative. It has the relaxed feel of sitting on a couch with a cup of tee. You've got great guests. There is a lot of competency going around. Thank you for all the work you put into this!

    • @DeveloperVoices
      @DeveloperVoices  6 месяцев назад +1

      Thanks Michael. I'm glad it's appreciated, and I'm pleased you're here. 🙂

  • @jwr6796
    @jwr6796 6 месяцев назад +15

    I LOVE the idea of Zig, comptime, and its C compilation superpowers... But I've bounced off it HARD twice as a Windows user because it requires workarounds on Windows for things that are fine on Linux and Mac, and that's at the learning stage -- examples in tutorials and documentation. I'm SO on-board when it's resolved those things.

    • @mlugg5499
      @mlugg5499 6 месяцев назад +13

      Hi, Zig core team member here! Would you be able to explain what the things you hit were? If there are usability problems which potential Windows users hit so quickly, perhaps we should prioritize them, so it'd be great to hear what the big issues are.

    • @jwr6796
      @jwr6796 6 месяцев назад +7

      @@mlugg5499 hey -- great work so far! Really very interested in Zig.
      I would need to dig back through what I was working on for details, and I'll try to do that and point to specific docs and guides soon, but my (faulty) memory says that it has to do with setting up a general allocator, and that I got a (very clear) error message saying that that manner of constructing an allocator was not available on Windows and it gave a specific alternative... which I then couldn't find documentation on and couldn't figure out by usage.
      My main worry was less that I couldn't build on Windows (happy to use Linux) and more that I might be developing on Linux in a way that wouldn't produce working binaries for Windows users.
      Grain of salt here -- I'm not a low-level dev and when I do dip my toes in those waters, it's with Rust, which is decidedly NOT low-level. 😂 I could be fundamentally misunderstanding how allocators are meant to work.

    • @jwr6796
      @jwr6796 6 месяцев назад +4

      I'll also add that my experience with Bun (WSL only on Windows) might have colored my interpretation of the issues I was encountering. It feels like there is a general sense that Zig is not Windows-friendly, so some of that may be a marketing / documentation concern.

    • @airman122469
      @airman122469 6 месяцев назад +2

      Even on Linux it’s hard to get started with because the build system is so poorly documented.

    • @jc-aguilar
      @jc-aguilar 6 месяцев назад

      I highly recommend trying a Linux VM inside your host OS (Either Mac or Windows). I have been coding this way for a long time, it’s so useful when trying new things. For example, look for Mitchell Hashimoto’s setup for a NixOS VM.

  • @nathanle1024
    @nathanle1024 6 месяцев назад +12

    Loris is absolutely right about python democratizing access to C libraries.

    • @AGeekTragedy
      @AGeekTragedy 5 месяцев назад +2

      And (surprisingly often) Fortran libraries.

  • @FerPerez-mc3wr
    @FerPerez-mc3wr 6 месяцев назад +2

    Such a fantastic watch.

  • @mattiapalmese2971
    @mattiapalmese2971 6 месяцев назад +13

    I'm not a Zig developer in any way, but I like C and I write a lot of code in it.
    I think that the problem stated is not about C and the pain of building C, but mostly about the complexity that operating systems provide, which often limits one's ability to compile/build projects. The fact that some operating systems doesn't ship with a C compiler seems so stupid to me.
    However, I'm not stating that C is perfect, and I think that Zig could be a great successor, maybe even better than Rust.

    • @anonymous-q2b5s
      @anonymous-q2b5s 6 месяцев назад +7

      I'm no build or C expert by any means but I believe you are right in the sense that the problem wasn't created by C. But it also wasn't solved by it and for decades people for lack of an alternative lived with it and programmed everything in C.
      But from todays perspective since all the powerful libraries are written in C, building those is the problem that a successful language needs to solve.

  • @the_graytest
    @the_graytest 6 месяцев назад +4

    Many people would agree that the Zig proyect is aiming to achieve great things in system's development, perhaps the most visionary. And many more would agree that 'echo' is a better for the Developer Voices entrance, the most humanly resounding software channel on Earth. Just sayin :)

  • @jatlineur
    @jatlineur 6 месяцев назад +2

    remember bun build using zig, that's why i love zig.

  • @SirSomnolent
    @SirSomnolent Месяц назад

    This was a great interview. Inspired me to try it out but after moving past std lib and struggling a bit with dependencies to wrap things in a UI... I think I will stick with go a while longer. Maybe someday if zig has a cargo level tool (or I get better) I'll give it another look.
    Still, awesome interview and guest

  • @mumk
    @mumk 6 месяцев назад +3

    omg stop. This makes me wanna learn Zig while I have Nix, Scheme, Lisp, Emacs, F#, C, Q#, Assembly and Clojure ongoing currently 💀💀

  • @hecate6834
    @hecate6834 6 месяцев назад +16

    I should really try Zig some more, been using Odin for a while but the lack of cross platform compiling/linking and well the lack of some more niche platforms like Cortex M7 has driven me back to C 😅. Maybe Zig is the answer I've been looking for although the build system is still a huge mystery to me

    • @FlanPoirot
      @FlanPoirot 6 месяцев назад +2

      both are cool
      odin seems to be lacking on the platforms front for now and it packs a package manager/build system (due to project philosophy)
      but from my usage it seems quite stable and rarely breaks across versions and if it does it's not much
      zig is cross platform, has a package manager/build system but it breaks very often, it's less mature and the LSP is not as good as Odin's because it relies too much on comptime (supposedly a better LSP will be shipped with the compiler once the language is more mature)

    • @hecate6834
      @hecate6834 6 месяцев назад +3

      @@FlanPoirot Don't get me wrong, I absolutely love Odin it's just that for some of my projects it probably wasn't a good fit (yet?)

    • @an_imminence
      @an_imminence 6 месяцев назад

      Do learn from existing build dot zig files in existing repos. The zig build documentation is as lacking as you would expect for an unreleased language that is still in flux. I only use zig build nowadays, it's so powerful.

    • @ForeverZer0
      @ForeverZer0 6 месяцев назад

      I am still an amateur when it comes to the build-system, but still manage to stumble through what I need without much struggle. I am sure it gets more complicated with cross-compiling C libraries for exotic architectures, but the typical use-cases of of building/linking some libraries and importing some Zig modules is painless. For a reference point, it is far less complicated than using CMake if you are familiar with it, but very different.

  • @vincentl7022
    @vincentl7022 6 месяцев назад +1

    Getting zig as a pip package is so freaking smart and is a really good idea to get more zig into people's environments while using zig's strongsuits and providing incredible value.

  • @MxSmack
    @MxSmack 6 месяцев назад +1

    I'm experiencing those compiling issues right now! I wanted to cross compile an SDL2 program using SDL_gfx to Windows and I can't get the SDL_gfx to compile.
    I'm thinking of replacing that functionality with my own implementation, love C but getting to compile things is definitely a challenge.

  • @meryplays8952
    @meryplays8952 6 месяцев назад +7

    Can you host the cosmopolitan/cosmocc team?

  • @CTimmerman
    @CTimmerman 3 месяца назад

    Thank Gates for shielding us from market fragmentation in the '90s.

  • @NdxtremePro
    @NdxtremePro 6 месяцев назад +2

    Brew also works on Linux.

  • @NicolasPavie16
    @NicolasPavie16 6 месяцев назад

    About make, always look up what commands are used in the makefile: I have worked on a open-source java project with maven used for the build, and make used on top of it for build steps orchestration.
    Problems were that
    1) I work on Windows so need to find and install a version (but that can be done, there are projects that builds make for windows, its just not very common, and I could just drop a linux VM or use WSL2 for building the java project),
    But the worst was 2) the lead dev that made the makefile is on macOS and made it full of macos specific commands everywhere.
    The thing would not even build on linux ... first time I had seen a cross platform project made non-cross platform on the dev side.
    Ultimately, I unlocked the situation for the other devs and myself by finding and provinding the system specific maven commands that were simply reconstructed and called by the orchestration makefile.

  • @Banumayyad
    @Banumayyad 18 дней назад

    I thought he said 'pedophile not found.' That really woke me up.

  • @liangwang4518
    @liangwang4518 10 часов назад

    I have nothing against making cross platform builds easier. However, C is one the last few places where dependencies can be shared across multiple executables instead of each one bundling their own. It can be good but also can be painful when subtle ABI breaks.
    we should preserve the option to use the system wide dependency when available. Although by the sound of things WHL is already just bundling the .so instead of trying to locate the system one first.
    As for platforms where no system wide package manager exists, cough windows cough, I frankly don’t care. The average windows machine already have 6 versions of libc bundled somewhere

  • @nevokrien95
    @nevokrien95 6 месяцев назад +1

    Zig is the king of building prod clang projects but if you need something else it can be tricky.

  • @mbarrio
    @mbarrio Месяц назад

    Nice interview, I'll probably never use zig in my lifetime. It's too complicated

  • @cellularmitosis2
    @cellularmitosis2 6 месяцев назад +3

    Step 3 is profit!

  • @albertoarmando6711
    @albertoarmando6711 6 месяцев назад +2

    I see zig everywhere, so I'm curious now. I code in JS and some Python for a living. Do I need to learn C before learning Zig?

    • @pietraderdetective8953
      @pietraderdetective8953 6 месяцев назад +1

      By learning Zig you will learn C as well...both are 1:1 in terms of structure.
      I'm doing both actually at the moment it has been an amazing learning experience so far.
      Previously I wrote Python webapps and used a bit of Javascript for dataviz.

    • @albertoarmando6711
      @albertoarmando6711 6 месяцев назад

      @@pietraderdetective8953 thanks for taking the time. I'm already at it

    • @anonymous-q2b5s
      @anonymous-q2b5s 6 месяцев назад

      You really don't need it. But C is syntactically very simple. So you can learn the basics of C in a day. Afterwards it's business as usual: You google less and less over time and get faster, cleaner and more comfortable over time.

    • @Onyx-it8gk
      @Onyx-it8gk 6 месяцев назад +1

      ​@@albertoarmando6711 Yes, learn C and assembly before anything else if you want to be a systems programmer.

    • @jc-aguilar
      @jc-aguilar 6 месяцев назад +1

      It depends on your own personal goals. If you want to learn Zig, no, you don’t need to learn C. But, if you want to be a systems/low level programmer you should. It will also improve your skills. C is not difficult to learn, there is a lot of misinformation and some gatekeeping about C’s learning curve. Like any language becoming an expert takes time, but the language is very small and can be learned in a few days.

  • @tsaraki38
    @tsaraki38 6 месяцев назад +7

    more Zig!!!!

  • @IgorStojkovic
    @IgorStojkovic 6 месяцев назад

    I don't get how can you run Windows or MacOS linker on Linux though even if you have it packaged since the linker itself is a windows/macos app not a linux app?

    • @lawrence_laz
      @lawrence_laz 6 месяцев назад +5

      Zig has a portable macos linker written in zig

  • @AtomSymbol
    @AtomSymbol 6 месяцев назад

    In summary, it seems that the 'magic' of Zig as a Multi-OS Build System is that it is creating *another* build environment, which from the viewpoint of a library developer is *just another* build environment that the developer has to support in addition to already supporting build environments which are direct competitors to the Zig's build environment. No?

  • @mattanimation
    @mattanimation 6 месяцев назад

    round 2 👏

  • @the_nurk
    @the_nurk 4 месяца назад

    this is the way

  • @airman122469
    @airman122469 6 месяцев назад +1

    Honestly the main reason I can’t get into Zig is its poorly-documented build system. Where are the definitions for the structs being used? How does the build system find dynamic libraries? Why does it seem to change every single time a new Zig release drops?

    • @kristoff-it
      @kristoff-it 6 месяцев назад

      the build system is entirely part of the zig standard library, see lib/src/Build.zig, everything is defined in there, also the Learn section on the official Zig website has a build system guide

  • @pengain4
    @pengain4 2 месяца назад

    While I really understand the sentiment on having a compiler on floppy disk - it's still very funny when they call "fairly large tarball" when it's just 60MiB and allows me to make builds on my machine for 3 major OSses and dozen of architectures while still being 3-4 times smaller on my disk than average messenger app installed on my phone.

    • @pengain4
      @pengain4 2 месяца назад

      $ du -sh goland zig swift
      2,7G goland
      357M zig
      2,2G swift

  • @jagannathishere
    @jagannathishere 6 месяцев назад

    what are the latest projects that are being written in Zig? can anyone point me towards them?

    • @kristoff-it
      @kristoff-it 6 месяцев назад +4

      tigerbeetle, ghostty, bunjs are the major ones

    • @AGeekTragedy
      @AGeekTragedy 5 месяцев назад

      Parts of the Roc compiler

  • @theevilcottonball
    @theevilcottonball 6 месяцев назад +2

    5:18 C programmers will instantly disagree with you
    No. i think using C libraries from python with pip is easier than trying to configure and build C libraries yourself. Especially if you write C on windows, where there is no system package manager, when you do not use Visual Studio, where the configure shell scripts don't run, where there is no standard location where C libraries should be installed to, where the MSVC compiler and linker live in weird directories and are not on path.
    Basically the only C libraries that are easy to integrate into your C project are header-only. Especially when you want to also build for weird targets e. g. WebAssembly and so on.

    • @iatheman
      @iatheman 6 месяцев назад +2

      Developing in C on Windows sounds like a nightmare.

    • @theevilcottonball
      @theevilcottonball 6 месяцев назад

      @@iatheman Well, that is only if you use 3rdparty non-header-only libraries, if you write everything yourself (like most good C programmers) it is a joyful experience.

  • @kcvinu
    @kcvinu 6 месяцев назад +1

    Why a language designer want to be strict with line endings ? What's so special on it ? Is there any benefit in doing that ?

    • @UnidimensionalPropheticCatgirl
      @UnidimensionalPropheticCatgirl 6 месяцев назад +1

      They have couple of benefits, initial parsing in the compiler is easier to implement as well as formatters, linters and syntax highlighting, it’s more explicit making it easier to reason about the code as well making greping through code bases with regexes slightly easier.

    • @kcvinu
      @kcvinu 6 месяцев назад +1

      @@UnidimensionalPropheticCatgirl That's the only reason I don't want to try Zig on Windows. All other new languages are in my bucket list. I am doing hobby projects in D, Nim, Odin, C3, Nelua. I stopped Zig after the first hello world program.

    • @notuxnobux
      @notuxnobux 6 месяцев назад +2

      @@kcvinu why is it an issue? all text editors except windows notepad use
      these days.
      is a relic of the past

    • @kcvinu
      @kcvinu 6 месяцев назад

      @@notuxnobux Seems like you are using Linux. In Windows, vs code is using CRLF. That's the Windows default.

    • @Sandromatic
      @Sandromatic 6 месяцев назад +1

      ​@@kcvinuzig's guide says /n is the line terminator, but /r/n is also valid?

  • @hexomega9445
    @hexomega9445 6 месяцев назад +3

    if its ziggin i`m zagging a like 🤣

  • @guilherme5094
    @guilherme5094 3 месяца назад

    👍!

  • @cbrunnkvist
    @cbrunnkvist 4 месяца назад

    Whatever you do Loris, please, please I beg you :) do NOT reinvent Scala's SBT by chasing the dragon's tail of build-system-self-bootstrapping #declarativeToDeathAndBeyond

  • @The1wsx10
    @The1wsx10 6 месяцев назад

    i spent 3/4 of the video thinking they were talking about a text editor, wondering why they were talking about programming languages so much..

  • @tanguero2k7
    @tanguero2k7 6 месяцев назад

    @30'xx: one thing that always made me hate python was, exactly, the need to have c compilers installed to build some dependency of a package. Folks, I hated it so much to the extent that I started carrying the whole pip cache on a USB disk so I could copy things over to some other system I needed to work on.@40:xx I'm still not satisfied that one must expect a system to compile a dependency. If a package has a wheel, it should be "binary self contained", otherwise, it feels like the wheel system's whole purpose is defeated.

    • @kristoff-it
      @kristoff-it 6 месяцев назад

      I gave a talk titled "Deinventing The Wheel" (it's available on youtube) about the limits of wheels. If you can be confident it will work reliably, there's a lot to like about building software precisely for the exact set of instructions that your machine support.

  • @adammontgomery7980
    @adammontgomery7980 6 месяцев назад +1

    I'm not making the argument that we go back in time, but './configure && make install' is pretty easy.

    • @Technoyote
      @Technoyote 6 месяцев назад +1

      What Zig provides is cross-platform builds for all major architectures out of the box. No CI build step to spin up a MacOS container

    • @Loanshark753
      @Loanshark753 2 месяца назад

      What if you need to build dependencies

  • @toby9999
    @toby9999 4 месяца назад

    Why would anyone still be using make files in 2024?

  • @majidaldo
    @majidaldo 5 месяцев назад

    Sibilance

  • @mynameisnotyours
    @mynameisnotyours 6 месяцев назад

    When you move the config file into the compiler, you’re surrendering yourself to the opinions of the person who wrote the compiler.

    • @DeveloperVoices
      @DeveloperVoices  6 месяцев назад

      True, but I currently have myself surrendered to the person who spec’d YAML, and I’m not certain I’m happier. 🤷🏻‍♂️

    • @mynameisnotyours
      @mynameisnotyours 6 месяцев назад

      @@DeveloperVoices At least then you can write your config in JSON or whatever, then write a script to convert to yaml.
      The extra steps is the price of freedom.

    • @DeveloperVoices
      @DeveloperVoices  5 месяцев назад

      Ah, I think I’d missed your point the first time around. You’re saying that the advantage of config file is you’ve got many reader implementations to choose from?
      That I’d have to agree with. You’re tied to one way of expressing the answer, but free to choose how that’s interpretted. 👍