eteeselink

eteeselink

The Elixir experience on Windows is deteriorating

Hi all,

In the last days, two things happened:

  1. A blog post titled “They might never tell you it’s broken” made the rounds. It’s about how even makers of popular software might not always be told something is wrong.
  2. I spent many hours and went through five different Erlang versions trying to run a bog-standard Phoenix app on my brand new Windows 10 box (and I’m pretty experienced with both Elixir and Windows).

If the Elixir/Erlang teams are aware of this, then please feel free to ignore this entire post. But on the off-chance that most Erlang and Elixir committers are on Mac or Linux, here’s me sharing my personal experience:

It appears to me that the Elixir setup experience has gradually deteriorated on Windows to the point that I expect newbies would simply give up. I’ve (helped) set Elixir up on a fair number of Windows boxes over the last 3 years or so, and it seems like a new hurdle is added every next time I try.

Worse, it is my impression that Windows itself is getting increasingly popular among developers again. I worry that my experiences in the last few months are an indication of what any Windows user has to go through to try out Elixir, and that this will hurt Elixir adoption.

This is just too hard. Ideally, running elixir-websetup.exe should be enough to compile and run Elixir code. It used to be, but it isn’t anymore.

To be fair, I don’t think I’m in a good position to help much with this. This post can well be read as the generic “open source user complaining about stuff he’s been given for free”. I just want to make sure that the teams involved are aware that this is going on, because it would suck if everybody thinks that Elixir works great on Windows.

In other words, I’m not sure what the solution is.


If you’re interested in more detail, here’s my experience. Feel free to skip this part, it’s just for context and not important to the core point. Much of the following is from memory, so sorry if I got some details wrong.

When I started on Elixir a few years ago, it was amazing. Get the Elixir installer, it fetches Erlang, copy&paste the magic Phoenix archive incantation and off you go. Awesome!

Then came Phoenix’s Comeonin dependency in Phoenix, which added a NIF compilation requirement, which requires Visual Studio Build Tools (a whopping 4.6gb), but OK. That’s still pretty straight forward, just some hassle. It truly sucks on small computers though, because the build tools are so enormous (4.6gb for a C++ compiler? srsly microsoft?). I wish Elixir had some way to ship NIF binaries from Hex, somehow. BUT! At least this works, and it’s pretty well documented and google-able, even though MS keeps breaking the various download links scattered across the web. This is clearly down to Microsoft making it way too hard to compile stuff for its OS (get this: getting GCC on WSL is faster than getting command-line MSVC running!). But it still impacts Elixir.

Today however, when setting up my brand new laptop, I found myself messing around with five different Erlang versions before I got the right combination of luck. I’m pretty experienced with both Elixir dev and Windows “power usage” yet it took me many hours to get our bog-standard Phoenix backend to compile.

Here’s what I did:

  • Elixir websetup installs the latest Erlang. Seems fine, but running mix local.hex exits without output and without doing anything. I can’t mix deps.get without it so I’m stuck.
  • Hmm, elixir --version says that it was built on OTP 20. Maybe I need OTP 20? Let’s try that.
  • Nop, didn’t help. Turns out that I was running the 64-bit Erlang, which can’t run crypto code and therefore mix local.hex crashes without output. That Erlang bug was closed as a “can’t repro” but I’ve had this exact problem on three clean Windows boxes in the last 4 months. Should’ve taken notes the first 2 times. And I should’ve tried to get that Erlang bug reopened. Will try today.
  • OK so, apparently 32-bit Erlang is needed. Fine, I don’t think I’ll need 4GB of RAM anyway. Let’s try the latest, 22.1. Uninstall Elixir & Erlang, install Erlang-32bit, reinstall Elixir. Cool, compiling our backend works, run works, but now I’m getting a Postgrex error that some tuple doesn’t implement String.Chars. Some googling around suggests that maybe it’s a thing with the latest OTP. Not sure that’s the same error, but OK, let’s try.
  • Ok so, remove build artifacts, uninstall elixir, uninstall erlang, get erlang 22.0, reinstall Elixir, rebuild. Nop, can’t compile! Calendar.ISO can’t be found. Right.
  • Let’s try the OTP Elixir was built with then, but now in 32-bits mode, i.e. Erlang 20.3. Uninstall everything again, install everything again, great! Now it works.

Finally, now it works. Of course, IEx is still the only REPL on my box that doesn’t let me press “up” or “down” to go through the command history, but I’ve gotten used to that by now.

Just to reiterate: I’m not trying to complain about something I’ve been given for free. My company exists thanks to Elixir, so I’m deeply grateful. I think that for lack of time to contribute substantial open source back to the community, the least I can do is make sure problems are noted.

I didn’t make this a GitHub issue because I feel that it’s a more general thing, not a specific bug. Much of it might even be specific to Erlang rather than Elixir (but that doesn’t make it impact the Elixir experience any less).

First 10 of 63 Posts! Switch mode

mbuhot

mbuhot

Is WSL a viable option?

aesmail

aesmail

Of course, IEx is still the only REPL on my box that doesn’t let me press “up” or “down” to go through the command history, but I’ve gotten used to that by now.

Shell history is disabled by default. You can easily enable it by putting the following in your .profile or the Windows equivalent:
export ERL_AFLAGS="-kernel shell_history enabled"
Might need to adjust for windows-specific terminologies.

NobbZ

NobbZ

He isn’t talking about that, but more about the fact, that erl in windows does not support tab completion and arrow navigation at all. Thats because of how the windows terminal works.

It provides the --werl flag though, which will start in its own terminal emulator, which does support advanced input methods, but still not colored output.

iex, which basically just wraps elixir syntax over erl, does provide the same flag IIRC.

aesmail

aesmail

Ah! Interesting. I didn’t know about that. I guess I’m taking a few things for granted :smile:

I think, when observing the general open source community, the majority of developers use either macOS or Linux, hence the inferior state of support for Windows currently for some relatively big projects. Although, Windows is trying hard to be compatible and more open-source friendly. The efforts are noticeable, but it still needs time.

NobbZ

NobbZ

To be honest, most of the experience you describe is pretty much the same with any language on windows. As long as you stay pure, everything will work well.

Though as soon as you try to do some FFI of any kind, you are basically lost…

The erlang installation experience you had is sad, but to be honest, we had our erlang dependency hickups on linux as well.

cnck1387

cnck1387

This probably isn’t the answer you want to hear but I never had any problem with any programming run time (Elixir, Ruby, Python, Node) when running things in Docker while using Windows.

Native dependencies get compiled within a Linux based Docker image which has the benefit of not needing anything Windows specific to be installed.

So while a Windows environment straight up might be bad, you have options to make it be very good. There’s also WSL too. I have been using it in combination with Docker full time for years, it’s wonderful on all fronts (things just work and it’s fast), but you can also use WSL on its own without Docker too.

sd4code

sd4code

Well, its the application of running a server program in a consumer environment is whats wrong with running something inside windows 10. Interesting that its tripping up on a c++ compiler. There is a lot of flaws with c++, that is why I’m going away from php. The Java is c++ based, I don’t know if cowboy web server is, but it would be interesting if it is, and if it has the same dom /c++ vulnerabilities like the other ones.

josevalim

josevalim

Creator of Elixir

Unfortunately, we don’t have the knowledge required to maintain “elixir-websetup.exs”. So if someone is interested in improving the Windows experience, please do! We would really appreciate it: GitHub - elixir-lang/elixir-windows-setup: Online Elixir Installer powered by Inno Setup · GitHub

Although it is a bit frustrating that the experience got worse. Why code that worked in the past can’t just continue work? :confused:

To be clear:

  • Phoenix does not depend on comeonin
  • Comeonin has an algorithm (Pbkdf2) that does not have native dependencies. That’s also the algorithm we picked for the Programming Phoenix book precisely because of Windows users

Aye, this is painful indeed. Sorry to hear.

It is the first time I hear about this. So somehow the reports are not surfacing up, thanks for writing one.

I think we can at least do one action here: Ship Erlang/OTP versions in the Elixir installer that are compatible with the precompiled Elixir - this should eliminate at least part of the issue. It has the downside that Windows users will be a bit behind, but if they want to get the latest Erlang, they can always get it in other ways. Thoughts?

However, I am afraid that to use 32-bits by default, we will need to change the installer. I think the installer gives you the option to choose, but it is checked by default depending on your system settings.

Quick question: how did you install Erlang 22.0 on Windows? Did you use Erlang/OTP’s official installer?

Also, please do open up a report on Erlang/OTP about crypto.

Yes, you need to do iex --werl. There is also a USE_WERL environment variable that you can enable to always use werl. Regarding colored output, Windows still does not support ANSI escapes.

EDIT: I also want to add that both the OTP and Elixir team have CIs running on Windows, so it seems most of the issues are in the integration with the moving parts of the OS (crypto, 32vs64bits, etc).

13
Post #8
sd4code

sd4code

Windows is trying to get rid of 32 bit programs on its platform. So is macOS.
But another thing is it might not run well in windows because its not a real time os anymore. So there is no direct hardware calls when windows updated itself.

NobbZ

NobbZ

It never has been…

Last Post!

chouzar

chouzar

Just as a followup, releases work like a charm on Windows. As an added bonus I was able to build the binaries under my local machine (Windows 10) and install and run it on a Windows Server box (with a very different OS version).

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
f0rest8
Hi everyone :waving_hand: Posting here to showcase and announce that Metamorphic is now officially live on a public-facing domain at htt...
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

We're in Beta

About us Mission Statement