confluentinc / librdkafka

The Apache Kafka C/C++ library
Other
278 stars 3.15k forks source link

error with 'fatal error: sasl/sasl.h: No such file or directory #include <sasl/sasl.h>' when run `npm install node-rdkafka` #1606

Closed clChenLiang closed 6 years ago

clChenLiang commented 6 years ago

Description

when I use npm install node-rdkafa to install the kafka on my Mac & Linux computer. There give me some error bellow:

./deps/librdkafka/src/rdkafka_sasl_cyrus.c:39:23: fatal error: sasl/sasl.h: No such file or directory
 #include <sasl/sasl.h>
                       ^
compilation terminated.
make: *** [Release/obj.target/librdkafka/deps/librdkafka/src/rdkafka_sasl_cyrus.o] Error 1
make: Leaving directory `/home/souche/app/ali_kafka_test/aliware-kafka-demos/kafka-nodejs-demo/node_modules/node-rdkafka/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/souche/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.2.0-42-generic
gyp ERR! command "/home/souche/.nvm/versions/node/v8.9.1/bin/node" "/home/souche/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/souche/app/ali_kafka_test/aliware-kafka-demos/kafka-nodejs-demo/node_modules/node-rdkafka
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN kafka-nodejs-demo@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-rdkafka@1.0.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-rdkafka@1.0.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/souche/.npm/_logs/2017-12-26T09_34_31_345Z-debug.log

and I search the source code to find that :

no sasl/sasl.h file exited

how can fixed this problem ? thanks !

nmred commented 6 years ago

@clChenLiang You can try install cyrus-sasl-devel and cyrus-sasl-lib package

clChenLiang commented 6 years ago

thanks ,but both the two packages were not found. and npm install cyrus-sasl-lib & npm install cyrus-sasl-devel were my command just use.

nmred commented 6 years ago

@clChenLiang cyrus-sasl-devel and cyrus-sasl-lib not is js package, you need use yum or apt-get install

clChenLiang commented 6 years ago

谢谢你的指点。虽然在 Mac 上,使用 brew 找不到 cyrus-sasl-develcyrus-sasl-lib 两个模块。
最后,受你的启发,使用 brew 指令更新了一下 openssl#include <sasl/sasl.h> 缺失的问题就解决了。谢谢你!

edenhill commented 6 years ago

This is a problem with node-rdkafka, please file an issue here