Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding kafkacat #29792

Merged
merged 1 commit into from Sep 29, 2017
Merged

Adding kafkacat #29792

merged 1 commit into from Sep 29, 2017

Conversation

nyarly
Copy link
Contributor

@nyarly nyarly commented Sep 26, 2017

No description provided.


# NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow";

# configureFlags = stdenv.lib.optionals stdenv.isDarwin [ "--disable-ssl" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is about the commented-out code?

configureFlags = "--includedir=${rdkafka}/include/librdkafka";

meta = with stdenv.lib; {
description = "kafkacat - generic non-JVM producer and consumer for Apache Kafka";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description should not start with the package name.

configureFlags = "--includedir=${rdkafka}/include/librdkafka";

meta = with stdenv.lib; {
description = "generic non-JVM producer and consumer for Apache Kafka";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also capitalize generic.

Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format commit messages according to the manual: https://nixos.org/nixpkgs/manual/#chap-submitting-changes

@@ -0,0 +1,25 @@
{ stdenv, fetchFromGitHub, zlib, perl, pkgconfig, rdkafka, yajl }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perl is not needed.

sha256 = "1fgs04rclgfwri6vd9lj0mw545nmscav9p6kh7r28k5ap2g0gak5";
};

buildInputs = [ zlib perl pkgconfig rdkafka yajl ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perl is not needed. pkgconfig should go to nativeBuildInputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why nativeBuildInputs? I've never clearly understood the distinction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@Mic92 Mic92 Sep 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is important for cross-compiling, where you have dependencies like a compiler build for the current running architectures and libraries which are compiled for the target architecture.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would I have figured out that pkgconfig should go in nativeBuildInputs?

Candidly, I started by copying the rdkafa expression, which is why perl is in there and pkgconfig is a regulart buildInput

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All programs that run during the build are nativeBuildInputs, and basically all libraries are buildInputs. pkgconfig is a program.

Until recently pkgconfig was explicitly automatically promoted from buildInputs into nativeBuildInputs so there was no practical difference. Since #29584 it is no longer the case, and packages with pkgconfig in buildInputs are broken for cross compilation.


buildInputs = [ zlib perl pkgconfig rdkafka yajl ];

configureFlags = "--includedir=${rdkafka}/include/librdkafka";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why did I need to add the rdkafka include dir, but yajl's gets added automatically? I can't see a salient difference in the respective expressions (e.g. multiple outputs)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not need this; I've removed this line.
Both ${rdkafka}/include and ${yajl}/include are made available for the build. Since kafkacat uses #include <librdkafka/rdkafka.h>, this is enough. However, if kafkacat used #include <rdkafka.h> instead, ${rdkafka}/include/librdkafka wouldn't be available by default and you'd have to help kafkacat find that header with --includedir=${rdkafka}/include/librdkafka.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested without? I added this line because it didn't build initially - errors related to an undefined type, and adding this fixed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But: I don't know why it would work or not, so grain of salt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly I've built it. If this include were necessary, the error would have looked like this:

In file included from kafkacat.c:50:0:
kafkacat.h:35:21: fatal error: rdkafka.h: No such file or directory
 #include <rdkafka.h>
                     ^
compilation terminated.
make: *** [mklove/Makefile.base:77: kafkacat.o] Error 1

@orivej orivej merged commit 8d4ef09 into NixOS:master Sep 29, 2017
@orivej
Copy link
Contributor

orivej commented Sep 29, 2017

Thank you! I've cleaned it up a bit and merged.

@nyarly nyarly deleted the kafkacat branch September 29, 2017 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants