生成时对sasl\u x的未定义引用

zqry0prt  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(539)

我正在用librdkafka库用gcc编译我的程序,
我收到这种错误未定义的引用sasl\u的东西
//usr/local/lib/librdkafka.a(rdkafka\u sasl\u cyrus.o):函数中 rd_kafka_sasl_cyrus_close': /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:409: undefined reference to sasl\u dispose'//usr/local/lib/librdkafka.a(rdkafka\u sasl\u cyrus.o):在函数中 rd_kafka_sasl_cyrus_recv': /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:74: undefined reference to sasl\u client\u step'/home/ilan/librdkafka master/src/rdkafka\u sasl\u cyrus.cemoji symbols:100未定义引用 sasl_errdetail' /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:112: undefined reference to sasl\u getprop'/home/ilan/librdkafka master/src/rdkafka\u sasl\u cyrus.c:116:未定义引用 sasl_getprop' /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:120: undefined reference to sasl\u getprop'//usr/local/lib/librdkafka.a(rdkafka\u sasl\u cyrus.o):在函数中 rd_kafka_sasl_cyrus_client_new': /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:462: undefined reference to sasl\u client\u new'/home/ilan/librdkafka master/src/rdkafka\u sasl\u cyrus.c:484:未定义引用 sasl_client_start' /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:502: undefined reference to sasl\u errdetail'/home/ilan/librdkafka master/src/rdkafka\u sasl\u cyrus.c:473:未定义引用 sasl_listmech' /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:466: undefined reference to sasl\u errstring'//usr/local/lib/librdkafka.a(rdkafka\u sasl\u cyrus.o):在函数中 rd_kafka_sasl_cyrus_global_init': /home/ilan/librdkafka-master/src/rdkafka_sasl_cyrus.c:604: undefined reference to sasl\u client\u init'/home/ilan/librdkafka master/src/rdkafka\u sasl\u cyrus.c:606:未定义对“sasl\u errstring”的引用
我的makefile看起来像这样
libs=-l../utils-lutils-l../network-lnetwork-wl,-bstatic-lev-ljansson-lmpdec-lrdkafka-lrdkafka++-lz-llz4-lssl-lcrypto-lhiredis-wl,-bdynamic-lm-lpthread-ldl-lcurl-lstdc++
我肯定图书馆有问题,但我不知道到底是什么,
也许使用pkg-config-rdkafka可以解决这个问题,但是我不知道如何在这里使用它。
你能给个建议吗?

bz4sfanl

bz4sfanl1#

cyryus sasl没有联系。库通常被命名为sasl2,因此添加-lsasl2应该可以解决这个问题。
我刚刚在我的系统(gentoolinux)上安装了rdkafka,它的pkg配置文件包含-lsasl2。所以是的。使用pkg配置也可以解决上述问题。
请参见如何在makefile中使用pkg config。
要获得私有库,请使用:

LDFLAGS  += `pkg-config rdkafka --libs --static`

相关问题