librdkafka

https://github.com/edenhill/librdkafka/



安装


STATIC_LIB_libzstd=) ./configure --enable-static
make sudo make install
% sudo make install
Password:
Install librdkafka to /usr/local
/usr/bin/install -d $DESTDIR/usr/local/include/librdkafka
/usr/bin/install -d $DESTDIR/usr/local/lib
/usr/bin/install rdkafka.h rdkafka_mock.h $DESTDIR/usr/local/include/librdkafka
/usr/bin/install librdkafka.a $DESTDIR/usr/local/lib
[ ! -f librdkafka-static.a ] || /usr/bin/install librdkafka-static.a $DESTDIR/usr/local/lib
/usr/bin/install librdkafka.1.dylib $DESTDIR/usr/local/lib
[ -f "rdkafka.pc" ] && ( \
/usr/bin/install -d $DESTDIR/usr/local/lib/pkgconfig && \
/usr/bin/install -m 0644 rdkafka.pc $DESTDIR/usr/local/lib/pkgconfig \
)
[ -f "rdkafka-static.pc" ] && ( \
/usr/bin/install -d $DESTDIR/usr/local/lib/pkgconfig && \
/usr/bin/install -m 0644 rdkafka-static.pc $DESTDIR/usr/local/lib/pkgconfig \
)
(cd $DESTDIR/usr/local/lib && ln -sf librdkafka.1.dylib librdkafka.dylib)
Install librdkafka++ to /usr/local
/usr/bin/install -d $DESTDIR/usr/local/include/librdkafka
/usr/bin/install -d $DESTDIR/usr/local/lib
/usr/bin/install rdkafkacpp.h $DESTDIR/usr/local/include/librdkafka
/usr/bin/install librdkafka++.a $DESTDIR/usr/local/lib
[ ! -f librdkafka++-static.a ] || /usr/bin/install librdkafka++-static.a $DESTDIR/usr/local/lib
/usr/bin/install librdkafka++.1.dylib $DESTDIR/usr/local/lib
[ -f "rdkafka++.pc" ] && ( \
/usr/bin/install -d $DESTDIR/usr/local/lib/pkgconfig && \
/usr/bin/install -m 0644 rdkafka++.pc $DESTDIR/usr/local/lib/pkgconfig \
)
[ -f "rdkafka++-static.pc" ] && ( \
/usr/bin/install -d $DESTDIR/usr/local/lib/pkgconfig && \
/usr/bin/install -m 0644 rdkafka++-static.pc $DESTDIR/usr/local/lib/pkgconfig \
)
(cd $DESTDIR/usr/local/lib && ln -sf librdkafka++.1.dylib librdkafka++.dylib)
Checking librdkafka integrity
librdkafka.1.dylib OK
librdkafka.a OK
Symbol visibility OK
Generating pkg-config file rdkafka++-static.pc
Checking librdkafka++ integrity
librdkafka++.1.dylib OK
librdkafka++.a OK
/Library/Developer/CommandLineTools/usr/bin/make -C examples
make[1]: Nothing to be done for `all'.
Updating CONFIGURATION.md
Installing documentation to /usr/local
/usr/bin/install -d $DESTDIR/usr/local/share/doc/librdkafka
/usr/bin/install LICENSE LICENSES.txt INTRODUCTION.md README.md CONFIGURATION.md STATISTICS.md CHANGELOG.md $DESTDIR/usr/local/share/doc/librdkafka


% sudo cp /usr/local/lib/librdkafka.a /Users/xiazemin/.gvm/pkgsets/go1.18/global/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.8.2/kafka/librdkafka_vendor/librdkafka_darwin.a



https://github.com/edenhill/librdkafka/
https://github.com/edenhill/librdkafka/pull/2413



https://github.com/confluentinc/confluent-kafka-go/



tree/master/kafka/librdkafka_vendor


./import.sh ~/path/to/librdkafka-static-bundle-v1.4.0.tgz


First create the static librdkafka bundle following the instructions in librdkafka’s packaging/nuget/README.md.



https://github.com/edenhill/librdkafka/tree/master/packaging/nuget



cd packaging/nuget 
./release.py v0.19.0
./release.py --class StaticPackage v0.19.0


pip3 install –trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple -r requirements.txt



python release.py v0.11.0



https://github.com/confluentinc/confluent-kafka-go/issues/591



It should be fairly straight forward to make build_..go files that match on a static_external tag that links librdkafka-static.a from a system location rather then librdkafka_vendor.



https://github.com/confluentinc/confluent-kafka-go/issues/565



https://github.com/edenhill/librdkafka/tree/master/packaging



sudo cp /usr/local/lib/librdkafka-static.a /Users/xiazemin/.gvm/pkgsets/go1.18/global/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.8.2/kafka/librdkafka_vendor/librdkafka_darwin.a



% sudo cp src/rdkafka.h /Users/xiazemin/.gvm/pkgsets/go1.18/global/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.8.2/kafka/librdkafka_vendor/rdkafka.h



/Users/xiazemin/.gvm/pkgsets/go1.18/global/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.8.2/kafka/build_darwin.go



//// #cgo CFLAGS: -DUSE_VENDORED_LIBRDKAFKA -DLIBRDKAFKA_STATICLIB
//// #cgo LDFLAGS: ${SRCDIR}/librdkafka_vendor/librdkafka_darwin.a -lm -lsasl2 -ldl -lpthread
// #cgo pkg-config: rdkafka
import "C"


https://github.com/Blizzard/node-rdkafka/issues/937



% BUILD_LIBRDKAFKA=0 yarn https://www.npmjs.com/package/node-rdkafka



1.0

// +build static
// +build !static_all

package kafka

// #cgo pkg-config: rdkafka-static
import "C"


// +build !static
// +build static_all

package kafka

// #cgo pkg-config: rdkafka-static
// #cgo LDFLAGS: -static
import "C"


Category storage