apache / pulsar-client-node

Apache Pulsar NodeJS Client
https://pulsar.apache.org/
Apache License 2.0
148 stars 85 forks source link

Looks like the pulsar-client-node can not run with the current pulsar master code #161

Open zymap opened 3 years ago

zymap commented 3 years ago

Motivation

Install the pulsar-client-node with latest pulsar-client-cpp failed. error logs:

make: Entering directory '/pulsar/node_modules/pulsar-client/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  AR(target) Release/obj.target/../node-addon-api/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/Pulsar/src/addon.o
In file included from ../src/addon.cc:20:
../src/Message.h:24:10: fatal error: pulsar/c/message.h: No such file or directory
 #include <pulsar/c/message.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Pulsar.target.mk:124: Release/obj.target/Pulsar/src/addon.o] Error 1
make: Leaving directory '/pulsar/node_modules/pulsar-client/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.10.25-linuxkit
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/pulsar/node_modules/pulsar-client/build/Release/libpulsar.node" "--module_name=libpulsar" "--module_path=/pulsar/node_modules/pulsar-client/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /pulsar/node_modules/pulsar-client
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/pulsar/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/pulsar/node_modules/pulsar-client/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/pulsar/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1055:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Linux 5.10.25-linuxkit
node-pre-gyp ERR! command "/usr/bin/node" "/pulsar/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /pulsar/node_modules/pulsar-client
node-pre-gyp ERR! node -v v14.17.0
node-pre-gyp ERR! node-pre-gyp -v v0.15.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/pulsar/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/pulsar/node_modules/pulsar-client/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm WARN enoent ENOENT: no such file or directory, open '/pulsar/package.json'
npm WARN pulsar No description
npm WARN pulsar No repository field.
npm WARN pulsar No README data
npm WARN pulsar No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pulsar-client@1.3.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pulsar-client@1.3.0 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!     /root/.npm/_logs/2021-06-07T14_02_09_069Z-debug.log

We should have a CI to run the tests with the latest pulsar code to check the compatibility./

k2la commented 3 years ago

From your log, it looks like pulsar-client-cpp is not installed. Please try again after installing pulsar-client-cpp.

Also, please tell us the system configuration (OS, client version).

We should have a CI to run the tests with the latest pulsar code to check the compatibility./

We will consider having it.

arihantdaga commented 3 years ago

I am facing the same. I installed pulsar cpp client in ubuntu following the instructions on https://pulsar.apache.org/docs/en/client-libraries-cpp/, using the deb package, it has also created libpulsar and libpulsar.so in my /usr/lib folder. But i don't know where these files should be found - '<pulsar/c/message.h>'

kimula commented 3 years ago

let me confirm, have you installed apache-pulsar-client-dev.deb?

jskorlol commented 2 years ago

I have the same problem. Unable to install from linux docker. How can I solve this ?

I got the same error whether I installed apache-pulsar-client-dev.deb or not.

k2la commented 2 years ago

@jskorlol Installation instructions for rpm or debian have been added at https://github.com/apache/pulsar-client-node/pull/213. Please see https://github.com/apache/pulsar-client-node#install-on-linux and try again.

nearzxide10 commented 2 years ago

I

I have the same problem. Unable to install from linux docker. How can I solve this ?

I got the same error whether I installed apache-pulsar-client-dev.deb or not.

I have the same problem too , but my environment : docker image : node:16.15.1 (debian) platform : linux/arm64

my Dockerfile

FROM node:16.15.1
WORKDIR /srv
ADD . .
RUN apt update && apt install -y zip wget curl gnupg g++ make
ARG PULSAR_CPP_CLIENT_VERSION=2.9.1
RUN wget --no-check-certificate --user-agent=Mozilla -O apache-pulsar-client-dev.deb "https://archive.apache.org/dist/pulsar/pulsar-${PULSAR_CPP_CLIENT_VERSION}/DEB/apache-pulsar-client.deb" && \
    wget --no-check-certificate --user-agent=Mozilla -O apache-pulsar-client.deb "https://archive.apache.org/dist/pulsar/pulsar-${PULSAR_CPP_CLIENT_VERSION}/DEB/apache-pulsar-client-dev.deb" && \
    dpkg --force-architecture -i apache-pulsar-client*.deb
RUN npm install --save pulsar-client
RUN npm install
CMD [ "node", "index.js" ]

error message

#11 15.28 npm notice
#11 15.28 npm ERR! code 1
#11 15.28 npm ERR! path /srv/node_modules/pulsar-client
#11 15.28 npm ERR! command failed
#11 15.28 npm ERR! command sh -c node-pre-gyp install --fallback-to-build
#11 15.28 npm ERR! make: Entering directory '/srv/node_modules/pulsar-client/build'
#11 15.28 npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
#11 15.28 npm ERR! AR(target) Release/obj.target/../node-addon-api/nothing.a
#11 15.28 npm ERR! COPY Release/nothing.a
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/addon.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/Message.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/MessageId.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/Authentication.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/Client.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/Producer.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/ProducerConfig.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/Consumer.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/ConsumerConfig.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/Reader.o
#11 15.28 npm ERR! CXX(target) Release/obj.target/Pulsar/src/ReaderConfig.o
#11 15.28 npm ERR! SOLINK_MODULE(target) Release/obj.target/Pulsar.node
#11 15.28 npm ERR! make: Leaving directory '/srv/node_modules/pulsar-client/build'
#11 15.28 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/srv/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/srv/node_modules/pulsar-client/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
#11 15.28 npm ERR! node-pre-gyp info it worked if it ends with ok
#11 15.28 npm ERR! node-pre-gyp info using node-pre-gyp@1.0.9
#11 15.28 npm ERR! node-pre-gyp info using node@16.15.1 | linux | arm64
#11 15.28 npm ERR! node-pre-gyp info check checked for "/srv/node_modules/pulsar-client/build/Release/libpulsar.node" (not found)
#11 15.28 npm ERR! node-pre-gyp http GET https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.6.2-node-v93-linux-arm64.tar.gz
#11 15.28 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.6.2-node-v93-linux-arm64.tar.gz
#11 15.28 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for pulsar-client@1.6.2 and node@16.15.1 (node-v93 ABI, glibc) (falling back to source compile with node-gyp)
#11 15.28 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.6.2-node-v93-linux-arm64.tar.gz
#11 15.28 npm ERR! gyp info it worked if it ends with ok
#11 15.28 npm ERR! gyp info using node-gyp@9.0.0
#11 15.28 npm ERR! gyp info using node@16.15.1 | linux | arm64
#11 15.28 npm ERR! gyp info ok
#11 15.28 npm ERR! gyp info it worked if it ends with ok
#11 15.28 npm ERR! gyp info using node-gyp@9.0.0
#11 15.28 npm ERR! gyp info using node@16.15.1 | linux | arm64
#11 15.28 npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
#11 15.28 npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.1/node-v16.15.1-headers.tar.gz
#11 15.28 npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.1/node-v16.15.1-headers.tar.gz
#11 15.28 npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.1/SHASUMS256.txt
#11 15.28 npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.1/SHASUMS256.txt
#11 15.28 npm ERR! gyp info spawn /usr/bin/python3
#11 15.28 npm ERR! gyp info spawn args [
#11 15.28 npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#11 15.28 npm ERR! gyp info spawn args 'binding.gyp',
#11 15.28 npm ERR! gyp info spawn args '-f',
#11 15.28 npm ERR! gyp info spawn args 'make',
#11 15.28 npm ERR! gyp info spawn args '-I',
#11 15.28 npm ERR! gyp info spawn args '/srv/node_modules/pulsar-client/build/config.gypi',
#11 15.28 npm ERR! gyp info spawn args '-I',
#11 15.28 npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#11 15.28 npm ERR! gyp info spawn args '-I',
#11 15.28 npm ERR! gyp info spawn args '/root/.cache/node-gyp/16.15.1/include/node/common.gypi',
#11 15.28 npm ERR! gyp info spawn args '-Dlibrary=shared_library',
#11 15.28 npm ERR! gyp info spawn args '-Dvisibility=default',
#11 15.28 npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/16.15.1',
#11 15.28 npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
#11 15.28 npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.15.1/<(target_arch)/node.lib',
#11 15.28 npm ERR! gyp info spawn args '-Dmodule_root_dir=/srv/node_modules/pulsar-client',
#11 15.28 npm ERR! gyp info spawn args '-Dnode_engine=v8',
#11 15.28 npm ERR! gyp info spawn args '--depth=.',
#11 15.28 npm ERR! gyp info spawn args '--no-parallel',
#11 15.28 npm ERR! gyp info spawn args '--generator-output',
#11 15.28 npm ERR! gyp info spawn args 'build',
#11 15.28 npm ERR! gyp info spawn args '-Goutput_dir=.'
#11 15.28 npm ERR! gyp info spawn args ]
#11 15.28 npm ERR! gyp info ok
#11 15.28 npm ERR! gyp info it worked if it ends with ok
#11 15.28 npm ERR! gyp info using node-gyp@9.0.0
#11 15.28 npm ERR! gyp info using node@16.15.1 | linux | arm64
#11 15.28 npm ERR! gyp info spawn make
#11 15.28 npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/8/../../../../lib/libpulsar.so when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/8/../../../../lib/libpulsar.a when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible /usr/lib/../lib/libpulsar.so when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible /usr/lib/../lib/libpulsar.a when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/8/../../../libpulsar.so when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/8/../../../libpulsar.a when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible //usr/lib/libpulsar.so when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: skipping incompatible //usr/lib/libpulsar.a when searching for -lpulsar
#11 15.28 npm ERR! /usr/bin/ld: cannot find -lpulsar
#11 15.28 npm ERR! collect2: error: ld returned 1 exit status
#11 15.28 npm ERR! make: *** [Pulsar.target.mk:153: Release/obj.target/Pulsar.node] Error 1
#11 15.28 npm ERR! gyp ERR! build error
#11 15.28 npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
#11 15.28 npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
#11 15.28 npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
#11 15.28 npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
#11 15.28 npm ERR! gyp ERR! System Linux 5.10.104-linuxkit
#11 15.28 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/srv/node_modules/pulsar-client/build/Release/libpulsar.node" "--module_name=libpulsar" "--module_path=/srv/node_modules/pulsar-client/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
#11 15.28 npm ERR! gyp ERR! cwd /srv/node_modules/pulsar-client
#11 15.28 npm ERR! gyp ERR! node -v v16.15.1
#11 15.28 npm ERR! gyp ERR! node-gyp -v v9.0.0
#11 15.28 npm ERR! gyp ERR! not ok
#11 15.28 npm ERR! node-pre-gyp ERR! build error
#11 15.28 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/srv/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/srv/node_modules/pulsar-client/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
#11 15.28 npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/srv/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#11 15.28 npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:527:28)
#11 15.28 npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
#11 15.28 npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
#11 15.28 npm ERR! node-pre-gyp ERR! System Linux 5.10.104-linuxkit
#11 15.28 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/srv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#11 15.28 npm ERR! node-pre-gyp ERR! cwd /srv/node_modules/pulsar-client
#11 15.28 npm ERR! node-pre-gyp ERR! node -v v16.15.1
#11 15.28 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
#11 15.28 npm ERR! node-pre-gyp ERR! not ok
#11 15.29
#11 15.29 npm ERR! A complete log of this run can be found in:
#11 15.29 npm ERR! /root/.npm/_logs/2022-06-23T08_48_06_306Z-debug-0.log
------
executor failed running [/bin/sh -c npm install pulsar-client]: exit code: 1

but at linux/amd64 is ok

reference: https://github.com/alexyans/docker-node-pulsar-client/blob/master/14-alpine/Dockerfile