Coder Social home page Coder Social logo

Comments (16)

edenhill avatar edenhill commented on August 21, 2024 2

@mewwts The master branch of the Go client requires the master branch of librdkafka (the development is kept in synch).

So you have two options:

  • use the latest release of the Go client (v0.9.4) with a recent release of librdkafka (>=v0.9.4)
  • remove any installed versions of librdkafka, clone librdkafka master and build and install it.

from confluent-kafka-go.

edenhill avatar edenhill commented on August 21, 2024 2

pkg-config will need to find the rdkafka.pc file that is installed when you do 'make install' in librdkafka, the location depends on ./configure --prefix and defaults to /usr/local.
It might be the case that /usr/local is not in your PKG_CONFIG_PATH, the easiest fix is to install librdkafka into /usr, like this:

$ ./configure --prefix /usr
$ make
$ sudo make install

from confluent-kafka-go.

edenhill avatar edenhill commented on August 21, 2024 1

from confluent-kafka-go.

ram-rana-16 avatar ram-rana-16 commented on August 21, 2024 1

Thanks, i got working 👍

from confluent-kafka-go.

edenhill avatar edenhill commented on August 21, 2024 1

@liaoyizhe Make sure to install librdkafka v0.11.0 as instructed here:
https://github.com/confluentinc/confluent-kafka-go/#installing-librdkafka

from confluent-kafka-go.

edenhill avatar edenhill commented on August 21, 2024 1

That looks like it is finding librdkafka >0.11.0 when compiling (rdkafka.h header file) but not when linking (library file).

I suggest removing all installed versions of librdkafka from your system, using both your package manager and by searching for rdkafka.h and librdkafka.so*.

Then build and install librdkafka 0.11.3 (latest version) and then rebuild the Go client (go clean -i ./... first).

from confluent-kafka-go.

mewwts avatar mewwts commented on August 21, 2024

I have librdkafka installed, but still see this error. Could you be a bit more specific on what causes this?

from confluent-kafka-go.

mewwts avatar mewwts commented on August 21, 2024

Thanks a bunch @edenhill - that was clarifying!

from confluent-kafka-go.

gaurav36 avatar gaurav36 commented on August 21, 2024

@edenhill Hi edenhill,

  1. I have installed librdkafka from source code from git clone https://github.com/edenhill/librdkafka.git and doing make install.
    After then cloning "go get -u github.com/confluentinc/confluent-kafka-go/kafka" its giving following error:

