TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rust is actually portable

355 pointsby ahgamutalmost 3 years ago

10 comments

mihaigalosalmost 3 years ago
&gt; I’d like a bit more flexibility in specifying what I want cargo to do.<p>Check out Bazel for Rust.<p>It allows:<p>* caching of artifacts.<p>* shareable caches between {developers, build jobs} based on hashes.<p>* remote distributed builds (on very many cores).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;cargo-raze" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;cargo-raze</a>
评论 #32261390 未加载
评论 #32263164 未加载
评论 #32261470 未加载
评论 #32261170 未加载
评论 #32260906 未加载
评论 #32260861 未加载
评论 #32264826 未加载
评论 #32261999 未加载
评论 #32290131 未加载
评论 #32262892 未加载
评论 #32260923 未加载
评论 #32260791 未加载
csomaralmost 3 years ago
I feel some of the OP points. I was working on a profiling agent lately, and one of the issues was running it on multiple platforms (just the four big ones linux&#x2F;mac-x86&#x2F;arm) on FFI (because it&#x27;ll be run directly from python&#x2F;ruby&#x2F;etc...) and <i>preferably</i> having the thing just work without having to install or configure any dependencies.<p>Like OP I hit two walls: libunwind, and linking. For libunwind, I ended up downloading&#x2F;compiling manually; and for linking there is auditwheel[1]. Although it is a Python tool, I did actually end up using it for Ruby (by creating a &quot;fake python package&quot;, and then copying the linked dependencies).<p>It was at that time that I learned about linking for dynamic libraries, patchelf and there is really no single&#x2F;established tool to do this. I thought there should be something but most people seem to install the dependencies with any certain software. I also found, the hard way, that you still have to deal with gcc&#x2F;c when working with Rust. It does isolate you from many stuff, but for many things there is no work around.<p>There is a performance hit to this strategy, however, since shared dynamic libraries will be used by all the running programs that need them; whereas my solution will run its own instance. It made me wonder if wasm will come up with something similar without affecting portability.<p>Finally, the project is open source and you can browse the code here: <a href="https:&#x2F;&#x2F;github.com&#x2F;pyroscope-io&#x2F;pyroscope-rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pyroscope-io&#x2F;pyroscope-rs</a><p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;pypa&#x2F;auditwheel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pypa&#x2F;auditwheel</a>
forrestthewoodsalmost 3 years ago
Is compiling once and running on 6 platforms really that compelling? One of Rust’s super powers is that it’s really easy to write code once that can be compiled N times for N platforms without making any changes.<p>I’m all about writing code once. But compiling a few times doesn’t seem like that big of a deal to me?<p>The article says it runs on “six operating systems” but I can’t find them listed?
评论 #32261057 未加载
评论 #32261175 未加载
评论 #32261040 未加载
评论 #32261068 未加载
评论 #32261082 未加载
评论 #32261042 未加载
评论 #32261033 未加载
logankeenanalmost 3 years ago
I’ve found rust incredibly portable. I’ve hacked around running the same server side app on the web (WASM), PC&#x2F;Mac&#x2F;Linux, iOS, and Android. Another project is a web app running on iOS and Android leveraging a SQLite DB.
zapharalmost 3 years ago
<p><pre><code> I’d change a configuration flag, some part of std would break because my flag was wrong, and I’d learn something new about Rust and how std worked. </code></pre> The project was probably worth doing just because of this. Breaking things in a safe environment is such a great way to learn how it all works.
techdragonalmost 3 years ago
While I love this sort of portability and in particular how it just makes Rust even more useful to me.<p>The library this is built on does have a bit of a weakness with respect to GUI software <a href="https:&#x2F;&#x2F;github.com&#x2F;jart&#x2F;cosmopolitan&#x2F;issues&#x2F;35" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jart&#x2F;cosmopolitan&#x2F;issues&#x2F;35</a> if this can be fixed this will be an amazing tool for building simple cross platform utilities and tools.
manholioalmost 3 years ago
Aside form neatness factor and hacker street cred, I don&#x27;t exactly get the practical point for the vast majority of software. What am I to do with such a binary? Do I put it live on my website and allow my clients to download it? If I leave it with an .exe extension so that it runs in the Windows shell, wouldn&#x27;t that confuse users of other platforms? What if I need a directory structure as 99% of programs do? Do I use a zip or a tgz? In the first case, how do I preserve permissions on Unix targets? Do I need to instruct my clients into how to use tgz on the command line and&#x2F;or create permissions?<p>Software distribution is by its nature a very platform specific problem; even if we accept the premise of an x64 world, an universal binary solves just a very small portion of the practical problems of portable deployment.<p>Ironically, the best use case I can imagine is creating an universal binary installer that can run on any Unix system and then proceed to make platform-specific decisions and extract files contained in itself, sort of like Windows binary installers work. But that&#x27;s an utterly broken distribution model compared to modern package managers.
childintimealmost 3 years ago
Just one question, as suggested by the title: the rust compiler itself could be made portable using this? I guess not, because of its use of multi-threading.
评论 #32262464 未加载
ajrossalmost 3 years ago
&gt; I just built a Rust executable that runs on six operating systems<p>I help maintain a kernel in C that runs on nine architectures, some of which don&#x27;t even have LLVM backends, much less stable rust toolchains.<p>&quot;Portable&quot; means rather different things. This blog post is focused on the easy stuff.
评论 #32266561 未加载
评论 #32266212 未加载
aabbcc1241almost 3 years ago
node.js is also portable with pkg
评论 #32262626 未加载