Installing librdkafka on Windows to support Python development
<p>A little background: I am working on some python modules that other developers on our team will use. A common theme of each module is that one or more messages will be published to Kafka. We intend at this time to use the Confluent Kafka client. We are pretty new to python development in our organization -- we have traditionally been a .NET shop.</p>

<p>The complication: while the code that we create will run on Linux (rhel 7), most of the developers will do their work on Windows.</p>

<p>So we need the librdkafka C library compiled on each developer machine (which has dependencies of its own, one of which is OpenSSL). Then a pip install of confluent-kafka should just work, which means a pip install of our package will work. Theoretically.</p>

<p>To start I did the install on my Linux laptop (Arch). I knew I already had OpenSSL and the other zip lib dependencies available, so this process was painless:</p>

<ul>
<li>git clone librdkafka repo</li>
<li>configure, make and install per the README</li>
<li>pip install confluent-kafka</li>
<li>done</li>
</ul>

<p>The install of librdkafka went into <code>/usr/local</code>:</p>

<pre><code>/usr/local/lib/librdkafka.a
/usr/local/lib/librdkafka++.a
/usr/local/lib/librdkafka.so -&gt; librdkafka.so.l
/usr/local/lib/librdkafka++.so -&gt; librdkafka++.so.l
/usr/local/lib/librdkafka.so.l
/usr/local/lib/librdkafka++.so.l
/usr/local/lib/pkgconfig/rdkafka.pc
/usr/local/lib/pkgconfig/rdkafka++.pc
/usr/local/include/librdkafka/rdkafkacpp.h
/usr/local/include/librdkafka/rdkafka.h
</code></pre>

<p>Now the painful part, making it work on Windows:</p>

<ul>
<li>install <a href="https://slproweb.com/products/Win32OpenSSL.html" rel="nofollow">precompiled OpenSSL</a></li>
<li>git clone librdkafka repo</li>
<li>open in VS2015</li>
<li>install libz via NuGet</li>
<li>build solution</li>
<li><strong>install to where???</strong></li>
</ul>

<p>This is where I'm stuck. <strong>What would a standard install on a Windows 7/8/10 machine look like?</strong></p>

<p>I have the following from the build output, but no idea what should go where in order to make the <code>pip install confluent-kafka</code> "just work":</p>

<pre><code>/librdkafka/win32/Release/librdkafka.dll
/librdkafka/win32/Release/librdkafka.exp
/librdkafka/win32/Release/librdkafka.lib
/librdkafka/win32/Release/librdkafkacpp.dll
/librdkafka/win32/Release/librdkafkacpp.exp
/librdkafka/win32/Release/librdkafkacpp.lib
/librdkafka/win32/Release/zlib.dll
&lt;and the .h files back in the src&gt;
</code></pre>

<p>Any recommendations on an install location?</p>

<p>I'm not sure where the ideal place to install on Windows would be, but I ran the following test with some success.</p>

<p>I copied my output and headers to <code>C:\test\lib</code> and <code>C:\test\include</code>, then ran a pip install with the following options:</p>

<pre><code> pip install --global-option=build_ext --global-option="-LC:\test\lib" --global-option="-IC:\test\include" confluent-kafka
</code></pre>

<p>Unfortunately, this doesn't quite work because the confluent-kafka setup does not support Windows at this time: <a href="https://github.com/confluentinc/confluent-kafka-python/issues/52#issuecomment-252098462" rel="nofollow">https://github.com/confluentinc/confluent-kafka-python/issues/52#issuecomment-252098462</a></p>

python windows apache-kafka