Confluent-kafka-go: Can't install librdkafka on mac

Created on 18 Mar 2020  ·  5Comments  ·  Source: confluentinc/confluent-kafka-go

Description

An out of the box Mac does not allow creating the directory /usr/include even as root

How to reproduce

run "sudo make install" on any recent version of macos

Checklist

Please provide the following information:

  • [ ] confluent-kafka-go and librdkafka version (LibraryVersion()):
  • [ ] Apache Kafka broker version:
  • [ ] Client configuration: ConfigMap{...}
  • [x] Operating system: Macos Catalina
  • [ ] Provide client logs (with "debug": ".." as necessary)
  • [ ] Provide broker log excerpts
  • [x] Critical issue

Here is the make install output:

❯ sudo make install
Password:
Sorry, try again.
Password:
Install librdkafka to /usr
install -d $DESTDIR/usr/include/librdkafka && \
install -d $DESTDIR/usr/lib && \
install rdkafka.h rdkafka_mock.h $DESTDIR/usr/include/librdkafka && \
install librdkafka.a $DESTDIR/usr/lib && \
install librdkafka.1.dylib $DESTDIR/usr/lib && \
[ -f "rdkafka.pc" ] && ( \
install -d $DESTDIR/usr/lib/pkgconfig && \
install -m 0644 rdkafka.pc $DESTDIR/usr/lib/pkgconfig \
) && \
[ -f "rdkafka-static.pc" ] && ( \
install -d $DESTDIR/usr/lib/pkgconfig && \
install -m 0644 rdkafka-static.pc $DESTDIR/usr/lib/pkgconfig \
) && \
(cd $DESTDIR/usr/lib && ln -sf librdkafka.1.dylib librdkafka.dylib)
install: mkdir /usr/include: Operation not permitted
make[1]: * [lib-install] Error 71
make: *
[install] Error 2
❯ ls /usr/include
ls: /usr/include: No such file or directory
❯ sudo mkdir /usr/include
mkdir: /usr/include: Operation not permitted

You should choose a directory under /usr/local which is not controlled by SIP protection.

Most helpful comment

Ran into same issue. The instructions said to use ./configure --prefix=/usr. Changing it to ./configure --prefix=/usr/local made things work, thank you!

All 5 comments

librdkafka defaults to --prefix=/usr/local so you must have done ./configure --prefix=/usr ?

Ran into same issue. The instructions said to use ./configure --prefix=/usr. Changing it to ./configure --prefix=/usr/local made things work, thank you!

did you brew install?

~  brew info librdkafka                                                                                                                                                                                             Wed Mar 25 22:46:57 2020
librdkafka: stable 1.3.0 (bottled), HEAD
The Apache Kafka C/C++ library
https://github.com/edenhill/librdkafka
/usr/local/Cellar/librdkafka/1.3.0 (17 files, 3.3MB) *
  Poured from bottle on 2020-03-12 at 16:07:03
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/librdkafka.rb
==> Dependencies
Build: pkg-config ✔
Required: lz4 ✔, lzlib ✔, [email protected] ✔, zstd ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 3,881 (30 days), 12,887 (90 days), 64,462 (365 days)
install-on-request: 1,784 (30 days), 6,353 (90 days), 30,912 (365 days)
build-error: 0 (30 days)

Brew i

did you brew install?

~  brew info librdkafka                                                                                                                                                                                             Wed Mar 25 22:46:57 2020
librdkafka: stable 1.3.0 (bottled), HEAD
The Apache Kafka C/C++ library
https://github.com/edenhill/librdkafka
/usr/local/Cellar/librdkafka/1.3.0 (17 files, 3.3MB) *
  Poured from bottle on 2020-03-12 at 16:07:03
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/librdkafka.rb
==> Dependencies
Build: pkg-config ✔
Required: lz4 ✔, lzlib ✔, [email protected] ✔, zstd ✔
==> Options
--HEAD
  Install HEAD version
==> Analytics
install: 3,881 (30 days), 12,887 (90 days), 64,462 (365 days)
install-on-request: 1,784 (30 days), 6,353 (90 days), 30,912 (365 days)
build-error: 0 (30 days)

Brew currently installs version 1.3.0, but confluent-kafka-go requires version 1.4.0

You should important confluent-kafka-go v1 using gopkg as instructed in the README:
import "gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"

Was this page helpful?
0 / 5 - 0 ratings