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

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
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
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
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
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement