yesib0

yesib0

KafkaEx compilation error on Windows

Hello everyone! I’m new here.

I’m trying to use KafkaEx in an app running on Windows 10 , but when I run mix deps.compile, I get an error related to the c++ compiler.

mix deps.get

Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  connection 1.1.0
  crc32cer 0.1.10
  kafka_ex 0.12.1
  kayrock 0.1.14
  varint 1.2.0
* Getting kafka_ex (Hex package)
* Getting kayrock (Hex package)
* Getting connection (Hex package)
* Getting crc32cer (Hex package)
* Getting varint (Hex package)
$ mix deps.compile

==> connection
Compiling 1 file (.ex)
Generated connection app
==> varint
Compiling 2 files (.ex)
Generated varint app
===> Fetching pc (from {git,"https://github.com/blt/port_compiler.git",{tag,"v1.10.2"}})
===> Analyzing applications...
===> Compiling pc
===> Compiling c:/omited_path/kafka_conn_app/deps/crc32cer/c_src/crc32c.c
===> **'cl.exe' is not recognized as an internal or external command,**
operable program or batch file.

==> kafka_conn_app
** (Mix) Could not compile dependency :crc32cer, "escript.exe "c:/Users/Yesid/.mix/rebar3" bare compile --paths c:/omited_path/kafka_conn_app/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile crc32cer", update it with "mix deps.update crc32cer" or clean it with "mix deps.clean crc32cer"

escript.exe is in the $PATH variable and rebar3 exists in the specified path.

I installed Visual Studio Community 2022 with the C++ compilers and ran the .bat file found here;
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
That script sets all the environment variables necessary for the C++ compiler to run.
With this approach I was able to compile the KafkaEx dependency successfully, but I’m trying to find another way to compile it because it’s a bit of a hassle having to run that script every time I want to compile my application’s dependencies.

Elixir version: 1.13.0
Erlang/OTP 24

I really appreciate any help!
Thanks!

Marked As Solved

crispinb

crispinb

Whatever terminal app you use will somewhere have a place to configure the shell (cmd or powershell) startup. Just make sure the relevant vcvars*.bat file is run when starting up your shell.

I used the new Windows Terminal, configured in settings a profile to start with cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && pwsh.exe. That profile is now always equipped with the necessary paths. You could do something similar if you use cmd.exe rather than powershell.

Also Liked

cmo

cmo

You could write a mix alias which does that for you.

Or run it from within the VS developer console, though that’s probably no less hassle then running the script.

Or try using zig as your C compiler.

yesib0

yesib0

It worked, thanks!

Where Next?

Popular in Questions Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement