8 ms·
Using Rust in Windows
- gepi79 10y agoThanks. I made a complementary guide to use the visual studio build tools 2017. http://lustysociety.org/programming/how_to_rust_language_visual_studio_2017_windows_10 http://lustysociety.org/programming/how_to_rust_language_vis...
- Animats 10y agoWhat's the situation with using the Windows API from Rust? Are you down at the Win32 API level, or can you even do that?
- lifthrasiir 10y agoWinapi-rs [1] is the de-facto binding for the Windows API and covers a lot of them (but not yet complete). I don't see a significant project for higher-level bindings. [1] https://github.com/retep998/winapi-rs/ https://github.com/retep998/winapi-rs/
- qdot76367 10y agoThere's also the winrt crate for getting at uwp apis. https://github.com/contextfree/winrt-rust https://github.com/contextfree/winrt-rust
- frik 10y agoInstead of VS try out IntelliJ IDEA with Rust plugin: https://intellij-rust.github.io https://intellij-rust.github.io It gives you the comfort features known from the IntelliJ platform and doesn't add phonehome telemetry to your exe files (like VS2k15).
- jsmeaton 10y agoHave you got a source for the telemetry inside the compiled binary claim?
- yuriks 10y agoIt was something a specific patch version (of Update 2, iirc) did which was blown way out of proportion. The CRT in that version sent two events on startup and shutdown to the windows event tracing/profiling framework. (Which show up in performance analysis tools like WPA.) People just latched onto the scary name.
- oblio 10y agoTo make things even worse (even funnier?), GCC also has something like this, I believe it's this feature: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.h...
- dom0 10y agoProfiling is not telemetry. Telemetry implies that events are supposed to be transmitted off-site (tele + metry = remote + measuring). Profiling writes a local file with statistics.
- frik 10y agohttp://www.slashdot.org/story/312289 http://www.slashdot.org/story/312289 https://www.infoq.com/news/2016/06/visual-cpp-telemetry https://www.infoq.com/news/2016/06/visual-cpp-telemetry Appearently they backed off, due to major outcry. The usual salami tactics. Nevertheless to this day developers compile binaries with the affected compiler version - still in release builds of various up-to-date software.
- josteink 10y agoSeems you migt want to read this sibling comment: https://news.ycombinator.com/item?id=13974771 https://news.ycombinator.com/item?id=13974771
- KangooDude 10y agoGuy got down-voted for providing an excellent free alternative and mentioned the fact that it linker / libraries indeed does not add crap to your code. Btw Microsoft representative itself called it telemetry, confirm they added it without any warning, cloud it all in high grade bullshitspeak, while order for removing it in hurry, or just rename/disguise functions "to remove any suspicions" as they do with spying (sorry, complete anonymous telemetry that helps to improve the product) services in Windows 10? https://www.reddit.com/r/cpp/comments/4ibauu/visual_studio_adding_telemetry_function_calls_to/ https://www.reddit.com/r/cpp/comments/4ibauu/visual_studio_a...
- Arnavion 10y agoAlso, if using VS2017, you may also have to set the env var `VisualStudioVersion` to `15.0` to get some cmake-using crates (libssh2-sys, etc) to build. See https://github.com/alexcrichton/cmake-rs/pull/16#issuecomment-285932296 https://github.com/alexcrichton/cmake-rs/pull/16#issuecommen... (Note that 15.0 == VS2017, not VS2015)
- topbanana 10y agoOr run Cargo from the VS 2017 developer command prompt
- tracker1 10y agoI should really find some time to upgrade to VS2017, my understanding is it's a bit faster than VS2015, not just the install. Can anyone comment on this, I always found VS to be a beast, even on an SSD, HDDs being nearly unbearable. I really do like VS Code though... looks like there's some work going there.
- ranveeraggarwal 10y agoVS17 has an option to "quick load" projects. It loads up in a jiffy (unlike it's previous versions), but you cannot use some of the IDE features. I seriously hope they add a lazy load feature in the future.
- oblio 10y agoIsn't quick load just a rename of lazy load, based on your description?
- ranveeraggarwal 10y agoNope, apparently quick load doesn't load several IDE features at all. What I mean by lazy load is that it should incrementally load the IDE features after the IDE starts.
- StavrosK 10y agoJeez, the obvious optimization would have been to load some of the features first and then load the rest, but to not load them at all? That's not very useful.
- oblio 10y agoWell, as a back-seat commenter I agree with you but they probably had a good reason to not do it. Most likely something to do with development complexity. There's a ton of smart people working on Visual Studio, I'm willing to trust their judgment on this :)
- ranveeraggarwal 10y agoI personally prefer lxss. While it has some limitations, I am yet to face issues with rust projects. You can also use Intellij-based IDEs with a rust plugin and run `bash` in the command prompt accompanying the IDE. It feels like working on Linux ^_^
- Longhanks 10y agoWell, because the userland IS Linux (or what people refer to as Linux on the desktop). But binaries are also ELF binaries and can only be run with lxss. How do you deploy to Windows customers who are not developers?
- ranveeraggarwal 10y agoYep, you're right. I was thinking about it from an easy to set up development environment perspective.
- problems 10y agoYou dev on linux, try your best to write in a cross-platform way - then only once you've got something that works and you're fairly motivated to actually do something with it, go through the hassle to make a Windows build.
- deleted 10y ago[deleted]
- steveklabnik 10y agoQuick warning about lxss: if you access any of your stuff from a Windows program, it can trash the whole partition. Source: I'm just using regular old Windows now...
- joaomoreno 10y agoVisual Studio Code has a pretty decent Rust extension: https://marketplace.visualstudio.com/items?itemName=kalitaalexey.vscode-rust https://marketplace.visualstudio.com/items?itemName=kalitaal...
- steveklabnik 10y agoNote that this is the up-to-date fork of the older "RustyCode" extension.
- vog 10y agoDoes is also work with the Free-Software MinGW toolchain? That would make it possible to generate Windows binaries without having to run a Windows VM, through cross-compiling, using e.g. MXE: http://mxe.cc/ http://mxe.cc/
- jix 10y agoIt does. It supports mingw on windows as well as cross-compiling from linux using cargo (rust's package manager and build tool). Installing mingw-w64 from my distribution's package manager and telling cargo where to find its linker and assembler was all I needed to cross compile stand alone windows binaries of some command line tools I wrote.
- rukenshia 10y agoIt's way too hard to get anything that requires OpenSSL to work, I decided not to write Rust code on my windows PC because of that. I remember the process of just getting it to work as really painful and time consuming. Other than that I really enjoy writing rust code on my Linux machine.
- wink 10y ago+1 to the openssl problems. For me it was only stopping my investigations into hyper and other web stuff (on windows), just writing CLI and GUI apps works fine on Windows. (I use VS Code and a git bash)
- cube2222 10y agoYou can also just use it on Bash on Ubuntu on Windows.
- Longhanks 10y agoThen you can't deploy to end users on Windows.
- izacus 10y agoConsidering the fact that Windows has it's own SSL API and most apps don't use OpenSSL - any reason you're not using the native stack?
- aidanhs 10y agoFwiw, native-tls [0] is intended to solve this problem for the set of uses involving TLS (e.g. hyper [1], reqwest) by using the defacto standard on the platform you're on. This means no openssl is necessary on Windows. Longer term, I would like to see some way for a crate consumer to optionally replace openssl with ring [2] where possible. But that's a harder problem, figuring out a common interface, specifying two crates satisfy that interface and are swappable by cargo...classic package management problems really. [0] https://github.com/sfackler/rust-native-tls https://github.com/sfackler/rust-native-tls [1] https://docs.rs/hyper-native-tls/0.2.2/hyper_native_tls/ https://docs.rs/hyper-native-tls/0.2.2/hyper_native_tls/ [2] https://github.com/briansmith/ring https://github.com/briansmith/ring
- steveklabnik 10y agoI recently switched to using Windows full-time. It started off using the Linux subsystem, but then I accidentally trashed it. So I'm now using native Windows. Powershell is surprisingly easy to adapt to, and while I still use vim often, I've been enjoying occasional use of VS: Code. Most stuff Just Works, but there are still some rough edges. A lot of them are simply "I'm not used to the Windows Way" yet instead of Rust problems, though.
- egeozcan 10y agoHow did you manage to trash the WSL? I'm not suggesting that it's hard to do or anything, just genuinely curious.
- steveklabnik 10y agoI decided to try using VS: Code (which was installed under Windows) to work on my projects. Opening a file ends up trashing it entirely. This is actually expected behavior; I just wasn't aware :(
- kej 10y agoFor what it's worth, `lxrun /uninstall /y /full` followed by `lxrun /install /y` will put the WSL environment back to "factory settings". Then as long as you don't try to look into the WSL side from Windows you'll be fine.
- steveklabnik 10y agoTotally. I just decided it was a good opportunity to actually move to Windows for real :)
- slrz 10y agoWhat? Files get trashed by just opening them? This is supposed to be expected behaviour?
- 10y ago
- jayflux 10y agoIs VisualRust still active? It seems dead or moving very slowly. I know there's some commits going into the project, but their last release was over a year ago.
- vvanders 10y agoBeen working with Rust on Windows for almost a year now. My go-to is VSCode + Rust plugin. You get the same debugging as VS2015 via C++ plugin(they both use the same backend). Only time I need to drop over to MSVC is if I need data breakpoints or look at disassembly(usually when I'm dealing with a C library that's misbehaving). VSCode rust plugin gets you racer, rustfmt and a bunch of other goodies(cargo test/check right in the IDE).
- btkramer9 10y agoHave you found any good resource on setting up the debugger for rust in VSCode? I've been having issues getting this running smoothly and have found very little support online
- steveklabnik 10y agoI am literally fighting with this right now. LLDB is not a happy camper.
- vvanders 10y agoYeah, MSVC target tends to work much better(although viewing of some more complex types doesn't work yet).
- steveklabnik 10y agoI'm using the MSVC build of Rust. That doesn't preclude using lldb as a debugger.
- vvanders 10y agoYeah, I meant MSVC debug backend.