4 ms·
It's not just target platforms, it's also build flags; you could do the default for debug and release, but set any sort of custom option and you're back to squa
by steveklabnik 6y ago
It's not just target platforms, it's also build flags; you could do the default for debug and release, but set any sort of custom option and you're back to square 1.
We would also need to pay for the cost and such of building, hosting, and distributing all of that...
There are other middle grounds too. There's certainly interest, it's just not trivial. If it was, we'd do it!
- pjmlp 6y agoHave you watched Swift related announcements at WWDC? Package manager support for binary dependencies is coming with Big Sur.
- steveklabnik 6y agoNot yet. The most valuable company in the world has significantly more resources than we do.
- jka 6y agoWith hope for the presence of positive-minded folks with contribution time to spare: any suggestions of areas that could use help towards binary builds?
- steveklabnik 6y agoI would reach out to the Cargo team: https://www.rust-lang.org/governance/teams/dev-tools https://www.rust-lang.org/governance/teams/dev-tools
- littlestymaar 6y agoApple controlling the hardware makes it way easier though. At home, I compile Rust with CPU-specific features on about as many different hardware as Apple for their whole ecosystem!
- masklinn 6y ago> Apple controlling the hardware makes it way easier though. I'm not sure that's really relevant. Rather: * apple has resources, lots * apple wants to promote the use of swift, making it easier and more convenient is a good way to do that, binary dependencies reduce the complexity of the build process because you don't need to build dependencies * apple has a vibrant ecosystem of small closed-source shops, binary-only distribution is useful for those, as well as for themselves * promoting binary and eventually dynamically linked dependencies might mean the ability to dedup' on-system dependencies
- O_H_E 6y agoI believe what they meant was that Apple needs to support less hardware variations. Compilers frequently have a host of flags that depend on CPU features which can potentially make the code behave slightly differently. If cargo was to implement this, they need to compile each package many times (with different configs) more than apple need to do so for Swift. And yes of course it is given that apple's resources is vast to say the least.
- masklinn 6y ago> I believe what they meant was that Apple needs to support less hardware variations. I understand that very well. My point is that they wouldn’t be doing it regardless if they didn’t want to, and if they really want to (for reasons I outlined) they have the resources to make it happen essentially regardless of the constraints or hardware breadth.
- pjmlp 6y agoApple also took a multi-year effort of designing a stable ABI for Swift as means to enable exactly this scenario.
- lilyball 6y agoThe stable ABI was so Apple could ship Swift in the system. The fact that it enabled binary dependencies was more of a freebie.
- lilyball 6y agoBinary dependencies are really about supporting closed-source libraries. Because they’re in binary form it means there’s no ability to customize the build process, no build flags or optimization levels or anything else. Apple also relies heavily on dynamic linking in general, so binary dependencies are likely going to dynamically link their own dependencies, thus removing a lot of the variability that would otherwise require recompilation.
- pjmlp 6y agoIf Rust is to be taken seriously as systems programming language, it needs to cater to a use case that is very important for a large set of C, C++ and Ada population. Apple is doing this, because Swift is their next-gen systems programming language. Swift supports static linking just fine as well. Really, it is all a matter of which demographics Rust wants to be present. And with Rust now being adopted by Microsoft and Google, I just see this need only increasing.
- harikb 6y agoWhile I agree with your statement, the lack of binary linking has been a blessing in Go and Rust. The inability to give a binary "SDK" forces many companies to provide source (and in many cases open-source their library). I would find it very irritating if I can't navigate into the library source at least during debugging.
- pjmlp 6y agoGo tooling supports binary dependencies, where the only source provided by the packages is the documentation for go doc. It just looks like everything is source code when not taking the effort to read through all dependencies. It doesn't force companies at all, only those that are comfortable shipping source libraries end up adopting such languages. I used to work for a company that shipped encrypted Tcl source code and provided the necessary interpreter hooks to access the code in its encrypted form.
- 6y ago
- matthewaveryusa 6y agoJust out of curiosity, How does rust prevent the Gentoo issue of: you can compile with custom flags, but most projects have only been tested with specific flags and if you change them they will break the build, so really, no customer flags. It always starts off with custom flags and ends up ossifying to the default-only flags.
- ohazi 6y agoMost of the flags tell the Rust compiler what strategies to use when producing machine code. Actual Rust code rarely looks at these flags, so correct interpretation of the program generally isn't affected by them. Contrast this with C and C++, where it's common to #ifdef in an entirely different program depending on the flags. It's certainly possible to do something like this in Rust, but in practice it's rare.
- kibwen 6y agoI'm guessing that when the parent says "custom options" they're referring to libraries providing their own customization options via "crate features" (https://doc.rust-lang.org/cargo/reference/features.html https://doc.rust-lang.org/cargo/reference/features.html ). Not only do libraries have an incentive to test that their own feature flags work, but also these feature flags avoid combinatorial explosion (and are easier to test) because feature flags must be additive due to how Cargo is designed: every feature flag must function the same even in the presence of any combination of the rest (flags must not be exclusive with each other). On the other hand, I'm guessing that by "custom flags" you're referring to compiler-level flags that influence codegen, which rustc doesn't have that many of, and most of the ones that rustc does have are for controlling things that people might reasonably expect to be nontrivial work to change in the first place (e.g. linker/symbol options, cross-compilation/platform options, LLVM/gritty optimization/instrumentation options). Of the rustc codegen options that ordinary users might want to play around with, I see only two: one for turning off arithmetic overflow checks (which makes all integers act like their overflowing equivalents from the stdlib), and one for determining the general strategy of what happens when a panic occurs. The latter is unlikely to cause problems because the default behavior is a superset of the configurable behavior, and for the former any silent problems in misconfigured users would manifest as panics for everyone else, so there's a good chance the problem would be fixed upstream regardless.