An idea to simplify the Odin installation on all platforms #2708
Replies: 2 comments 2 replies
-
I'm all for improving the build process and agree this would make it easier short-term, but there's an art to user-facing (as opposed to CI-style) In theory, the only dependencies we'd need to guarantee a working executable in the hands of a user by the end of the script is An example of a build file that's like 50% there is mmozeiko's automatic build files found in his github, but even those are not meant to be used by, well, users. |
Beta Was this translation helpful? Give feedback.
-
I think it is worth bringing into this discussion that the current major effort has been adding Tilde as a compiler backend for Odin, making LLVM optional. Experimental support is in Once stable, LLVM would still be needed for highly optimized builds, and I think only x86 is supported as of this moment. From there I believe the plan is also to work on compiling to C / C-subset, that can be compiled by any other C compiler, to add further options without needing LLVM. Tangentially, there is also the sister compiler codin that is being worked on, which is taking the more direct approach of compiling to a C subset. |
Beta Was this translation helpful? Give feedback.
-
The installation problem
I'm always frustrated when trying to set up a project, and the installation has many steps, huge development dependencies (like IDEs at dozens of gigabytes), and requires troubleshooting cryptic compile errors (which might need even more package installs of which the exact version is hard to find). Some of this was true for the Odin project.
I usually give up on trying a project if I can't manage to install it in less than 15 minutes. We should aim for less than 5 minutes. Then there will be more people trying Odin and fewer people giving up on installing it.
When editing the installation steps on the website in pull request #139, I afterward thought about removing these installation steps entirely instead of following them and making the installation guide unnecessary.
Here are some ideas on two changes that might simplify and streamline the installation on all platforms and remove some development dependencies and install steps.
The installation solution
The possible solution has two parts to it:
Zig comes pre-built in a ~50 Mb archive and contains Clang, LLD, libc, libc++, etc. That is everything Odin needs to build on all platforms except for LLVM (correct me if I'm wrong), so we bundle LLVM for all platforms. Odin already bundles LLVM for Windows.
Zig (the included tools, not the language) might provide us with the same things as now but smooth out some installation hurdles on the different platforms. If we use it as a development dependency, we might be able to remove other heavier dependencies like Visual Studio and Xcode. Zig might provide a simple cross-platform way to get what we need for Odin development.
If everything works, the installation is the same for all platforms, as follows:
What would this mean for Windows?
What would this mean for MacOS?
What would this mean for Linux?
What would this mean for BSD?
What about the build system implementation?
llvm-config
command are no longer needed. That means the script is massively simplified. No LLVM binaries are longer needed. Thezig c++
command is compatible with Clang and LLD flags since that is what's under the hood. So a drop-in replacement?zig c++
and LLD provided by Zig.zig build
to build Odin on all platforms. Though, that requires writing Zig code. I don't know the Zig language.What about the LLVM bundle implementation?
Other benefits that might materialize:
In closing:
Would this work? Is it beneficial for the Odin project? Is relying on Zig a good idea? Is bundling LLVM for every platform resonable? Have I missed something that breaks this whole idea? There is much to think about and maybe try. Please let me know of any issues or concerns.
Beta Was this translation helpful? Give feedback.
All reactions