pkg-config --cflags rdkafka
Package rdkafka was not found in the pkg-config search path.
Perhaps you should add the directory containing `rdkafka.pc'
to the PKG_CONFIG_PATH environment variable
No package 'rdkafka' found
pkg-config: exit status 1

  1. If i insalled librdkafka from binary (latest version is 0.9.5) and if i clone confluent-kafka-go its giving following error:
    $ go get gopkg.in/confluentinc/confluent-kafka-go.v0/examples/go-kafkacat
    github.com/confluentinc/confluent-kafka-go/kafka
    could not determine kind of name for C.RD_KAFKA_EVENT_STATS

Do i need to install librdkafka 0.9.4 for making it sync with confluent-kafka-go v0.9.4-RC2 ?

Any clue on this issue ?

from confluent-kafka-go.

gaurav36 avatar gaurav36 commented on August 21, 2024

@edenhill thank you very much for your reply. I did the same things previously that you have described in your comment. But still the same error after cleaning up every thing and re installing librdkafka from source then doing
$ go get -u github.com/confluentinc/confluent-kafka-go/kafka

Its showing following error again:
pkg-config --cflags rdkafka Package rdkafka was not found in the pkg-config search path. Perhaps you should add the directory containing "rdkafka.pc" to the PKG_CONFIG_PATH environment variable No package "rdkafka" found pkg-config: exit status 1

If i install librdkafka from rpm then importing kafka using
$ go get -u github.com/confluentinc/confluent-kafka-go/kafka
Its showing following error:
02:10 PM Tue Jun 06$ go get -u github.com/confluentinc/confluent-kafka-go/kafka github.com/confluentinc/confluent-kafka-go/kafka /tmp/go-build990109538/github.com/confluentinc/confluent-kafka-go/kafka/_obj/event.cgo2.o: In function _cgo_2117b3ae5bb7_Cfunc_rd_kafka_event_stats: confluentinc/confluent-kafka-go/kafka/event.go:127: undefined reference to rd_kafka_event_stats collect2: error: ld returned 1 exit status

I cleaned up everything and started again both way its showing the same error.

from confluent-kafka-go.

edenhill avatar edenhill commented on August 21, 2024

Sorry for the delay.

The first problem seems to be an installation path problem, librdkafka is installed into a location where pkg-config will not look. You can probably set up PKG_CONFIG_PATH to point to the directory containing the installed rdkafka.pc file.

The latter problem is that the RPM package is too old, you should use the Confluent YUM repositories to make sure you have the latest version of librdkafka installed:
http://docs.confluent.io/current/installation.html#rpm-packages-via-yum

I would go for this second approach.

from confluent-kafka-go.

liaoyizhe avatar liaoyizhe commented on August 21, 2024

@edenhill
I'm sorry to bother you
The program reported an error

/tmp/go-build129217119/command-line-arguments/_obj/exe/producer_example: error while loading shared libraries: librdkafka.so.1: cannot open shared object file: No such file or directory

how can i fix it?
thank u.

from confluent-kafka-go.

lghinet avatar lghinet commented on August 21, 2024

hello,
kind of having the same problem, but on windows with visual studio code

# pkg-config --cflags rdkafka
pkg-config: exec: "pkg-config": executable file not found in %PATH%
Process exiting with code: 2

i dont have pkg-config on windows
@edenhill you mention two options

So you have two options:
use the latest release of the Go client (v0.9.4) with a recent release of librdkafka (>=v0.9.4)
remove any installed versions of librdkafka, clone librdkafka master and build and install it.

how can i use the first one ? if i want the latest librdkafka release from
https://github.com/edenhill/librdkafka/releases/tag/v0.11.0 they only provide sources which i have to compile right ?
can i use microsoft windows nuget ?! with go ? ..
thanks

from confluent-kafka-go.

lisadeng avatar lisadeng commented on August 21, 2024

Hi @edenhill ,
Sorry to bother you.
Actually, couple of years ago, you helped me figure out an issue of kafka php client. :)
Recently I had a try on kafka golang client, after installing librdkafka by apt-get install librdkafka, I came across the error:

2017/12/11 07:51:34 ERROR ▶ 0005 Failed to build the application: # github.com/confluentinc/confluent-kafka-go/kafka
../github.com/confluentinc/confluent-kafka-go/kafka/00version.go:45:2: error: #error "confluent-kafka-go requires librdkafka v0.11.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html"

Then I build it from source, another error occurred:

2017/12/11 08:07:06 ERROR ▶ 0005 Failed to build the application: # github.com/confluentinc/confluent-kafka-go/kafka
/tmp/go-build337827339/github.com/confluentinc/confluent-kafka-go/kafka/_obj/consumer.cgo2.o: In function _cgo_dbdabba0f90b_Cfunc_rd_kafka_offsets_store': /tmp/go-build/github.com/confluentinc/confluent-kafka-go/kafka/_obj/cgo-gcc-prolog:306: undefined reference to rd_kafka_offsets_store'
/tmp/go-build337827339/github.com/confluentinc/confluent-kafka-go/kafka/_obj/event.cgo2.o: In function _cgo_dbdabba0f90b_Cfunc_rd_kafka_event_stats': /tmp/go-build/github.com/confluentinc/confluent-kafka-go/kafka/_obj/cgo-gcc-prolog:98: undefined reference to rd_kafka_event_stats'
/tmp/go-build337827339/github.com/confluentinc/confluent-kafka-go/kafka/_obj/offset.cgo2.o: In function _cgo_dbdabba0f90b_Cfunc_rd_kafka_offsets_for_times': /tmp/go-build/github.com/confluentinc/confluent-kafka-go/kafka/_obj/cgo-gcc-prolog:61: undefined reference to rd_kafka_offsets_for_times'
/tmp/go-build337827339/github.com/confluentinc/confluent-kafka-go/kafka/_obj/producer.cgo2.o: In function do_produce': ../github.com/confluentinc/confluent-kafka-go/kafka/producer.go:41: undefined reference to rd_kafka_producev'
collect2: error: ld returned 1 exit status

File rdkafka++.pc and rdkafka.pc exist under folder /usr/lib/pkgconfig, and export PKG_CONFIG_PATH=/usr/lib/pkgconfig was executed.

Could you help to give me some advice? Not sure what went wrong.
Thanks a lot!

from confluent-kafka-go.

lisadeng avatar lisadeng commented on August 21, 2024

@edenhill
Thank you so much for your help.
It works!

from confluent-kafka-go.

edenhill avatar edenhill commented on August 21, 2024

@lisadeng Glad to hear!

from confluent-kafka-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.