Hazel Engine ON LINUX!
Check out Hostinger for all your VPS and web hosting needs! Use coupon code CHERNO for a bigger discount ► hostinger.com/cherno
Patreon ► / thecherno
Instagram ► / thecherno
Twitter ► / thecherno
Discord ► / discord
Hazel ► hazelengine.com
🕹️ Play our latest game FREE (made in Hazel!) ► studiocherno.itch.io/dichotomy
🌏 Need web hosting? ► hostinger.com/cherno
📚 CHAPTERS
0:00 - Continuous Integration recap
3:09 - Adding an new platform
5:45 - Linux CI
7:48 - Some personal changes
8:21 - GitHub hosted runners
9:08 - VPS self-hosted runner
12:20 - The "Dist" Hazel configuration
13:36 - GitHub workflow file and creating the self-hosted runner
15:42 - Visual Studio Code's amazing Remote SSH extension
17:49 - Final thoughts
💰 Links to stuff I use:
⌨ Keyboard ► geni.us/T2J7
🐭 Mouse ► geni.us/BuY7
💻 Monitors ► geni.us/wZFSwSK
This video is sponsored by Hostinger.
Пікірлер: 343
Thank you so much! Us Linux users do exist, and we like it when we don't have to circumvent things because people refuse to support our OS of choice.
@jeffersonmcgee9560
6 ай бұрын
Hi! I also use Linux! It's really appreciated. However, I think it's a bit more complicated than "People refuse to support Linux". Sometimes people don't have the time!
@antopilo7418
6 ай бұрын
@@jeffersonmcgee9560 Yep, and then having to maintain those two platforms over time slows development as well. Its not a trivial thing in the first place and I think that gets lost sometimes between the devs and the users.
@GabrielM01
6 ай бұрын
second this
@KyleHarrisonRedacted
6 ай бұрын
Isn’t the main credo of a Linux user user to just build it yourself ;) J/k It also comes down to market use. If practically no one uses it on a platform, the effort, time, and money needed to keep it there winds up not being worth it. Unity is used a lot by windows and a bunch by Mac, but run a poll to see how many have even used the Linux build before and it’s so so tiny. And that thing was soooo popular among indies!
@MyndZero
6 ай бұрын
to be fair when you opt into an extreme minority you should expect and accept outcomes that aren't to your benefit.
btw clang works on windows too AND it provides a tonne of tooling, so it might be wise to use the same compiler for most platforms such as windows, linux and mac
@jakobbouchard
6 ай бұрын
i was about to suggest that too! I feel like it might make the setup simpler?
@marcs9451
6 ай бұрын
zig c++ as well, just uses libclang under the hood but it is super useful
@peterfordham3562
6 ай бұрын
I'd suggest almost the opposite and have a gcc build on Linux as well as clang to maximize your chances of finding different issues with different compilers.
@kuhluhOG
6 ай бұрын
well, you get one advantage out of using multiple compilers: it exposes bugs; both from different compiler behaviour and because they catch different errors and additionally it's less likely that you are going to run into problems when you at some point want to upgrade your compiler to a newer version
@angela_jx
6 ай бұрын
This might simplify the setup however I would argue the more compilers you can use the better. Like cherno said, “something that compiles on one compiler/platform may not compile on another”. That’s usually because you don’t write standard compliant code or because you wrote code with UB. Using more compilers which support different warnings and errors help you find bugs and write better code.
i use Arch btw
@Maverick56912
6 ай бұрын
i use arch btw, too
@miezekatze3536
6 ай бұрын
I use arch btw too
@GriffinTwo
6 ай бұрын
I use arch btw, too
@GriffinTwo
6 ай бұрын
Wait, I don’t know what is it
@stugeh
6 ай бұрын
I use arch too btw
making your code portable is a really important skill
@tomkohler1609
6 ай бұрын
It's actually quite easy, if you follow a few rules: 1. Dont' rely on OS dependent features or, if you have to, put them in a seperate layer, that can be swapped easily for each target OS. 2. Which follows 1.: Use libraries like SDL. SDL does all (or at least much) the OS dependent stuff for you. Need to query the high performance counter? Cool, SDL has a function for this (SDL_GetPerformanceCounter), no need to use the Win32 API QueryPerformanceCounter. 3. Don't rely on undefined behaviour in your programming language (for example type punning in C++). Use the explicit way. Compilers are smart today, they know what you want (in MOST cases) and can optimize. 4. Use the correct data types. An int is an int, it's size may be variable on different systems, so don't use it to store an 32-bit value (you have uint32_t for this). AND DON'T DO POINTER ARITHMETIC WITH IT.
@chriss3404
6 ай бұрын
@@tomkohler1609 This is a good general guide! But I disagree with your claim that its easy to pull off. The challenge often comes from making a fast, non-leaky abstraction that works for all platforms. Abstraction is not free. Compile time abstractions (templates & macros) come at the cost of compile time which can hurt DX and developer velocity. Run time abstractions often come at the cost of increased indirection, reduced data locality (from the indirection), and extraneous function calls AKA slower execution. Finally, bugs exist. You can avoid UB, but sometimes bugs in the libraries and or drivers you rely on can wreck havoc on your design because now you might have to employ incredibly defensive programming and hook into different locations in your program in order to mitigate issues. Your only alternative is to wait for or create a patch for the library (which might not be an option). Again, these are all great tips for making a cross platform application, and I think for a small to even mid sized project these will work great on their own! However, as your application grows, you need rigorous automated testing (probably through CI), a bug tracking solution, and someone knowledgeable on each target platform, both of which take time and or money to set up. (Assuming you want to maintain a consistently good experience across platforms)
Nice, I was searching for a VPS for personal project. Ty Hostinger :)
Congratulations on moving and having your own space! That sounds like a dream, best of luck with it.
i really like these dev blogs we are getting the vibe is so good too
Man that's awesome content and great job for everything you have achieved. I really am at loss of words how you stay motivated. This is a large project which has taken years out of your life, with many challenges and unknowns. Would be great to make a video about it. Like how do you find motivation. How do you go about seemingly impossible problems that you have had to solve and etc.
"Sometimes things that compile on msvc might not compile on clang" Yeah I learned that on my not-hazel. Every time I go back to check out linux there are a few changes (usually it's the same things that come back in different areas) that I need to fix. So there's a bunch of "now compiles on linux (again)" changes in my git log. Eventually I'll set up CI. The good thing with clang is that the error messages aren't as obtuse as MSVC, so with CI I could fix those issues by modifying the code on windows by simply looking at the message.
4:46 “to avoid this problem then, what can we do?” Me: “switch to clang on windows by updating the premake script to tell visual studio to use it, clean up any errors and warnings, call it a win. Right? Right?” 16:51 I sometimes forget other people haven’t had to do dev as a remote worker where the company requires you to keep all files in-house and not your-house where extensions like this become so every day common place you don’t even really think about them anymore
CONGRATS ON 600.000 !!
I was expecting you to show the changes in code needed to build Hazel on Linux; limitations, workarounds, etc.
At work we actually only use vscode's remote ssh, and it's fantastic. Devs don't have to keep a local copy or any dependencies on their own system, and developer hardware/personal setup will never cause weird issues. Has felt just as responsive as working locally. You can even have extensions/settings only enabled for ssh, so if you have personal projects it's all separate
@jordan4220
6 ай бұрын
Same here, we started using clion remote but found it way too buggy. Used to use eclipse remote mode back in the day so definitely nothing drastically new here.
Thank you so much! pls keep making these incredible videos
Switched to linux around a year and a half ago and it's been awesome. Pretty much every game runs great with proton and the os feels way more stable
🎉🎉🎉Nice Job! Finally Cross Platforn!
It's about time! What a great news
Thank you ❤
remote ssh in vscode is great for maintaining raspberry pis & home automation stuff around the house, idk how i coped with having to use vim/nano etc for that in the past
Big thanks to you and your team for supporting Linux, especially Emily!
great video. quick suggestion: just use boxes instead of the blur when focusing on specific code parts :P
Yes! I can finally try Hazel
Have been waiting for this
That's freaking amazing. ❤
In my experience it is 100x easier to port a program written for Linux to Windows than the other way around. MSVC allows so much bad code. My advice is to use the Microsoft’s clangs-cl compiler (just add it when installing MSVC). It runs faster, is ABI compatible with the legacy compiler and finally it’s a higher chance your code will work on other platforms. On Linux I use gcc however since it produces faster code (on our code base at least). The good thing if you use Jetbrains CLion (which I use), is that you very easily can setup several parallel toolchains and basically when you build it will compile for both gcc and clang at the same time.
@phusicus_404
6 ай бұрын
+
Congrats to 600k. Cherno the 🐐 of c++
Remote SSH in VS Code is my whole life haha. Couldn't do my job without it. I don't use Visual Studio much so I'm not 100% sure, but I'm like 95% sure the same thing is built into Visual Studio so you can do it there if you prefer.
Linux is getting bigger every day. Microsoft is also considering making Windows a subscription based model... and if they do, I'll switch to Linux right away
@wjrasmussen666
6 ай бұрын
MS has been talking about subscription based model for over 20 years.
@m4rt_
6 ай бұрын
I switched completely over to Linux the day I learned that Windows 11 was happening. Here I am over 2 years later, and I'm still loving Linux. It's probably one of the best choices I have made in my life.
@TheArrowedKnee
6 ай бұрын
If they move to a subscription i'll probably move too. For now i just can't be bothered moving over for a slew of reasons.
@user-cy1rm5vb7i
6 ай бұрын
why not do it right now? It's out there and free to use.
@mad_t
6 ай бұрын
oh gosh, how many times did I hear that already. Linux will win, windows will die. Did you actually use Linux Desktop for like a year or two? I did. The best thing I can say is that this is definitely not for everyone. When kernel update can ruin your video or audio. If it even works in the first place of course, because it's another adventure in some cases. Or when you don't have a proper driver for your device because its vendor doesn't give a sh*t about linux. And etc etc Linux is perfect for server and is a challenge for desktop usage. And it won't change. The biggest pro of linux is it's biggest con. You're not limited by anything. And unfortunately you're not limited with your DE. It's a hell to develop a gui app for linux.
In VS Code of you right-click on a file or folder, there is not only the "copy path" option, but also "Open in integrated Terminal". This will open a new terminal instance in the folder (or the folder of the file)
you could use wsl2 to run the linux build on the computer in the office or use the wmware esxi. i’ve used the esxi in the past and it was quite simple to set up.
@SeishukuS12
6 ай бұрын
This is what I typically do for quick build/test, but the lack of hardware Vulkan support in WSL kinda sucks. I will still occasionally reboot into native Linux and do a full build/run to make sure, but usually if it runs in WSL with the softpipe LLVM Vulkan renderer, it'll run native.
On Linux, Vscode + Clangd Is Comfortable To Developing It Helps A Lot In Cpp Developing❤
@user-cy1rm5vb7i
6 ай бұрын
vscode + clangd is comfortable development even under Шindows
@MolassesLover
6 ай бұрын
@@user-cy1rm5vb7i Comfortable development under Windows isn't a thing
@khuntasaurus88
6 ай бұрын
@@MolassesLoversounds like you're just a bad developer if your OS blocks your development
@mgord9518
6 ай бұрын
@@khuntasaurus88Or that Windows just isn't a good system to develop on for countless reasons
@Zandman26
6 ай бұрын
@@khuntasaurus88 You can develop on a toaster if that makes you think you are a better developer. But I've heard Windows users claim that "use what works best" and in this case both Mac and Linux blows Windows out of the water.
Just switched to linux about two weeks ago. And after two weeks of tinkering around, I can say I don't miss windows. I have control over literally everything. So glad to see devs supporting linux. Now I just hope that someone makes a powerful audio middleware for it. Have been using wwise for so long, I need something similar for my workflow. Or maybe I'll just make it myself haha.
@loli42
6 ай бұрын
are you wearing girl clothes yet
@neo_uwuowo
6 ай бұрын
@@loli42lmao
@kuhluhOG
6 ай бұрын
@@loli42 well, there are these ones, and then there are neckbeards
@loli42
6 ай бұрын
@@kuhluhOG woah, i've been defined...
I have been daily driving PopOS for over a year now, use it both for work and play. Lovely project, stable and with the Cosmic DE in store within the next year things are truly looking great. Couldn’t be happier!
@user-yi8uz2ph1y
5 ай бұрын
Cant wait for cosmic de
Let's go! I daily drive Linux on my laptop and my desktop (all computers I regularly use,) and, while wine usually works for many things, it usually has quirks that make the experience worse. It's nice to have native support
You could make the computer at your office spin up a VM or Container and use that to build and test. Or have it always have one Windows VM, and one Linux VM running.
@lesterdarke
6 ай бұрын
I did wonder about just running it on WSL?
@jonathanfaller1894
6 ай бұрын
@@lesterdarkeI don't think that would work cause WSL is more of a layer on top of the windows ci
@jonathanfaller1894
6 ай бұрын
I came to the comments to suggest this! I would just run an ubuntu docker container and use that as a self hosted runner
@Quarky_
6 ай бұрын
@@jonathanfaller1894what do you mean by Wimdows CI? WSL is a VM. That's why when you set it up, you choose a distro to install.
@throwaway6380
6 ай бұрын
Of course, but he needed a way to force in the sponsor
Could you do a special video on building systems such as cmake or premake , or customizable ones like bazel . How do import the runtime with the building step . how to strip/ sperate the apis from the BCL
This is great news!
Great vid! Just wondering if Hazel will ever be brought to macOS (through moltenVK) considering the compilation for Linux uses clang already?
Will probably try the linux version
Finally!
I follow Hazel 2D serial and building it for Linux with GCC. What I had noticed is that building time is so much higher than building it with msvc on Windows. Does anyone noticed something similar?
And do not forget another compiler may come with another implementation of the standard library (somehow many people forget that) ...
@phusicus_404
6 ай бұрын
It mist certainly will
hi cherno which gui framework do you use in c++ will it work for my fyp project of taking data from sensors and making gui app for showing it?
@TheCherno why not to boot WSL inside your windows machine and use it's clang compiler?
hey Cherno, is your C++ tutorial playlist complete? If i want to learn c++ do you recommend just watching your playlist or follow a more stuctured course as a supplement as well?
- If you want to have only one CI computer, wsl could be a solution!? - i don't know for visual studio, but with gcc and clang, the compile option "-pedantic" will emit warnings (or errors, if "-Werror" is set) if you use non standard things
great!
YES!!!!
It's awesome when hard work turns out into successful real things like this! Congratulations, you should open a bottle of champagne :)
Yes
I would have gone with WSL or a VM, but using a VPS works too. That VSCode ssh thing seems really interesting, I'll have to check that out at some point.
@eucompsa
6 ай бұрын
Not so much with building per se, but gdb debugging between WSL and VS/VSCode is super janky at the moment…
@Mallchad
6 ай бұрын
@@eucompsa you should treat WSL2 as a remote machine and debug remotely as appropriate if you aren't already
What region are you using for the server? When I've used remote SSH and had it set to a different country since coworkers are in those countries (I'm in Australia) then it has been painfully slow.
I switched from Windows to Linux about a month ago, and I have no plans on going back. So, thanks.
What I think a good solution for the linux Github actions is running a hypervisor server.(VMware or Proxmox), Have 2 virtual machines, Windows runner and linux runner. With this solution, You will have One computer instead of having multiple computers taking space. I have a homelab running in my home that has multiple virtual machines, One is a self hosted gitlab instance, one is a gitlab runner which runs all my CI whenever my code pushes. Overkill for me but I think this solution is perfect for your case.
finally thank you 🥲🥲🥲
Have you thought about using docker as a build environment for Linux? That way you could still use the same build server you currently have for windows, with the only extra requisite of it having docker installed there. It would also improve the build and fix experience for linux builds on non-linux computers when something fails, and it’s a great way to quickly get into the project without having to setup your environment. I’d happily take a look at it and try to submit a PR, but the repo is private.
@jordan4220
6 ай бұрын
Can't run windows in docker.. looks like the engine was designed with windows in mind initially so you'd still want a Windows environment to test the build
Yay! Good times...
GOOOD. EMBRACE THE LINUX COMMUNITY!!!!
I think clang and gcc runs on Windows? used clang for a simple windows program once... On an other note I normally use gcc and clang together to confirm that the code works across multiple compilers, also neovim for the win with extensions over vs code :P
Wow Wow Wow!
YESSSSSS!
Can not just use the same machine and install a hypervisor on it? Something like Proxmox or ESXi and install both Windows and linux to it. Another option could have been is WSL. To add to this, you could have made a backup of the entire current windows install disk as an iso and then virtualise it.
Cool, now I can try it. Ye some ppl use linux as desktop.
you could have just ran a linux VM on your existing CI machine would be nice to explore what differences there are between the linux and windows version, eg if you are using any win32 api things on windows, what are the alternatives on linux? or even if not big things like that, what code did you have that worked on windows but needed changing to build on linux
Regarding people not writing 100% compliant C++, it is important to note that the C++ standard historically followed common practice to somewhat align implementations rather than prescribe what compilers have to do. Therefore, it is questionable whether it is even possible to write fully compliant code. I suppose yes, you can follow the modern standards to the word, but compilers will still behave differently because they don't strictly follow the rules, even if only for backward compatibility with older versions no matter how wrong the behavior is.
...maybe I can look into this engine But I'm also working on my own engine on Linux Yeah, Linux..."it just werked", the remote ssh is also godsend!
I wonder if Windows Subsystem for Linux (WSL) was considered.
Why not set up a linux VM on the build machine?
Did you try building Hazel on Windows using GCC from MSYS2? Or well, Clang from MSYS2 rather. From what I understand that should make the source code of both versions more similar, actually I've been using only GCC from MSYS2 for Windows for a while now and it works pretty well I think, with Premake too. Also if you want to, feel free to ask me to test this stuff. My hardware doesn't have Vulkan drivers on Windows -ye it's ancient- but Mesa provides me experimental Vulkan 1.1 drivers for Linux, I don't know what version Hazel uses. Also I'm friends with Emily~ bye have a nice one
Heck, yeah! Definitely keep it that way. Freedom is invaluable. Linux is freedom. :D
Why not use a VM on the windows machine to run the Linux runner?
Can you show premake's part of Linux?
I'm not sure how well supported Linux gui apps on windows is (using wsl) buut it is an option, else just firing up a full hyper-v virtual machine, I useto run one using a Windows VM with shared Gpu resources (on a single 1080ti) and you could game in the virtual machine really well, im guessing a Linux VM should be possible too,
What's "Dist" I knew about "debug" and "release". I'm assuming dist means distribution but wouldn't you just use the release version.
Cherno always looks like he just woke up. Or hasn't slept. As a fellow programmer. Program your body. It's a machine too. Take care of it like you do your PC for your mind. Also, WGPU-native would make Hazel work on all platforms. 🤙
great news! I left windows for linux years ago, life is objectively better now.
Can someone tell me the advantages of using hazel over another engine?
You should virtualize the testing agents and run them on the same physical hardware. We use proxmox for this, an open source hypervistor running ~12 agents. I guess docker would also be a clean solution, assuming you have a debug renderer backend or headless mode. Even wsl could work.
@hipno3477
6 ай бұрын
+1
@TheShadoDragon
6 ай бұрын
Although this would add additional complexities once you need access to the GPU to test whether everything renders the same. Thought you could have multiple GPUs in your host and use GPU paththrough into some VM to test the rendering.,
@stormsoendergaard3023
6 ай бұрын
@@TheShadoDragon This is kinda what we are doing.
Run testing in WSL2. Then you can run WIndows and Linux parallel.
Since the ci machine runs windows, why not WSL (windows subsystem linux), and use systemd to run your action runner?
You've inspired me Tav to finally take a real crack at breaking through with my own engine, basically I decided to do what nobody has done and make one everyone can use, I used an older engine that doesn't function very well as a base for the rewritten c++23 and a special engine design I'm hoping will change everything for the future, thanks for what you do man you're definitely my kind of youtuber
Hail from Carnegie Mellon University, YOU HAVEN'T BEEN USING Remote - SSH?!?!!?! Impressive
Why can’t it simply use clang from the get go? As that isn’t that uncommon for Windows either then it would at least reduce compiler dependency issues (Also it’s easy to build) I guess with the window wrapper it’s easier to port? But maybe not so much if you need one of the closed platforms. There are other CI‘s like travis and stuff which a lot of people use for there runners.
@not_ever
6 ай бұрын
Using multiple compilers is recommended anyway as they each can catch different bugs/undefined behaviour and warn about different things.
Is there any other way than Patreon to support Hazel and get access to the sources? Patreon doesn't really work out for me for a few reasons, so having some other way to support Hazel and be able to work with the code would be highly appreciated!
I may have missed something ! But...does this mean Hazel will run on a Mac now ?
Congrats! Linux is great.
Yay :)
Interesting
I have linux everyday. i plan on keeping it that way
I would try to build with ninja instead of make. especially for big projects. maybe it can speed up CI for you
Can't you just build and test the linux build on wsl or is that not comparable?
Have you considered using cmake?
Quite an offtopic question: Does anyone here know how to use VS Code with Clang without MinGW, Cigwin or anything similar on Windows?
Sometimes just getting an open source project mostly working on Linux will give people who want to make commits a good starting point. bbs-fw for the Bafang eBike motors doesn't have any linux support what so ever. Setting the correct working directory, compiling, exporting the hex binary and then flashing the firmware with the stcgal with the 20MHz clock command line switch, is a COMPLETE nightmare. I'm absolutely one to talk about providing Linux support, as I have not documented this on their github, but it's a lot of work and requires a lot of almost undocumentable amount of commits.
What about using containerized builds? Or using WSL on windows?
@ccflan
6 ай бұрын
yes but why, if it was just for flexing then it just waste of time, WSL does not fully support HW acceleration for gpu unless some attemps like Nvidia, better to not complicate life unless if some requirements force it
@NeUrOmAnCeRAI
6 ай бұрын
@@ccflan crap you're right *facepalm*
@NeUrOmAnCeRAI
6 ай бұрын
Well atleast with a containerized build, you will have a consistent build.
how big in size is Hazel Engine in total, latest Version?
now i want hazel on macos
LESSSSSSSSSSSSSSSSSSSSS GOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!1
Are there plans on getting Hazel build on macOS :) ?
What is dist build?